diff options
author | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-10 00:18:48 +0000 |
---|---|---|
committer | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-10 00:18:48 +0000 |
commit | 277a3bb5fd9196b3109d0e6ca2ba6a4ec43582b4 (patch) | |
tree | 94b10b9669fc76bc969be9709d3e2f4cb6b0dc80 /ash | |
parent | 011352fdfe5524e72ea9aff9cc21b553ff4dc351 (diff) | |
download | chromium_src-277a3bb5fd9196b3109d0e6ca2ba6a4ec43582b4.zip chromium_src-277a3bb5fd9196b3109d0e6ca2ba6a4ec43582b4.tar.gz chromium_src-277a3bb5fd9196b3109d0e6ca2ba6a4ec43582b4.tar.bz2 |
Aura/Ash split: Move ScreenAura to aura::RootWindowScreen.
What is now aura::RootWindowScreen was tightly bundled with aura::RootWindow. Instead of moving it to ash::ScreenAsh, I renamed it aurea::RootWindowScreen because there's a bunch of unit tests that use RootWindow as if it were the desktop. Screen integration stuff has been moved out of RootWindow (and related observers) and into ash::Shell.
BUG=116458
Review URL: http://codereview.chromium.org/9616045
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@125950 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r-- | ash/ash.gyp | 2 | ||||
-rw-r--r-- | ash/screen_ash.cc | 67 | ||||
-rw-r--r-- | ash/screen_ash.h | 62 | ||||
-rw-r--r-- | ash/shell.cc | 19 | ||||
-rw-r--r-- | ash/shell.h | 16 | ||||
-rw-r--r-- | ash/shell_observer.h | 24 | ||||
-rw-r--r-- | ash/wm/base_layout_manager.cc | 5 | ||||
-rw-r--r-- | ash/wm/base_layout_manager.h | 4 | ||||
-rw-r--r-- | ash/wm/base_layout_manager_unittest.cc | 4 | ||||
-rw-r--r-- | ash/wm/shelf_layout_manager.cc | 8 | ||||
-rw-r--r-- | ash/wm/shelf_layout_manager_unittest.cc | 6 | ||||
-rw-r--r-- | ash/wm/toplevel_layout_manager_unittest.cc | 10 | ||||
-rw-r--r-- | ash/wm/workspace/workspace_event_filter.cc | 2 | ||||
-rw-r--r-- | ash/wm/workspace/workspace_layout_manager.cc | 2 | ||||
-rw-r--r-- | ash/wm/workspace/workspace_manager.cc | 4 | ||||
-rw-r--r-- | ash/wm/workspace/workspace_manager_unittest.cc | 6 | ||||
-rw-r--r-- | ash/wm/workspace/workspace_window_resizer_unittest.cc | 8 |
17 files changed, 223 insertions, 26 deletions
diff --git a/ash/ash.gyp b/ash/ash.gyp index 9546f9f..5d53c18 100644 --- a/ash/ash.gyp +++ b/ash/ash.gyp @@ -98,6 +98,8 @@ 'launcher/view_model.h', 'launcher/view_model_utils.cc', 'launcher/view_model_utils.h', + 'screen_ash.cc', + 'screen_ash.h', 'screenshot_delegate.h', 'shell.cc', 'shell.h', diff --git a/ash/screen_ash.cc b/ash/screen_ash.cc new file mode 100644 index 0000000..bbdf9e8 --- /dev/null +++ b/ash/screen_ash.cc @@ -0,0 +1,67 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ash/screen_ash.h" + +#include "base/logging.h" +#include "ui/aura/root_window.h" +#include "ui/aura/window.h" +#include "ui/gfx/native_widget_types.h" + +namespace ash { + +ScreenAsh::ScreenAsh(aura::RootWindow* root_window) + : root_window_(root_window) { +} + +ScreenAsh::~ScreenAsh() { +} + +gfx::Point ScreenAsh::GetCursorScreenPointImpl() { + return root_window_->last_mouse_location(); +} + +gfx::Rect ScreenAsh::GetMonitorWorkAreaNearestWindowImpl( + gfx::NativeWindow window) { + return GetWorkAreaBounds(); +} + +gfx::Rect ScreenAsh::GetMonitorAreaNearestWindowImpl( + gfx::NativeWindow window) { + return GetBounds(); +} + +gfx::Rect ScreenAsh::GetMonitorWorkAreaNearestPointImpl( + const gfx::Point& point) { + return GetWorkAreaBounds(); +} + +gfx::Rect ScreenAsh::GetMonitorAreaNearestPointImpl(const gfx::Point& point) { + return GetBounds(); +} + +gfx::NativeWindow ScreenAsh::GetWindowAtCursorScreenPointImpl() { + const gfx::Point point = GetCursorScreenPoint(); + return root_window_->GetTopWindowContainingPoint(point); +} + +gfx::Rect ScreenAsh::GetBounds() { + return gfx::Rect(root_window_->bounds().size()); +} + +gfx::Rect ScreenAsh::GetWorkAreaBounds() { + gfx::Rect bounds(GetBounds()); + bounds.Inset(work_area_insets_); + return bounds; +} + +gfx::Size ScreenAsh::GetPrimaryMonitorSizeImpl() { + return GetMonitorWorkAreaNearestPoint(gfx::Point()).size(); +} + +int ScreenAsh::GetNumMonitorsImpl() { + return 1; +} + +} // namespace ash diff --git a/ash/screen_ash.h b/ash/screen_ash.h new file mode 100644 index 0000000..deaa76f --- /dev/null +++ b/ash/screen_ash.h @@ -0,0 +1,62 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ASH_SCREEN_ASH_H_ +#define ASH_SCREEN_ASH_H_ +#pragma once + +#include "base/compiler_specific.h" +#include "ash/ash_export.h" +#include "ui/gfx/insets.h" +#include "ui/gfx/screen.h" + +namespace aura { +class RootWindow; +} + +namespace ash { + +// Aura implementation of gfx::Screen. Implemented here to avoid circular +// dependencies. +class ASH_EXPORT ScreenAsh : public gfx::Screen { + public: + explicit ScreenAsh(aura::RootWindow* root_window); + virtual ~ScreenAsh(); + + void set_work_area_insets(const gfx::Insets& insets) { + work_area_insets_ = insets; + } + const gfx::Insets& work_area_insets() const { return work_area_insets_; } + + protected: + virtual gfx::Point GetCursorScreenPointImpl() OVERRIDE; + virtual gfx::Rect GetMonitorWorkAreaNearestWindowImpl( + gfx::NativeView view) OVERRIDE; + virtual gfx::Rect GetMonitorAreaNearestWindowImpl( + gfx::NativeView view) OVERRIDE; + virtual gfx::Rect GetMonitorWorkAreaNearestPointImpl( + const gfx::Point& point) OVERRIDE; + virtual gfx::Rect GetMonitorAreaNearestPointImpl( + const gfx::Point& point) OVERRIDE; + virtual gfx::NativeWindow GetWindowAtCursorScreenPointImpl() OVERRIDE; + virtual gfx::Size GetPrimaryMonitorSizeImpl() OVERRIDE; + virtual int GetNumMonitorsImpl() OVERRIDE; + + private: + // We currently support only one monitor. These two methods return the bounds + // and work area. + gfx::Rect GetBounds(); + gfx::Rect GetWorkAreaBounds(); + + // Insets for the work area. + gfx::Insets work_area_insets_; + + aura::RootWindow* root_window_; + + DISALLOW_COPY_AND_ASSIGN(ScreenAsh); +}; + +} // namespace ash + +#endif // ASH_SCREEN_ASH_H_ diff --git a/ash/shell.cc b/ash/shell.cc index ae5ffab6..ad8f835 100644 --- a/ash/shell.cc +++ b/ash/shell.cc @@ -12,6 +12,7 @@ #include "ash/focus_cycler.h" #include "ash/ime/input_method_event_filter.h" #include "ash/launcher/launcher.h" +#include "ash/screen_ash.h" #include "ash/shell_delegate.h" #include "ash/shell_factory.h" #include "ash/shell_window_ids.h" @@ -306,6 +307,7 @@ internal::WorkspaceController* Shell::TestApi::workspace_controller() { Shell::Shell(ShellDelegate* delegate) : root_window_(new aura::RootWindow), + screen_(new ScreenAsh(root_window_.get())), root_filter_(NULL), delegate_(delegate), audio_controller_(NULL), @@ -316,6 +318,7 @@ Shell::Shell(ShellDelegate* delegate) desktop_background_mode_(BACKGROUND_IMAGE), root_window_layout_(NULL), status_widget_(NULL) { + gfx::Screen::SetInstance(screen_); } Shell::~Shell() { @@ -597,6 +600,22 @@ void Shell::RotateFocus(Direction direction) { internal::FocusCycler::BACKWARD); } +void Shell::SetScreenWorkAreaInsets(const gfx::Insets& insets) { + if (screen_->work_area_insets() == insets) + return; + screen_->set_work_area_insets(insets); + FOR_EACH_OBSERVER(ShellObserver, observers_, + OnScreenWorkAreaInsetsChanged()); +} + +void Shell::AddShellObserver(ShellObserver* observer) { + observers_.AddObserver(observer); +} + +void Shell::RemoveShellObserver(ShellObserver* observer) { + observers_.RemoveObserver(observer); +} + //////////////////////////////////////////////////////////////////////////////// // Shell, private: diff --git a/ash/shell.h b/ash/shell.h index 92910ce..e6af0db 100644 --- a/ash/shell.h +++ b/ash/shell.h @@ -14,7 +14,9 @@ #include "base/compiler_specific.h" #include "base/gtest_prod_util.h" #include "base/memory/scoped_ptr.h" +#include "base/observer_list.h" #include "ui/gfx/size.h" +#include "ui/gfx/insets.h" class CommandLine; @@ -45,7 +47,9 @@ class NestedDispatcherController; class NetworkController; class PowerButtonController; class PowerStatusController; +class ScreenAsh; class ShellDelegate; +class ShellObserver; class SystemTrayDelegate; class SystemTray; class VideoDetector; @@ -152,6 +156,13 @@ class ASH_EXPORT Shell { // Rotate focus through containers that can receive focus. void RotateFocus(Direction direction); + // Sets the screen's work area insets, this notifies observers too. + void SetScreenWorkAreaInsets(const gfx::Insets& insets); + + // Add/remove observer. + void AddShellObserver(ShellObserver* observer); + void RemoveShellObserver(ShellObserver* observer); + #if !defined(OS_MACOSX) AcceleratorController* accelerator_controller() { return accelerator_controller_.get(); @@ -197,6 +208,8 @@ class ASH_EXPORT Shell { Launcher* launcher() { return launcher_.get(); } + const ScreenAsh* screen() { return screen_; } + internal::ShelfLayoutManager* shelf() const { return shelf_; } SystemTray* tray() const { return tray_.get(); } @@ -234,6 +247,7 @@ class ASH_EXPORT Shell { static bool initially_hide_cursor_; scoped_ptr<aura::RootWindow> root_window_; + ScreenAsh* screen_; internal::RootWindowEventFilter* root_filter_; // not owned @@ -288,6 +302,8 @@ class ASH_EXPORT Shell { // the status area. internal::ShelfLayoutManager* shelf_; + ObserverList<ShellObserver> observers_; + // Can change at runtime. BackgroundMode desktop_background_mode_; diff --git a/ash/shell_observer.h b/ash/shell_observer.h new file mode 100644 index 0000000..0ecf927 --- /dev/null +++ b/ash/shell_observer.h @@ -0,0 +1,24 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef ASH_SHELLOBSERVER_H_ +#define ASH_SHELLOBSERVER_H_ +#pragma once + +#include "ash/ash_export.h" + +namespace ash { + +class ASH_EXPORT ShellObserver { + public: + // Invoked after the screen's work area insets changes. + virtual void OnScreenWorkAreaInsetsChanged() {} + + protected: + virtual ~ShellObserver() {} +}; + +} // namespace ash + +#endif // ASH_SHELLOBSERVER_H_ diff --git a/ash/wm/base_layout_manager.cc b/ash/wm/base_layout_manager.cc index 7fc116d..6a5e5e4 100644 --- a/ash/wm/base_layout_manager.cc +++ b/ash/wm/base_layout_manager.cc @@ -20,6 +20,7 @@ namespace internal { // BaseLayoutManager, public: BaseLayoutManager::BaseLayoutManager() { + Shell::GetInstance()->AddShellObserver(this); Shell::GetRootWindow()->AddRootWindowObserver(this); } @@ -27,6 +28,7 @@ BaseLayoutManager::~BaseLayoutManager() { for (WindowSet::const_iterator i = windows_.begin(); i != windows_.end(); ++i) (*i)->RemoveObserver(this); Shell::GetRootWindow()->RemoveRootWindowObserver(this); + Shell::GetInstance()->RemoveShellObserver(this); } ///////////////////////////////////////////////////////////////////////////// @@ -70,6 +72,9 @@ void BaseLayoutManager::OnRootWindowResized(const gfx::Size& new_size) { AdjustWindowSizesForScreenChange(); } +///////////////////////////////////////////////////////////////////////////// +// BaseLayoutManager, ash::ShellObserver overrides: + void BaseLayoutManager::OnScreenWorkAreaInsetsChanged() { AdjustWindowSizesForScreenChange(); } diff --git a/ash/wm/base_layout_manager.h b/ash/wm/base_layout_manager.h index 79fd1fe..df858c8 100644 --- a/ash/wm/base_layout_manager.h +++ b/ash/wm/base_layout_manager.h @@ -9,6 +9,7 @@ #include <set> #include "ash/ash_export.h" +#include "ash/shell_observer.h" #include "base/basictypes.h" #include "base/compiler_specific.h" #include "ui/aura/layout_manager.h" @@ -29,6 +30,7 @@ namespace internal { // properly. class ASH_EXPORT BaseLayoutManager : public aura::LayoutManager, public aura::RootWindowObserver, + public ash::ShellObserver, public aura::WindowObserver { public: typedef std::set<aura::Window*> WindowSet; @@ -49,6 +51,8 @@ class ASH_EXPORT BaseLayoutManager : public aura::LayoutManager, // RootWindowObserver overrides: virtual void OnRootWindowResized(const gfx::Size& new_size) OVERRIDE; + + // ash::ShellObserver overrides: virtual void OnScreenWorkAreaInsetsChanged() OVERRIDE; // WindowObserver overrides: diff --git a/ash/wm/base_layout_manager_unittest.cc b/ash/wm/base_layout_manager_unittest.cc index b6e4901..f8045a4 100644 --- a/ash/wm/base_layout_manager_unittest.cc +++ b/ash/wm/base_layout_manager_unittest.cc @@ -4,6 +4,7 @@ #include "ash/wm/base_layout_manager.h" +#include "ash/screen_ash.h" #include "ash/shell.h" #include "ash/shell_window_ids.h" #include "ash/test/ash_test_base.h" @@ -11,7 +12,6 @@ #include "base/compiler_specific.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/root_window.h" -#include "ui/aura/screen_aura.h" #include "ui/aura/test/test_windows.h" #include "ui/base/ui_base_types.h" #include "ui/aura/window.h" @@ -27,7 +27,7 @@ class BaseLayoutManagerTest : public test::AshTestBase { virtual void SetUp() OVERRIDE { test::AshTestBase::SetUp(); - Shell::GetRootWindow()->SetScreenWorkAreaInsets( + Shell::GetInstance()->SetScreenWorkAreaInsets( gfx::Insets(1, 2, 3, 4)); Shell::GetRootWindow()->SetHostSize(gfx::Size(800, 600)); aura::Window* default_container = Shell::GetInstance()->GetContainer( diff --git a/ash/wm/shelf_layout_manager.cc b/ash/wm/shelf_layout_manager.cc index 6b37e3f..eca4c40c 100644 --- a/ash/wm/shelf_layout_manager.cc +++ b/ash/wm/shelf_layout_manager.cc @@ -5,10 +5,10 @@ #include "ash/wm/shelf_layout_manager.h" #include "ash/launcher/launcher.h" +#include "ash/screen_ash.h" #include "ash/shell.h" #include "base/auto_reset.h" #include "ui/aura/root_window.h" -#include "ui/aura/screen_aura.h" #include "ui/gfx/compositor/layer.h" #include "ui/gfx/compositor/layer_animation_observer.h" #include "ui/gfx/compositor/layer_animator.h" @@ -43,7 +43,7 @@ ShelfLayoutManager::ShelfLayoutManager(views::Widget* launcher, ShelfLayoutManager::~ShelfLayoutManager() { // Without a shelf we don't need special insets anymore. - Shell::GetRootWindow()->SetScreenWorkAreaInsets(gfx::Insets()); + Shell::GetInstance()->SetScreenWorkAreaInsets(gfx::Insets()); } void ShelfLayoutManager::LayoutShelf() { @@ -58,7 +58,7 @@ void ShelfLayoutManager::LayoutShelf() { status_->SetBounds(target_bounds.status_bounds); Shell::GetInstance()->launcher()->SetStatusWidth( target_bounds.status_bounds.width()); - Shell::GetRootWindow()->SetScreenWorkAreaInsets( + Shell::GetInstance()->SetScreenWorkAreaInsets( target_bounds.work_area_insets); } @@ -150,7 +150,7 @@ void ShelfLayoutManager::CalculateTargetBounds(bool visible, void ShelfLayoutManager::OnImplicitAnimationsCompleted() { TargetBounds target_bounds; CalculateTargetBounds(visible_, &target_bounds); - Shell::GetRootWindow()->SetScreenWorkAreaInsets( + Shell::GetInstance()->SetScreenWorkAreaInsets( target_bounds.work_area_insets); } diff --git a/ash/wm/shelf_layout_manager_unittest.cc b/ash/wm/shelf_layout_manager_unittest.cc index 8a83cb0..fbf924d 100644 --- a/ash/wm/shelf_layout_manager_unittest.cc +++ b/ash/wm/shelf_layout_manager_unittest.cc @@ -5,11 +5,11 @@ #include "ash/wm/shelf_layout_manager.h" #include "ash/launcher/launcher.h" +#include "ash/screen_ash.h" #include "ash/shell.h" #include "ash/shell_window_ids.h" #include "ash/test/ash_test_base.h" #include "ui/aura/root_window.h" -#include "ui/aura/screen_aura.h" #include "ui/aura/window.h" #include "ui/base/animation/animation_container_element.h" #include "ui/gfx/compositor/layer_animator.h" @@ -51,7 +51,7 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetVisible) { shelf->LayoutShelf(); ASSERT_TRUE(shelf->visible()); - const aura::ScreenAura* screen = Shell::GetRootWindow()->screen(); + const ash::ScreenAsh* screen = Shell::GetInstance()->screen(); ASSERT_TRUE(screen); // Bottom inset should be the max of widget heights. EXPECT_EQ(shelf->max_height(), screen->work_area_insets().bottom()); @@ -96,7 +96,7 @@ TEST_F(ShelfLayoutManagerTest, LayoutShelfWhileAnimating) { shelf->LayoutShelf(); ASSERT_TRUE(shelf->visible()); - const aura::ScreenAura* screen = Shell::GetRootWindow()->screen(); + const ash::ScreenAsh* screen = Shell::GetInstance()->screen(); // Hide the shelf. shelf->SetVisible(false); diff --git a/ash/wm/toplevel_layout_manager_unittest.cc b/ash/wm/toplevel_layout_manager_unittest.cc index 246c835..dff916a 100644 --- a/ash/wm/toplevel_layout_manager_unittest.cc +++ b/ash/wm/toplevel_layout_manager_unittest.cc @@ -4,6 +4,7 @@ #include "ash/wm/toplevel_layout_manager.h" +#include "ash/screen_ash.h" #include "ash/shell.h" #include "ash/shell_window_ids.h" #include "ash/test/ash_test_base.h" @@ -12,7 +13,6 @@ #include "base/compiler_specific.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/root_window.h" -#include "ui/aura/screen_aura.h" #include "ui/aura/test/test_windows.h" #include "ui/base/ui_base_types.h" #include "ui/aura/window.h" @@ -33,7 +33,7 @@ class ToplevelLayoutManagerTest : public test::AshTestBase { virtual void SetUp() OVERRIDE { test::AshTestBase::SetUp(); - Shell::GetRootWindow()->SetScreenWorkAreaInsets( + Shell::GetInstance()->SetScreenWorkAreaInsets( gfx::Insets(1, 2, 3, 4)); Shell::GetRootWindow()->SetHostSize(gfx::Size(800, 600)); aura::Window* default_container = Shell::GetInstance()->GetContainer( @@ -105,16 +105,14 @@ TEST_F(ToplevelLayoutManagerTest, ResizeMaximizedWindowOnWorkAreaInsetsChange) { gfx::Rect bounds(100, 100, 200, 200); scoped_ptr<aura::Window> window(CreateTestWindow(bounds)); - Shell::GetRootWindow()->SetScreenWorkAreaInsets( - gfx::Insets(0, 0, 30, 0)); + Shell::GetInstance()->SetScreenWorkAreaInsets(gfx::Insets(0, 0, 30, 0)); window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); // Maximized window fills the work area. EXPECT_EQ(gfx::Screen::GetMonitorWorkAreaNearestWindow(window.get()), window->bounds()); // Change work area insets. - Shell::GetRootWindow()->SetScreenWorkAreaInsets( - gfx::Insets(0, 0, 60, 0)); + Shell::GetInstance()->SetScreenWorkAreaInsets(gfx::Insets(0, 0, 60, 0)); // Maximized window fills the changed work area. EXPECT_EQ(gfx::Screen::GetMonitorWorkAreaNearestWindow(window.get()), window->bounds()); diff --git a/ash/wm/workspace/workspace_event_filter.cc b/ash/wm/workspace/workspace_event_filter.cc index 84046b9..786c1c5 100644 --- a/ash/wm/workspace/workspace_event_filter.cc +++ b/ash/wm/workspace/workspace_event_filter.cc @@ -4,6 +4,7 @@ #include "ash/wm/workspace/workspace_event_filter.h" +#include "ash/screen_ash.h" #include "ash/wm/property_util.h" #include "ash/wm/window_frame.h" #include "ash/wm/window_util.h" @@ -11,7 +12,6 @@ #include "ash/wm/workspace/workspace_window_resizer.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/event.h" -#include "ui/aura/screen_aura.h" #include "ui/aura/window.h" #include "ui/aura/window_delegate.h" #include "ui/base/hit_test.h" diff --git a/ash/wm/workspace/workspace_layout_manager.cc b/ash/wm/workspace/workspace_layout_manager.cc index 52c50c4..b984493 100644 --- a/ash/wm/workspace/workspace_layout_manager.cc +++ b/ash/wm/workspace/workspace_layout_manager.cc @@ -4,6 +4,7 @@ #include "ash/wm/workspace/workspace_layout_manager.h" +#include "ash/screen_ash.h" #include "ash/wm/property_util.h" #include "ash/wm/window_util.h" #include "ash/wm/workspace/workspace.h" @@ -12,7 +13,6 @@ #include "ui/aura/client/aura_constants.h" #include "ui/aura/event.h" #include "ui/aura/root_window.h" -#include "ui/aura/screen_aura.h" #include "ui/aura/window.h" #include "ui/aura/window_observer.h" #include "ui/base/ui_base_types.h" diff --git a/ash/wm/workspace/workspace_manager.cc b/ash/wm/workspace/workspace_manager.cc index caf7d93..1aaa8d0 100644 --- a/ash/wm/workspace/workspace_manager.cc +++ b/ash/wm/workspace/workspace_manager.cc @@ -6,6 +6,7 @@ #include <algorithm> +#include "ash/screen_ash.h" #include "ash/shell.h" #include "ash/wm/property_util.h" #include "ash/wm/shelf_layout_manager.h" @@ -19,7 +20,6 @@ #include "base/stl_util.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/root_window.h" -#include "ui/aura/screen_aura.h" #include "ui/aura/window.h" #include "ui/base/ui_base_types.h" #include "ui/gfx/compositor/layer.h" @@ -288,7 +288,7 @@ void WorkspaceManager::SetActiveWorkspace(Workspace* workspace) { gfx::Rect WorkspaceManager::GetWorkAreaBounds() { gfx::Rect bounds(workspace_size_); - bounds.Inset(Shell::GetRootWindow()->screen()->work_area_insets()); + bounds.Inset(Shell::GetInstance()->screen()->work_area_insets()); return bounds; } diff --git a/ash/wm/workspace/workspace_manager_unittest.cc b/ash/wm/workspace/workspace_manager_unittest.cc index a9312ca..20fa704 100644 --- a/ash/wm/workspace/workspace_manager_unittest.cc +++ b/ash/wm/workspace/workspace_manager_unittest.cc @@ -4,6 +4,7 @@ #include "ash/wm/workspace/workspace_manager.h" +#include "ash/screen_ash.h" #include "ash/shell.h" #include "ash/shell_window_ids.h" #include "ash/test/ash_test_base.h" @@ -15,7 +16,6 @@ #include "ash/wm/workspace/workspace_layout_manager.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/root_window.h" -#include "ui/aura/screen_aura.h" #include "ui/aura/window.h" #include "ui/base/ui_base_types.h" #include "ui/gfx/screen.h" @@ -174,7 +174,7 @@ TEST_F(WorkspaceManagerTest, ResizeMaximizedWindowOnWorkAreaInsetsChange) { EXPECT_EQ(251, w1->bounds().height()); // Maximize the window. - Shell::GetRootWindow()->SetScreenWorkAreaInsets( + Shell::GetInstance()->SetScreenWorkAreaInsets( gfx::Insets(0, 0, 30, 0)); w1->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); @@ -187,7 +187,7 @@ TEST_F(WorkspaceManagerTest, ResizeMaximizedWindowOnWorkAreaInsetsChange) { EXPECT_EQ(GetWorkAreaBounds().height(), w1->bounds().height()); // Change work area insets. - Shell::GetRootWindow()->SetScreenWorkAreaInsets( + Shell::GetInstance()->SetScreenWorkAreaInsets( gfx::Insets(0, 0, 60, 0)); // Should be 1 workspace, TYPE_MAXIMIZED with w1, fills the changed work diff --git a/ash/wm/workspace/workspace_window_resizer_unittest.cc b/ash/wm/workspace/workspace_window_resizer_unittest.cc index d129d1e..88c8987 100644 --- a/ash/wm/workspace/workspace_window_resizer_unittest.cc +++ b/ash/wm/workspace/workspace_window_resizer_unittest.cc @@ -4,11 +4,11 @@ #include "ash/wm/workspace/workspace_window_resizer.h" +#include "ash/screen_ash.h" #include "ash/shell.h" #include "ash/test/ash_test_base.h" #include "base/string_number_conversions.h" #include "ui/aura/root_window.h" -#include "ui/aura/screen_aura.h" #include "ui/aura/test/test_window_delegate.h" #include "ui/base/hit_test.h" @@ -51,7 +51,7 @@ class WorkspaceWindowResizerTest : public test::AshTestBase { root->SetBounds(gfx::Rect(0, 0, 800, kRootHeight)); gfx::Rect root_bounds(root->bounds()); EXPECT_EQ(kRootHeight, root_bounds.height()); - root->SetScreenWorkAreaInsets(gfx::Insets()); + Shell::GetInstance()->SetScreenWorkAreaInsets(gfx::Insets()); window_.reset(new aura::Window(&delegate_)); window_->Init(ui::Layer::LAYER_NOT_DRAWN); window_->SetParent(Shell::GetInstance()->GetRootWindow()); @@ -546,7 +546,7 @@ TEST_F(WorkspaceWindowResizerTest, AttachedResize_BOTTOM_2_REMEMBER) { TEST_F(WorkspaceWindowResizerTest, AttachedResize_BOTTOM_3) { aura::RootWindow* root = Shell::GetInstance()->GetRootWindow(); root->SetBounds(gfx::Rect(0, 0, 600, 800)); - root->SetScreenWorkAreaInsets(gfx::Insets()); + Shell::GetInstance()->SetScreenWorkAreaInsets(gfx::Insets()); window_->SetBounds(gfx::Rect( 300, 100, 300, 200)); window2_->SetBounds(gfx::Rect(300, 300, 200, 150)); @@ -588,7 +588,7 @@ TEST_F(WorkspaceWindowResizerTest, AttachedResize_BOTTOM_3) { TEST_F(WorkspaceWindowResizerTest, AttachedResize_BOTTOM_RememberHeight) { aura::RootWindow* root = Shell::GetInstance()->GetRootWindow(); root->SetBounds(gfx::Rect(0, 0, 600, 800)); - root->SetScreenWorkAreaInsets(gfx::Insets()); + Shell::GetInstance()->SetScreenWorkAreaInsets(gfx::Insets()); window_->SetBounds(gfx::Rect( 300, 100, 300, 200)); window2_->SetBounds(gfx::Rect(300, 300, 200, 150)); |