Commit 99951c90 authored by mukai@chromium.org's avatar mukai@chromium.org

Fixes the initialization of focus and activation management.

- We don't have to use DefaultActivationController because
  wm::FocusController provides activation controls.
- FocusController should be registered as a pre-target handler
  to change the focus on mouse click.
- InitializeInputMethodForTesting seems unnecessary. Text input
  is working well while no actual input methods are available.

BUG=None
R=jamescook@chromium.org, oshima@chromium.org
TEST=manually

Review URL: https://codereview.chromium.org/310463010

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@274596 0039d316-1c4b-4281-b951-d872f2087c98
parent a0412516
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include "ui/wm/core/base_focus_rules.h" #include "ui/wm/core/base_focus_rules.h"
#include "ui/wm/core/compound_event_filter.h" #include "ui/wm/core/compound_event_filter.h"
#include "ui/wm/core/cursor_manager.h" #include "ui/wm/core/cursor_manager.h"
#include "ui/wm/core/default_activation_client.h"
#include "ui/wm/core/focus_controller.h" #include "ui/wm/core/focus_controller.h"
#include "ui/wm/core/input_method_event_filter.h" #include "ui/wm/core/input_method_event_filter.h"
#include "ui/wm/core/native_cursor_manager.h" #include "ui/wm/core/native_cursor_manager.h"
...@@ -231,8 +230,7 @@ void ShellDesktopController::CreateRootWindow() { ...@@ -231,8 +230,7 @@ void ShellDesktopController::CreateRootWindow() {
test_screen_.reset(aura::TestScreen::Create()); test_screen_.reset(aura::TestScreen::Create());
// TODO(jamescook): Replace this with a real Screen implementation. // TODO(jamescook): Replace this with a real Screen implementation.
gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen_.get()); gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen_.get());
// TODO(jamescook): Initialize a real input method. // TODO(mukai): Set up input method.
ui::InitializeInputMethodForTesting();
// Set up basic pieces of ui::wm. // Set up basic pieces of ui::wm.
gfx::Size size = GetPrimaryDisplaySize(); gfx::Size size = GetPrimaryDisplaySize();
...@@ -253,16 +251,18 @@ void ShellDesktopController::CreateRootWindow() { ...@@ -253,16 +251,18 @@ void ShellDesktopController::CreateRootWindow() {
} }
void ShellDesktopController::InitWindowManager() { void ShellDesktopController::InitWindowManager() {
focus_client_.reset(new wm::FocusController(new AppsFocusRules())); wm::FocusController* focus_controller =
aura::client::SetFocusClient(host_->window(), focus_client_.get()); new wm::FocusController(new AppsFocusRules());
aura::client::SetFocusClient(host_->window(), focus_controller);
host_->window()->AddPreTargetHandler(focus_controller);
aura::client::SetActivationClient(host_->window(), focus_controller);
focus_client_.reset(focus_controller);
input_method_filter_.reset( input_method_filter_.reset(
new wm::InputMethodEventFilter(host_->GetAcceleratedWidget())); new wm::InputMethodEventFilter(host_->GetAcceleratedWidget()));
input_method_filter_->SetInputMethodPropertyInRootWindow(host_->window()); input_method_filter_->SetInputMethodPropertyInRootWindow(host_->window());
root_window_event_filter_->AddHandler(input_method_filter_.get()); root_window_event_filter_->AddHandler(input_method_filter_.get());
new wm::DefaultActivationClient(host_->window());
capture_client_.reset( capture_client_.reset(
new aura::client::DefaultCaptureClient(host_->window())); new aura::client::DefaultCaptureClient(host_->window()));
...@@ -294,6 +294,12 @@ void ShellDesktopController::DestroyRootWindow() { ...@@ -294,6 +294,12 @@ void ShellDesktopController::DestroyRootWindow() {
host_->event_processor()->GetRootTarget()->RemovePreTargetHandler( host_->event_processor()->GetRootTarget()->RemovePreTargetHandler(
user_activity_detector_.get()); user_activity_detector_.get());
} }
wm::FocusController* focus_controller =
static_cast<wm::FocusController*>(focus_client_.get());
if (focus_controller) {
host_->window()->RemovePreTargetHandler(focus_controller);
aura::client::SetActivationClient(host_->window(), NULL);
}
root_window_event_filter_.reset(); root_window_event_filter_.reset();
capture_client_.reset(); capture_client_.reset();
input_method_filter_.reset(); input_method_filter_.reset();
...@@ -304,7 +310,6 @@ void ShellDesktopController::DestroyRootWindow() { ...@@ -304,7 +310,6 @@ void ShellDesktopController::DestroyRootWindow() {
#endif #endif
user_activity_detector_.reset(); user_activity_detector_.reset();
host_.reset(); host_.reset();
ui::ShutdownInputMethodForTesting();
} }
gfx::Size ShellDesktopController::GetPrimaryDisplaySize() { gfx::Size ShellDesktopController::GetPrimaryDisplaySize() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment