diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-28 03:28:46 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-28 03:28:46 +0000 |
commit | 8cfb672c1560ea3354b0a51fa2efca3de8249beb (patch) | |
tree | 9e4e4dba8001b6b37a6b2b15070544c26f5008be /content | |
parent | 9bf222b0ada03412fbbb61a5dcf2f6205bb1f0d8 (diff) | |
download | chromium_src-8cfb672c1560ea3354b0a51fa2efca3de8249beb.zip chromium_src-8cfb672c1560ea3354b0a51fa2efca3de8249beb.tar.gz chromium_src-8cfb672c1560ea3354b0a51fa2efca3de8249beb.tar.bz2 |
Rework FocusManager as FocusClient.
This allows us to have multiple focus system implementations.
http://crbug.com/162100
R=sky@chromium.org
Review URL: https://codereview.chromium.org/11299219
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@169824 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/renderer_host/render_widget_host_view_aura.cc | 11 | ||||
-rw-r--r-- | content/shell/shell_stacking_client_ash.cc | 5 | ||||
-rw-r--r-- | content/shell/shell_stacking_client_ash.h | 2 |
3 files changed, 11 insertions, 7 deletions
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc index 66fd5f3..1a902a4 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc @@ -31,6 +31,7 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/client/cursor_client.h" +#include "ui/aura/client/focus_client.h" #include "ui/aura/client/screen_position_client.h" #include "ui/aura/client/stacking_client.h" #include "ui/aura/client/tooltip_client.h" @@ -505,10 +506,11 @@ void RenderWidgetHostViewAura::MovePluginWindows( } void RenderWidgetHostViewAura::Focus() { - // Make sure we have a FocusManager before attempting to Focus(). In some + // Make sure we have a FocusClient before attempting to Focus(). In some // situations we may not yet be in a valid Window hierarchy (such as reloading - // after out of memory discared the tab). - if (window_->GetFocusManager()) + // after out of memory discarded the tab). + aura::client::FocusClient* client = aura::client::GetFocusClient(window_); + if (client) window_->Focus(); } @@ -1505,7 +1507,8 @@ ui::EventResult RenderWidgetHostViewAura::OnKeyEvent(ui::KeyEvent* event) { // Focus the window we were created from. if (host_tracker_.get() && !host_tracker_->windows().empty()) { aura::Window* host = *(host_tracker_->windows().begin()); - if (host->GetFocusManager()) + aura::client::FocusClient* client = aura::client::GetFocusClient(host); + if (client) host->Focus(); } if (!in_shutdown_) { diff --git a/content/shell/shell_stacking_client_ash.cc b/content/shell/shell_stacking_client_ash.cc index 0a6e9c7..a0b4f8d 100644 --- a/content/shell/shell_stacking_client_ash.cc +++ b/content/shell/shell_stacking_client_ash.cc @@ -28,12 +28,11 @@ aura::Window* ShellStackingClientAsh::GetDefaultParent( aura::Window* window, const gfx::Rect& bounds) { if (!root_window_.get()) { - aura::FocusManager* focus_manager = new aura::FocusManager; - root_window_.reset(new aura::RootWindow( aura::RootWindow::CreateParams(gfx::Rect(100, 100)))); root_window_->Init(); - root_window_->set_focus_manager(focus_manager); + focus_client_.reset(new aura::FocusManager); + aura::client::SetFocusClient(root_window_.get(), focus_client_.get()); root_window_event_filter_ = new views::corewm::CompoundEventFilter; // Pass ownership of the filter to the root_window. diff --git a/content/shell/shell_stacking_client_ash.h b/content/shell/shell_stacking_client_ash.h index 73e420d..de169c4 100644 --- a/content/shell/shell_stacking_client_ash.h +++ b/content/shell/shell_stacking_client_ash.h @@ -14,6 +14,7 @@ class RootWindow; class Window; namespace client { class DefaultCaptureClient; +class FocusClient; } namespace test { class TestActivationClient; @@ -55,6 +56,7 @@ class ShellStackingClientAsh : public aura::client::StackingClient { scoped_ptr<aura::client::DefaultCaptureClient> capture_client_; scoped_ptr<views::corewm::InputMethodEventFilter> input_method_filter_; scoped_ptr<aura::test::TestActivationClient> test_activation_client_; + scoped_ptr<aura::client::FocusClient> focus_client_; DISALLOW_COPY_AND_ASSIGN(ShellStackingClientAsh); }; |