diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-25 22:28:27 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-25 22:28:27 +0000 |
commit | 0239e8694892e4ad603f77f758bbff30b3aff216 (patch) | |
tree | 40001fcf114ca31d4cdd7905f7c12a6b9a80e4a5 /ui/views | |
parent | 2199f8d7f135ecb0b880ad64c65df889847e7373 (diff) | |
download | chromium_src-0239e8694892e4ad603f77f758bbff30b3aff216.zip chromium_src-0239e8694892e4ad603f77f758bbff30b3aff216.tar.gz chromium_src-0239e8694892e4ad603f77f758bbff30b3aff216.tar.bz2 |
Remove a bunch more uses of RootWindow::GetInstance()
http://crbug.com/112131
TEST=none
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=123592
Review URL: https://chromiumcodereview.appspot.com/9460025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@123673 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views')
-rw-r--r-- | ui/views/controls/menu/menu_controller.cc | 6 | ||||
-rw-r--r-- | ui/views/widget/native_widget_aura.cc | 22 | ||||
-rw-r--r-- | ui/views/widget/tooltip_manager_aura.cc | 14 |
3 files changed, 27 insertions, 15 deletions
diff --git a/ui/views/controls/menu/menu_controller.cc b/ui/views/controls/menu/menu_controller.cc index d3b8e3f..1cce7fa 100644 --- a/ui/views/controls/menu/menu_controller.cc +++ b/ui/views/controls/menu/menu_controller.cc @@ -2017,8 +2017,10 @@ void MenuController::SetExitType(ExitType type) { // is necessary to exit from nested loop (See Dispatch methods). // Send non-op event so that Dispatch method will always be called. // crbug.com/104684. - if (exit_type_ == EXIT_ALL || exit_type_ == EXIT_DESTROYED) - aura::RootWindow::GetInstance()->PostNativeEvent(ui::CreateNoopEvent()); + if (exit_type_ == EXIT_ALL || exit_type_ == EXIT_DESTROYED) { + owner_->GetNativeView()->GetRootWindow()->PostNativeEvent( + ui::CreateNoopEvent()); + } #endif } diff --git a/ui/views/widget/native_widget_aura.cc b/ui/views/widget/native_widget_aura.cc index 291ace0..f2fbd72 100644 --- a/ui/views/widget/native_widget_aura.cc +++ b/ui/views/widget/native_widget_aura.cc @@ -106,18 +106,19 @@ void SetRestoreBounds(aura::Window* window, const gfx::Rect& bounds) { class NativeWidgetAura::ActiveWindowObserver : public aura::WindowObserver { public: explicit ActiveWindowObserver(NativeWidgetAura* host) : host_(host) { - aura::RootWindow::GetInstance()->AddObserver(this); - } - virtual ~ActiveWindowObserver() { - aura::RootWindow::GetInstance()->RemoveObserver(this); + host_->GetNativeView()->GetRootWindow()->AddObserver(this); + host_->GetNativeView()->AddObserver(this); } + virtual ~ActiveWindowObserver() {} // Overridden from aura::WindowObserver: virtual void OnWindowPropertyChanged(aura::Window* window, const void* key, intptr_t old) OVERRIDE { - if (key != aura::client::kRootWindowActiveWindowKey) + if (window != host_->GetNativeView() || + key != aura::client::kRootWindowActiveWindowKey) { return; + } aura::Window* active = aura::client::GetActivationClient()->GetActiveWindow(); if (!active || (active != host_->window_ && @@ -126,6 +127,13 @@ class NativeWidgetAura::ActiveWindowObserver : public aura::WindowObserver { } } + virtual void OnWindowRemovingFromRootWindow(aura::Window* window) OVERRIDE { + if (window != host_->GetNativeView()) + return; + host_->GetNativeView()->GetRootWindow()->RemoveObserver(this); + host_->GetNativeView()->RemoveObserver(this); + } + private: NativeWidgetAura* host_; @@ -320,7 +328,7 @@ bool NativeWidgetAura::HasMouseCapture() const { } InputMethod* NativeWidgetAura::CreateInputMethod() { - aura::RootWindow* root_window = aura::RootWindow::GetInstance(); + aura::RootWindow* root_window = window_->GetRootWindow(); ui::InputMethod* host = root_window->GetProperty(aura::client::kRootWindowInputMethodKey); InputMethod* input_method = new InputMethodBridge(this, host); @@ -593,7 +601,7 @@ void NativeWidgetAura::SchedulePaintInRect(const gfx::Rect& rect) { void NativeWidgetAura::SetCursor(gfx::NativeCursor cursor) { cursor_ = cursor; - aura::RootWindow::GetInstance()->SetCursor(cursor); + window_->GetRootWindow()->SetCursor(cursor); } void NativeWidgetAura::ClearNativeFocus() { diff --git a/ui/views/widget/tooltip_manager_aura.cc b/ui/views/widget/tooltip_manager_aura.cc index efddcfe..3bed930 100644 --- a/ui/views/widget/tooltip_manager_aura.cc +++ b/ui/views/widget/tooltip_manager_aura.cc @@ -52,9 +52,10 @@ TooltipManagerAura::~TooltipManagerAura() { void TooltipManagerAura::UpdateTooltip() { if (aura::client::GetTooltipClient()) { - gfx::Point view_point = - aura::RootWindow::GetInstance()->last_mouse_location(); - aura::Window::ConvertPointToWindow(aura::RootWindow::GetInstance(), + aura::RootWindow* root_window = + native_widget_aura_->GetNativeView()->GetRootWindow(); + gfx::Point view_point = root_window->last_mouse_location(); + aura::Window::ConvertPointToWindow(root_window, native_widget_aura_->GetNativeView(), &view_point); View* view = GetViewUnderPoint(view_point); if (view) { @@ -71,9 +72,10 @@ void TooltipManagerAura::UpdateTooltip() { void TooltipManagerAura::TooltipTextChanged(View* view) { if (aura::client::GetTooltipClient()) { - gfx::Point view_point = - aura::RootWindow::GetInstance()->last_mouse_location(); - aura::Window::ConvertPointToWindow(aura::RootWindow::GetInstance(), + aura::RootWindow* root_window = + native_widget_aura_->GetNativeView()->GetRootWindow(); + gfx::Point view_point = root_window->last_mouse_location(); + aura::Window::ConvertPointToWindow(root_window, native_widget_aura_->GetNativeView(), &view_point); View* target = GetViewUnderPoint(view_point); if (target != view) |