diff options
author | isherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-10 00:34:48 +0000 |
---|---|---|
committer | isherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-10 00:34:48 +0000 |
commit | 49c33c2ddfe099c027bd76a172c65e28f1442bfb (patch) | |
tree | 9cf6f597a2273dce5d776d6626ebd7b0b00928ef /ash | |
parent | c9a7428436a7528c76fd03f4bf324197589b3a58 (diff) | |
download | chromium_src-49c33c2ddfe099c027bd76a172c65e28f1442bfb.zip chromium_src-49c33c2ddfe099c027bd76a172c65e28f1442bfb.tar.gz chromium_src-49c33c2ddfe099c027bd76a172c65e28f1442bfb.tar.bz2 |
Revert 125950 - 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
TBR=erg@chromium.org
Review URL: https://chromiumcodereview.appspot.com/9667017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@125958 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, 26 insertions, 223 deletions
diff --git a/ash/ash.gyp b/ash/ash.gyp index 5d53c18..9546f9f 100644 --- a/ash/ash.gyp +++ b/ash/ash.gyp @@ -98,8 +98,6 @@ '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 deleted file mode 100644 index bbdf9e8..0000000 --- a/ash/screen_ash.cc +++ /dev/null @@ -1,67 +0,0 @@ -// 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 deleted file mode 100644 index deaa76f..0000000 --- a/ash/screen_ash.h +++ /dev/null @@ -1,62 +0,0 @@ -// 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 ad8f835..ae5ffab6 100644 --- a/ash/shell.cc +++ b/ash/shell.cc @@ -12,7 +12,6 @@ #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" @@ -307,7 +306,6 @@ 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), @@ -318,7 +316,6 @@ Shell::Shell(ShellDelegate* delegate) desktop_background_mode_(BACKGROUND_IMAGE), root_window_layout_(NULL), status_widget_(NULL) { - gfx::Screen::SetInstance(screen_); } Shell::~Shell() { @@ -600,22 +597,6 @@ 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 e6af0db..92910ce 100644 --- a/ash/shell.h +++ b/ash/shell.h @@ -14,9 +14,7 @@ #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; @@ -47,9 +45,7 @@ class NestedDispatcherController; class NetworkController; class PowerButtonController; class PowerStatusController; -class ScreenAsh; class ShellDelegate; -class ShellObserver; class SystemTrayDelegate; class SystemTray; class VideoDetector; @@ -156,13 +152,6 @@ 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(); @@ -208,8 +197,6 @@ 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(); } @@ -247,7 +234,6 @@ class ASH_EXPORT Shell { static bool initially_hide_cursor_; scoped_ptr<aura::RootWindow> root_window_; - ScreenAsh* screen_; internal::RootWindowEventFilter* root_filter_; // not owned @@ -302,8 +288,6 @@ 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 deleted file mode 100644 index 0ecf927..0000000 --- a/ash/shell_observer.h +++ /dev/null @@ -1,24 +0,0 @@ -// 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 6a5e5e4..7fc116d 100644 --- a/ash/wm/base_layout_manager.cc +++ b/ash/wm/base_layout_manager.cc @@ -20,7 +20,6 @@ namespace internal { // BaseLayoutManager, public: BaseLayoutManager::BaseLayoutManager() { - Shell::GetInstance()->AddShellObserver(this); Shell::GetRootWindow()->AddRootWindowObserver(this); } @@ -28,7 +27,6 @@ BaseLayoutManager::~BaseLayoutManager() { for (WindowSet::const_iterator i = windows_.begin(); i != windows_.end(); ++i) (*i)->RemoveObserver(this); Shell::GetRootWindow()->RemoveRootWindowObserver(this); - Shell::GetInstance()->RemoveShellObserver(this); } ///////////////////////////////////////////////////////////////////////////// @@ -72,9 +70,6 @@ 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 df858c8..79fd1fe 100644 --- a/ash/wm/base_layout_manager.h +++ b/ash/wm/base_layout_manager.h @@ -9,7 +9,6 @@ #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" @@ -30,7 +29,6 @@ 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; @@ -51,8 +49,6 @@ 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 f8045a4..b6e4901 100644 --- a/ash/wm/base_layout_manager_unittest.cc +++ b/ash/wm/base_layout_manager_unittest.cc @@ -4,7 +4,6 @@ #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" @@ -12,6 +11,7 @@ #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::GetInstance()->SetScreenWorkAreaInsets( + Shell::GetRootWindow()->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 eca4c40c..6b37e3f 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::GetInstance()->SetScreenWorkAreaInsets(gfx::Insets()); + Shell::GetRootWindow()->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::GetInstance()->SetScreenWorkAreaInsets( + Shell::GetRootWindow()->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::GetInstance()->SetScreenWorkAreaInsets( + Shell::GetRootWindow()->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 fbf924d..8a83cb0 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 ash::ScreenAsh* screen = Shell::GetInstance()->screen(); + const aura::ScreenAura* screen = Shell::GetRootWindow()->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 ash::ScreenAsh* screen = Shell::GetInstance()->screen(); + const aura::ScreenAura* screen = Shell::GetRootWindow()->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 dff916a..246c835 100644 --- a/ash/wm/toplevel_layout_manager_unittest.cc +++ b/ash/wm/toplevel_layout_manager_unittest.cc @@ -4,7 +4,6 @@ #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" @@ -13,6 +12,7 @@ #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::GetInstance()->SetScreenWorkAreaInsets( + Shell::GetRootWindow()->SetScreenWorkAreaInsets( gfx::Insets(1, 2, 3, 4)); Shell::GetRootWindow()->SetHostSize(gfx::Size(800, 600)); aura::Window* default_container = Shell::GetInstance()->GetContainer( @@ -105,14 +105,16 @@ TEST_F(ToplevelLayoutManagerTest, ResizeMaximizedWindowOnWorkAreaInsetsChange) { gfx::Rect bounds(100, 100, 200, 200); scoped_ptr<aura::Window> window(CreateTestWindow(bounds)); - Shell::GetInstance()->SetScreenWorkAreaInsets(gfx::Insets(0, 0, 30, 0)); + Shell::GetRootWindow()->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::GetInstance()->SetScreenWorkAreaInsets(gfx::Insets(0, 0, 60, 0)); + Shell::GetRootWindow()->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 786c1c5..84046b9 100644 --- a/ash/wm/workspace/workspace_event_filter.cc +++ b/ash/wm/workspace/workspace_event_filter.cc @@ -4,7 +4,6 @@ #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" @@ -12,6 +11,7 @@ #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 b984493..52c50c4 100644 --- a/ash/wm/workspace/workspace_layout_manager.cc +++ b/ash/wm/workspace/workspace_layout_manager.cc @@ -4,7 +4,6 @@ #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" @@ -13,6 +12,7 @@ #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 1aaa8d0..caf7d93 100644 --- a/ash/wm/workspace/workspace_manager.cc +++ b/ash/wm/workspace/workspace_manager.cc @@ -6,7 +6,6 @@ #include <algorithm> -#include "ash/screen_ash.h" #include "ash/shell.h" #include "ash/wm/property_util.h" #include "ash/wm/shelf_layout_manager.h" @@ -20,6 +19,7 @@ #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::GetInstance()->screen()->work_area_insets()); + bounds.Inset(Shell::GetRootWindow()->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 20fa704..a9312ca 100644 --- a/ash/wm/workspace/workspace_manager_unittest.cc +++ b/ash/wm/workspace/workspace_manager_unittest.cc @@ -4,7 +4,6 @@ #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" @@ -16,6 +15,7 @@ #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::GetInstance()->SetScreenWorkAreaInsets( + Shell::GetRootWindow()->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::GetInstance()->SetScreenWorkAreaInsets( + Shell::GetRootWindow()->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 88c8987..d129d1e 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()); - Shell::GetInstance()->SetScreenWorkAreaInsets(gfx::Insets()); + root->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)); - Shell::GetInstance()->SetScreenWorkAreaInsets(gfx::Insets()); + root->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)); - Shell::GetInstance()->SetScreenWorkAreaInsets(gfx::Insets()); + root->SetScreenWorkAreaInsets(gfx::Insets()); window_->SetBounds(gfx::Rect( 300, 100, 300, 200)); window2_->SetBounds(gfx::Rect(300, 300, 200, 150)); |