diff --git a/ash/display/display_manager.cc b/ash/display/display_manager.cc index 980a38524f5fa0..e9f0353c309d13 100644 --- a/ash/display/display_manager.cc +++ b/ash/display/display_manager.cc @@ -740,23 +740,18 @@ void DisplayManager::ToggleDisplayScaleFactor() { UpdateDisplays(new_display_info_list); } -void DisplayManager::OnRootWindowResized(const aura::RootWindow* root, - const gfx::Size& old_size) { +void DisplayManager::OnRootWindowHostResized(const aura::RootWindow* root) { if (change_display_upon_host_resize_) { gfx::Display& display = FindDisplayForRootWindow(root); gfx::Size old_display_size_in_pixel = display.GetSizeInPixel(); display_info_[display.id()].SetBounds( gfx::Rect(root->GetHostOrigin(), root->GetHostSize())); - const gfx::Size& new_root_size = root->bounds().size(); // It's tricky to support resizing mirror window on desktop. if (software_mirroring_enabled_ && mirrored_display_.id() == display.id()) return; - if (old_size != new_root_size) { - display.SetSize(display_info_[display.id()].size_in_pixel()); - Shell::GetInstance()->screen()->NotifyBoundsChanged(display); - Shell::GetInstance()->mirror_window_controller()-> - UpdateWindow(); - } + display.SetSize(display_info_[display.id()].size_in_pixel()); + Shell::GetInstance()->screen()->NotifyBoundsChanged(display); + Shell::GetInstance()->mirror_window_controller()->UpdateWindow(); } } diff --git a/ash/display/display_manager.h b/ash/display/display_manager.h index 5591b5c0a0a628..f1e52f96783627 100644 --- a/ash/display/display_manager.h +++ b/ash/display/display_manager.h @@ -178,8 +178,7 @@ class ASH_EXPORT DisplayManager : void ToggleDisplayScaleFactor(); // RootWindowObserver overrides: - virtual void OnRootWindowResized(const aura::RootWindow* root, - const gfx::Size& new_size) OVERRIDE; + virtual void OnRootWindowHostResized(const aura::RootWindow* root) OVERRIDE; // SoftwareMirroringController override: #if defined(OS_CHROMEOS) diff --git a/ash/display/mirror_window_controller.cc b/ash/display/mirror_window_controller.cc index 739bac0aca627d..885691ef7c1c91 100644 --- a/ash/display/mirror_window_controller.cc +++ b/ash/display/mirror_window_controller.cc @@ -224,8 +224,6 @@ void MirrorWindowController::Close() { if (root_window_.get()) { ui::ContextFactory::GetInstance()->RemoveReflector(reflector_); reflector_ = NULL; - root_window_->RemoveRootWindowObserver( - Shell::GetInstance()->display_manager()); NoneCaptureClient* capture_client = static_cast( aura::client::GetCaptureClient(root_window_.get())); delete capture_client; @@ -279,9 +277,8 @@ void MirrorWindowController::SetMirroredCursorVisibility(bool visible) { visible ? cursor_window_->Show() : cursor_window_->Hide(); } -void MirrorWindowController::OnRootWindowResized( - const aura::RootWindow* root, - const gfx::Size& old_size) { +void MirrorWindowController::OnRootWindowHostResized( + const aura::RootWindow* root) { // Do not use |old_size| as it contains RootWindow's (but not host's) size, // and this parameter wil be removed soon. if (mirror_window_host_size_ == root->GetHostSize()) diff --git a/ash/display/mirror_window_controller.h b/ash/display/mirror_window_controller.h index 76a8cfbd7521e2..b9e2e06894c984 100644 --- a/ash/display/mirror_window_controller.h +++ b/ash/display/mirror_window_controller.h @@ -58,8 +58,7 @@ class MirrorWindowController : public aura::RootWindowObserver { void SetMirroredCursorVisibility(bool visible); // aura::RootWindowObserver overrides: - virtual void OnRootWindowResized(const aura::RootWindow* root, - const gfx::Size& old_size) OVERRIDE; + virtual void OnRootWindowHostResized(const aura::RootWindow* root) OVERRIDE; private: friend class test::MirrorWindowTestApi; diff --git a/ash/wm/app_list_controller.cc b/ash/wm/app_list_controller.cc index 02afc69c7bb159..d9bf234e3052bb 100644 --- a/ash/wm/app_list_controller.cc +++ b/ash/wm/app_list_controller.cc @@ -157,7 +157,7 @@ void AppListController::SetView(app_list::AppListView* view) { widget->AddObserver(this); Shell::GetInstance()->AddPreTargetHandler(this); Launcher::ForWindow(widget->GetNativeWindow())->AddIconObserver(this); - widget->GetNativeView()->GetRootWindow()->AddRootWindowObserver(this); + widget->GetNativeView()->GetRootWindow()->AddObserver(this); aura::client::GetFocusClient(widget->GetNativeView())->AddObserver(this); view_->ShowWhenReady(); @@ -172,7 +172,7 @@ void AppListController::ResetView() { GetLayer(widget)->GetAnimator()->RemoveObserver(this); Shell::GetInstance()->RemovePreTargetHandler(this); Launcher::ForWindow(widget->GetNativeWindow())->RemoveIconObserver(this); - widget->GetNativeView()->GetRootWindow()->RemoveRootWindowObserver(this); + widget->GetNativeView()->GetRootWindow()->RemoveObserver(this); aura::client::GetFocusClient(widget->GetNativeView())->RemoveObserver(this); view_ = NULL; } @@ -264,9 +264,10 @@ void AppListController::OnWindowFocused(aura::Window* gained_focus, } //////////////////////////////////////////////////////////////////////////////// -// AppListController, aura::RootWindowObserver implementation: -void AppListController::OnRootWindowResized(const aura::RootWindow* root, - const gfx::Size& old_size) { +// AppListController, aura::WindowObserver implementation: +void AppListController::OnWindowBoundsChanged(aura::Window* root, + const gfx::Rect& old_bounds, + const gfx::Rect& new_bounds) { UpdateBounds(); } diff --git a/ash/wm/app_list_controller.h b/ash/wm/app_list_controller.h index 6f05d6a97dd784..ac163aa9ac8be4 100644 --- a/ash/wm/app_list_controller.h +++ b/ash/wm/app_list_controller.h @@ -12,7 +12,7 @@ #include "base/timer.h" #include "ui/app_list/pagination_model_observer.h" #include "ui/aura/client/focus_change_observer.h" -#include "ui/aura/root_window_observer.h" +#include "ui/aura/window_observer.h" #include "ui/base/events/event_handler.h" #include "ui/compositor/layer_animation_observer.h" #include "ui/gfx/rect.h" @@ -37,7 +37,7 @@ namespace internal { // activation state and desktop mouse click to auto dismiss the UI. class AppListController : public ui::EventHandler, public aura::client::FocusChangeObserver, - public aura::RootWindowObserver, + public aura::WindowObserver, public ui::ImplicitAnimationObserver, public views::WidgetObserver, public ShellObserver, @@ -90,9 +90,10 @@ class AppListController : public ui::EventHandler, virtual void OnWindowFocused(aura::Window* gained_focus, aura::Window* lost_focus) OVERRIDE; - // aura::RootWindowObserver overrides: - virtual void OnRootWindowResized(const aura::RootWindow* root, - const gfx::Size& old_size) OVERRIDE; + // aura::WindowObserver overrides: + virtual void OnWindowBoundsChanged(aura::Window* root, + const gfx::Rect& old_bounds, + const gfx::Rect& new_bounds) OVERRIDE; // ui::ImplicitAnimationObserver overrides: virtual void OnImplicitAnimationsCompleted() OVERRIDE; diff --git a/ash/wm/base_layout_manager.cc b/ash/wm/base_layout_manager.cc index 89e99d9371250e..e8146e6d1081b0 100644 --- a/ash/wm/base_layout_manager.cc +++ b/ash/wm/base_layout_manager.cc @@ -31,15 +31,12 @@ BaseLayoutManager::BaseLayoutManager(aura::RootWindow* root_window) : root_window_(root_window) { Shell::GetInstance()->activation_client()->AddObserver(this); Shell::GetInstance()->AddShellObserver(this); - root_window_->AddRootWindowObserver(this); root_window_->AddObserver(this); } BaseLayoutManager::~BaseLayoutManager() { - if (root_window_) { + if (root_window_) root_window_->RemoveObserver(this); - root_window_->RemoveRootWindowObserver(this); - } for (WindowSet::const_iterator i = windows_.begin(); i != windows_.end(); ++i) (*i)->RemoveObserver(this); Shell::GetInstance()->RemoveShellObserver(this); @@ -105,14 +102,6 @@ void BaseLayoutManager::SetChildBounds(aura::Window* child, SetChildBoundsDirect(child, child_bounds); } -///////////////////////////////////////////////////////////////////////////// -// BaseLayoutManager, RootWindowObserver overrides: - -void BaseLayoutManager::OnRootWindowResized(const aura::RootWindow* root, - const gfx::Size& old_size) { - AdjustWindowSizesForScreenChange(); -} - ///////////////////////////////////////////////////////////////////////////// // BaseLayoutManager, ash::ShellObserver overrides: @@ -150,6 +139,13 @@ void BaseLayoutManager::OnWindowDestroying(aura::Window* window) { } } +void BaseLayoutManager::OnWindowBoundsChanged(aura::Window* window, + const gfx::Rect& old_bounds, + const gfx::Rect& new_bounds) { + if (root_window_ == window) + AdjustWindowSizesForScreenChange(); +} + ////////////////////////////////////////////////////////////////////////////// // BaseLayoutManager, aura::client::ActivationChangeObserver implementation: diff --git a/ash/wm/base_layout_manager.h b/ash/wm/base_layout_manager.h index 7ed9da663a13b0..898bfe90420581 100644 --- a/ash/wm/base_layout_manager.h +++ b/ash/wm/base_layout_manager.h @@ -13,7 +13,6 @@ #include "base/compiler_specific.h" #include "ui/aura/client/activation_change_observer.h" #include "ui/aura/layout_manager.h" -#include "ui/aura/root_window_observer.h" #include "ui/aura/window_observer.h" #include "ui/base/events/event_handler.h" #include "ui/base/ui_base_types.h" @@ -33,7 +32,6 @@ namespace internal { // properly. class ASH_EXPORT BaseLayoutManager : public aura::LayoutManager, - public aura::RootWindowObserver, public ash::ShellObserver, public aura::WindowObserver, public aura::client::ActivationChangeObserver { @@ -61,10 +59,6 @@ class ASH_EXPORT BaseLayoutManager virtual void SetChildBounds(aura::Window* child, const gfx::Rect& requested_bounds) OVERRIDE; - // RootWindowObserver overrides: - virtual void OnRootWindowResized(const aura::RootWindow* root, - const gfx::Size& old_size) OVERRIDE; - // ash::ShellObserver overrides: virtual void OnDisplayWorkAreaInsetsChanged() OVERRIDE; @@ -73,6 +67,9 @@ class ASH_EXPORT BaseLayoutManager const void* key, intptr_t old) OVERRIDE; virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; + virtual void OnWindowBoundsChanged(aura::Window* window, + const gfx::Rect& old_bounds, + const gfx::Rect& new_bounds) OVERRIDE; // aura::client::ActivationChangeObserver overrides: virtual void OnWindowActivated(aura::Window* gained_active, diff --git a/ash/wm/screen_dimmer.cc b/ash/wm/screen_dimmer.cc index 3cb4e96c20f983..814620a2cf5792 100644 --- a/ash/wm/screen_dimmer.cc +++ b/ash/wm/screen_dimmer.cc @@ -28,11 +28,11 @@ const int kDimmingTransitionMs = 200; ScreenDimmer::ScreenDimmer(aura::RootWindow* root_window) : root_window_(root_window), currently_dimming_(false) { - root_window_->AddRootWindowObserver(this); + root_window_->AddObserver(this); } ScreenDimmer::~ScreenDimmer() { - root_window_->RemoveRootWindowObserver(this); + root_window_->RemoveObserver(this); } void ScreenDimmer::SetDimming(bool should_dim) { @@ -58,8 +58,9 @@ void ScreenDimmer::SetDimming(bool should_dim) { dimming_layer_->SetOpacity(should_dim ? kDimmingLayerOpacity : 0.0f); } -void ScreenDimmer::OnRootWindowResized(const aura::RootWindow* root, - const gfx::Size& old_size) { +void ScreenDimmer::OnWindowBoundsChanged(aura::Window* root, + const gfx::Rect& old_bounds, + const gfx::Rect& new_bounds) { if (dimming_layer_) dimming_layer_->SetBounds(gfx::Rect(root->bounds().size())); } diff --git a/ash/wm/screen_dimmer.h b/ash/wm/screen_dimmer.h index 9d581fa473f34b..476c27449a30e0 100644 --- a/ash/wm/screen_dimmer.h +++ b/ash/wm/screen_dimmer.h @@ -9,7 +9,7 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/memory/scoped_ptr.h" -#include "ui/aura/root_window_observer.h" +#include "ui/aura/window_observer.h" namespace aura { class RootWindow; @@ -29,7 +29,7 @@ namespace internal { // briefly dim the screen (e.g. to indicate to the user that we're // about to suspend a machine that lacks an internal backlight that // can be adjusted). -class ASH_EXPORT ScreenDimmer : public aura::RootWindowObserver { +class ASH_EXPORT ScreenDimmer : public aura::WindowObserver { public: class TestApi { public: @@ -49,9 +49,10 @@ class ASH_EXPORT ScreenDimmer : public aura::RootWindowObserver { // Dim or undim the root window. void SetDimming(bool should_dim); - // aura::RootWindowObserver overrides: - virtual void OnRootWindowResized(const aura::RootWindow* root, - const gfx::Size& old_size) OVERRIDE; + // aura::WindowObserver overrides: + virtual void OnWindowBoundsChanged(aura::Window* root_window, + const gfx::Rect& old_bounds, + const gfx::Rect& new_bounds) OVERRIDE; private: friend class TestApi; diff --git a/ash/wm/system_background_controller.cc b/ash/wm/system_background_controller.cc index 8f06f02e7c1e89..588073546decd9 100644 --- a/ash/wm/system_background_controller.cc +++ b/ash/wm/system_background_controller.cc @@ -25,7 +25,7 @@ SystemBackgroundController::SystemBackgroundController( SkColor color) : root_window_(root_window), layer_(new ui::Layer(ui::LAYER_SOLID_COLOR)) { - root_window_->AddRootWindowObserver(this); + root_window_->AddObserver(this); layer_->SetColor(color); ui::Layer* root_layer = root_window_->layer(); @@ -35,16 +35,17 @@ SystemBackgroundController::SystemBackgroundController( } SystemBackgroundController::~SystemBackgroundController() { - root_window_->RemoveRootWindowObserver(this); + root_window_->RemoveObserver(this); } void SystemBackgroundController::SetColor(SkColor color) { layer_->SetColor(color); } -void SystemBackgroundController::OnRootWindowResized( - const aura::RootWindow* root, - const gfx::Size& old_size) { +void SystemBackgroundController::OnWindowBoundsChanged( + aura::Window* root, + const gfx::Rect& old_bounds, + const gfx::Rect& new_bounds) { DCHECK_EQ(root_window_, root); layer_->SetBounds(gfx::Rect(root_window_->layer()->bounds().size())); } diff --git a/ash/wm/system_background_controller.h b/ash/wm/system_background_controller.h index 6da656345bd5be..36382646b3c1fb 100644 --- a/ash/wm/system_background_controller.h +++ b/ash/wm/system_background_controller.h @@ -11,7 +11,7 @@ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "third_party/skia/include/core/SkColor.h" -#include "ui/aura/root_window_observer.h" +#include "ui/aura/window_observer.h" namespace aura { class RootWindow; @@ -30,16 +30,17 @@ namespace internal { // desktop background image is loaded at startup, or when we scale down all of // the other layers as part of a power-button or window-management animation). // It should never be transformed or restacked. -class SystemBackgroundController : public aura::RootWindowObserver { +class SystemBackgroundController : public aura::WindowObserver { public: SystemBackgroundController(aura::RootWindow* root_window, SkColor color); virtual ~SystemBackgroundController(); void SetColor(SkColor color); - // aura::RootWindowObserver overrides: - virtual void OnRootWindowResized(const aura::RootWindow* root, - const gfx::Size& old_size) OVERRIDE; + // aura::WindowObserver overrides: + virtual void OnWindowBoundsChanged(aura::Window* root, + const gfx::Rect& old_bounds, + const gfx::Rect& new_bounds) OVERRIDE; private: class HostContentLayerDelegate; diff --git a/ash/wm/workspace/workspace_layout_manager.cc b/ash/wm/workspace/workspace_layout_manager.cc index ed0a913f49c611..cf8f4930db7dd3 100644 --- a/ash/wm/workspace/workspace_layout_manager.cc +++ b/ash/wm/workspace/workspace_layout_manager.cc @@ -87,15 +87,12 @@ WorkspaceLayoutManager::WorkspaceLayoutManager(Workspace* workspace) work_area_(ScreenAsh::GetDisplayWorkAreaBoundsInParent( workspace->window()->parent())) { Shell::GetInstance()->AddShellObserver(this); - root_window_->AddRootWindowObserver(this); root_window_->AddObserver(this); } WorkspaceLayoutManager::~WorkspaceLayoutManager() { - if (root_window_) { + if (root_window_) root_window_->RemoveObserver(this); - root_window_->RemoveRootWindowObserver(this); - } for (WindowSet::const_iterator i = windows_.begin(); i != windows_.end(); ++i) (*i)->RemoveObserver(this); Shell::GetInstance()->RemoveShellObserver(this); @@ -158,11 +155,6 @@ void WorkspaceLayoutManager::SetChildBounds( workspace_manager()->OnWorkspaceWindowChildBoundsChanged(workspace_, child); } -void WorkspaceLayoutManager::OnRootWindowResized(const aura::RootWindow* root, - const gfx::Size& old_size) { - AdjustWindowSizesForScreenChange(ADJUST_WINDOW_SCREEN_SIZE_CHANGED); -} - void WorkspaceLayoutManager::OnDisplayWorkAreaInsetsChanged() { if (workspace_manager()->active_workspace_ == workspace_) { const gfx::Rect work_area(ScreenAsh::GetDisplayWorkAreaBoundsInParent( @@ -261,6 +253,14 @@ void WorkspaceLayoutManager::OnWindowDestroying(aura::Window* window) { } } +void WorkspaceLayoutManager::OnWindowBoundsChanged( + aura::Window* window, + const gfx::Rect& old_bounds, + const gfx::Rect& new_bounds) { + if (root_window_ == window) + AdjustWindowSizesForScreenChange(ADJUST_WINDOW_SCREEN_SIZE_CHANGED); +} + void WorkspaceLayoutManager::ShowStateChanged( Window* window, ui::WindowShowState last_show_state, diff --git a/ash/wm/workspace/workspace_layout_manager.h b/ash/wm/workspace/workspace_layout_manager.h index 50942682f7dbc7..65246d2dc9ccde 100644 --- a/ash/wm/workspace/workspace_layout_manager.h +++ b/ash/wm/workspace/workspace_layout_manager.h @@ -12,7 +12,6 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" #include "ui/aura/layout_manager.h" -#include "ui/aura/root_window_observer.h" #include "ui/base/ui_base_types.h" #include "ui/aura/window_observer.h" #include "ui/gfx/rect.h" @@ -39,7 +38,6 @@ class WorkspaceManager; // See if I can refactor the code to make it easier to share common bits. class ASH_EXPORT WorkspaceLayoutManager : public aura::LayoutManager, - public aura::RootWindowObserver, public ash::ShellObserver, public aura::WindowObserver { public: @@ -57,10 +55,6 @@ class ASH_EXPORT WorkspaceLayoutManager virtual void SetChildBounds(aura::Window* child, const gfx::Rect& requested_bounds) OVERRIDE; - // RootWindowObserver overrides: - virtual void OnRootWindowResized(const aura::RootWindow* root, - const gfx::Size& old_size) OVERRIDE; - // ash::ShellObserver overrides: virtual void OnDisplayWorkAreaInsetsChanged() OVERRIDE; @@ -69,6 +63,9 @@ class ASH_EXPORT WorkspaceLayoutManager const void* key, intptr_t old) OVERRIDE; virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; + virtual void OnWindowBoundsChanged(aura::Window* window, + const gfx::Rect& old_bounds, + const gfx::Rect& new_bounds) OVERRIDE; private: typedef std::set WindowSet; 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 fedd08631eaf4f..60788058732115 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc @@ -2670,8 +2670,9 @@ void RenderWidgetHostViewAura::OnWindowFocused(aura::Window* gained_focus, //////////////////////////////////////////////////////////////////////////////// // RenderWidgetHostViewAura, aura::RootWindowObserver implementation: -void RenderWidgetHostViewAura::OnRootWindowMoved(const aura::RootWindow* root, - const gfx::Point& new_origin) { +void RenderWidgetHostViewAura::OnRootWindowHostMoved( + const aura::RootWindow* root, + const gfx::Point& new_origin) { UpdateScreenInfo(window_); } diff --git a/content/browser/renderer_host/render_widget_host_view_aura.h b/content/browser/renderer_host/render_widget_host_view_aura.h index d87eeb29ab890a..7128e9855988fa 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.h +++ b/content/browser/renderer_host/render_widget_host_view_aura.h @@ -320,8 +320,8 @@ class RenderWidgetHostViewAura aura::Window* lost_focus) OVERRIDE; // Overridden from aura::RootWindowObserver: - virtual void OnRootWindowMoved(const aura::RootWindow* root, - const gfx::Point& new_origin) OVERRIDE; + virtual void OnRootWindowHostMoved(const aura::RootWindow* root, + const gfx::Point& new_origin) OVERRIDE; #if defined(OS_WIN) // Sets the cutout rects from constrained windows. These are rectangles that diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc index f9273355042d38..dedc81c1accbfe 100644 --- a/content/browser/web_contents/web_contents_view_aura.cc +++ b/content/browser/web_contents/web_contents_view_aura.cc @@ -497,8 +497,8 @@ class WebContentsViewAura::WindowObserver } // Overridden RootWindowObserver: - virtual void OnRootWindowMoved(const aura::RootWindow* root, - const gfx::Point& new_origin) OVERRIDE { + virtual void OnRootWindowHostMoved(const aura::RootWindow* root, + const gfx::Point& new_origin) OVERRIDE { // This is for the desktop case (i.e. Aura desktop). SendScreenRects(); } diff --git a/ui/aura/root_window.cc b/ui/aura/root_window.cc index e4a0feea324ee6..d812f5294f8c8e 100644 --- a/ui/aura/root_window.cc +++ b/ui/aura/root_window.cc @@ -197,7 +197,7 @@ void RootWindow::Init() { Window::Init(ui::LAYER_NOT_DRAWN); compositor()->SetRootLayer(layer()); transformer_.reset(new SimpleRootWindowTransformer(this, gfx::Transform())); - UpdateWindowSize(host_->GetBounds().size()); + UpdateRootWindowSize(GetHostSize()); Env::GetInstance()->NotifyRootWindowInitialized(this); Show(); } @@ -539,10 +539,10 @@ void RootWindow::SetRootWindowTransformer( transformer_ = transformer.Pass(); host_->SetInsets(transformer_->GetHostInsets()); Window::SetTransform(transformer_->GetTransform()); - // If the layer is not animating, then we need to update the host size - // immediately. + // If the layer is not animating, then we need to update the root window + // size immediately. if (!layer()->GetAnimator()->is_animating()) - OnHostResized(host_->GetBounds().size()); + UpdateRootWindowSize(GetHostSize()); } gfx::Transform RootWindow::GetRootTransform() const { @@ -845,7 +845,7 @@ void RootWindow::CleanupGestureRecognizerState(Window* window) { } } -void RootWindow::UpdateWindowSize(const gfx::Size& host_size) { +void RootWindow::UpdateRootWindowSize(const gfx::Size& host_size) { SetBounds(transformer_->GetRootWindowBounds(host_size)); } @@ -869,7 +869,7 @@ bool RootWindow::DispatchCancelTouchEvent(ui::TouchEvent* event) { void RootWindow::OnLayerAnimationEnded( ui::LayerAnimationSequence* animation) { - OnHostResized(host_->GetBounds().size()); + UpdateRootWindowSize(GetHostSize()); } void RootWindow::OnLayerAnimationScheduled( @@ -987,7 +987,7 @@ void RootWindow::OnHostPaint(const gfx::Rect& damage_rect) { void RootWindow::OnHostMoved(const gfx::Point& origin) { FOR_EACH_OBSERVER(RootWindowObserver, observers_, - OnRootWindowMoved(this, origin)); + OnRootWindowHostMoved(this, origin)); } void RootWindow::OnHostResized(const gfx::Size& size) { @@ -996,13 +996,11 @@ void RootWindow::OnHostResized(const gfx::Size& size) { // Get the latest scale from display because it might have been changed. compositor_->SetScaleAndSize(GetDeviceScaleFactorFromDisplay(this), size); - // The layer, and all the observers should be notified of the + // The layer, and the observers should be notified of the // transformed size of the root window. - gfx::Size old(bounds().size()); - UpdateWindowSize(size); - // TODO(oshima): Rename this to OnHostWindowResized. + UpdateRootWindowSize(size); FOR_EACH_OBSERVER(RootWindowObserver, observers_, - OnRootWindowResized(this, old)); + OnRootWindowHostResized(this)); } float RootWindow::GetDeviceScaleFactor() { diff --git a/ui/aura/root_window.h b/ui/aura/root_window.h index dc1918e26b28a0..0d5a0a24a4746e 100644 --- a/ui/aura/root_window.h +++ b/ui/aura/root_window.h @@ -353,7 +353,7 @@ class AURA_EXPORT RootWindow : public ui::CompositorDelegate, // Updates the root window's size using |host_size|, current // transform and insets. - void UpdateWindowSize(const gfx::Size& host_size); + void UpdateRootWindowSize(const gfx::Size& host_size); // Overridden from ui::EventDispatcherDelegate. virtual bool CanDispatchToTarget(EventTarget* target) OVERRIDE; diff --git a/ui/aura/root_window_observer.h b/ui/aura/root_window_observer.h index 81dcad95f55ff4..bfb8e65c518a6a 100644 --- a/ui/aura/root_window_observer.h +++ b/ui/aura/root_window_observer.h @@ -18,13 +18,12 @@ class Window; class AURA_EXPORT RootWindowObserver { public: - // Invoked after the RootWindow is resized. - virtual void OnRootWindowResized(const RootWindow* root, - const gfx::Size& old_size) {} + // Invoked after the RootWindow's host has been resized. + virtual void OnRootWindowHostResized(const RootWindow* root) {} - // Invoked after the RootWindow has been moved on screen. - virtual void OnRootWindowMoved(const RootWindow* root, - const gfx::Point& new_origin) {} + // Invoked after the RootWindow's host has been moved on screen. + virtual void OnRootWindowHostMoved(const RootWindow* root, + const gfx::Point& new_origin) {} // Invoked when the native windowing system sends us a request to close our // window.