diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-16 22:24:15 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-16 22:24:15 +0000 |
commit | efbc0501471d786876c18c16f9534260b3ac4ecf (patch) | |
tree | 83c1ad4f614082b6cb82ff34d646d46006da6e92 /ash/display | |
parent | 923ff89912b0466be41099cd2975e65e4b24ba37 (diff) | |
download | chromium_src-efbc0501471d786876c18c16f9534260b3ac4ecf.zip chromium_src-efbc0501471d786876c18c16f9534260b3ac4ecf.tar.gz chromium_src-efbc0501471d786876c18c16f9534260b3ac4ecf.tar.bz2 |
Move SetLayoutForCurrentDisplays to DisplayManager
BUG=273142
R=mukai@chromium.org
TBR=hongbo.min@intel.com, pkotwicz@chromium.org
Review URL: https://codereview.chromium.org/27257004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@228994 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/display')
-rw-r--r-- | ash/display/display_controller.cc | 45 | ||||
-rw-r--r-- | ash/display/display_controller.h | 10 | ||||
-rw-r--r-- | ash/display/display_controller_unittest.cc | 84 | ||||
-rw-r--r-- | ash/display/display_manager.cc | 38 | ||||
-rw-r--r-- | ash/display/display_manager.h | 5 | ||||
-rw-r--r-- | ash/display/display_manager_unittest.cc | 72 | ||||
-rw-r--r-- | ash/display/mouse_cursor_event_filter_unittest.cc | 33 | ||||
-rw-r--r-- | ash/display/root_window_transformers_unittest.cc | 5 | ||||
-rw-r--r-- | ash/display/screen_position_controller_unittest.cc | 4 |
9 files changed, 136 insertions, 160 deletions
diff --git a/ash/display/display_controller.cc b/ash/display/display_controller.cc index 53eb429..9930205 100644 --- a/ash/display/display_controller.cc +++ b/ash/display/display_controller.cc @@ -370,37 +370,6 @@ DisplayController::GetAllRootWindowControllers() { return controllers; } -void DisplayController::SetLayoutForCurrentDisplays( - const DisplayLayout& layout_relative_to_primary) { - DCHECK_EQ(2U, GetDisplayManager()->GetNumDisplays()); - if (GetDisplayManager()->GetNumDisplays() < 2) - return; - const gfx::Display& primary = GetPrimaryDisplay(); - const DisplayIdPair pair = GetDisplayManager()->GetCurrentDisplayIdPair(); - // Invert if the primary was swapped. - DisplayLayout to_set = pair.first == primary.id() ? - layout_relative_to_primary : layout_relative_to_primary.Invert(); - - internal::DisplayLayoutStore* layout_store = - GetDisplayManager()->layout_store(); - DisplayLayout current_layout = - layout_store->GetRegisteredDisplayLayout(pair); - if (to_set.position != current_layout.position || - to_set.offset != current_layout.offset) { - to_set.primary_id = primary.id(); - layout_store->RegisterLayoutForDisplayIdPair( - pair.first, pair.second, to_set); - PreDisplayConfigurationChange(false); - // TODO(oshima): Call UpdateDisplays instead. - UpdateDisplayBoundsForLayout(); - // Primary's bounds stay the same. Just notify bounds change - // on the secondary. - Shell::GetInstance()->screen()->NotifyBoundsChanged( - ScreenAsh::GetSecondaryDisplay()); - PostDisplayConfigurationChange(); - } -} - void DisplayController::ToggleMirrorMode() { internal::DisplayManager* display_manager = GetDisplayManager(); if (display_manager->num_connected_displays() <= 1) @@ -793,20 +762,6 @@ aura::RootWindow* DisplayController::AddRootWindowForDisplay( return root_window; } -void DisplayController::UpdateDisplayBoundsForLayout() { - internal::DisplayManager* display_manager = GetDisplayManager(); - if (Shell::GetScreen()->GetNumDisplays() < 2 || - display_manager->num_connected_displays() < 2) { - return; - } - DCHECK_EQ(2, Shell::GetScreen()->GetNumDisplays()); - - const DisplayLayout layout = display_manager->GetCurrentDisplayLayout(); - display_manager->UpdateDisplayBoundsForLayoutById( - layout, GetPrimaryDisplay(), - ScreenAsh::GetSecondaryDisplay().id()); -} - void DisplayController::OnFadeOutForSwapDisplayFinished() { #if defined(OS_CHROMEOS) && defined(USE_X11) SetPrimaryDisplay(ScreenAsh::GetSecondaryDisplay()); diff --git a/ash/display/display_controller.h b/ash/display/display_controller.h index bbfd55a..dbe5f50 100644 --- a/ash/display/display_controller.h +++ b/ash/display/display_controller.h @@ -9,7 +9,6 @@ #include <vector> #include "ash/ash_export.h" -#include "ash/display/display_layout.h" #include "ash/display/display_manager.h" #include "base/basictypes.h" #include "base/compiler_specific.h" @@ -129,10 +128,6 @@ class ASH_EXPORT DisplayController : public gfx::DisplayObserver, gfx::Insets GetOverscanInsets(int64 display_id) const; void SetOverscanInsets(int64 display_id, const gfx::Insets& insets_in_dip); - // Sets the layout for the current display pair. The |layout| specifies - // the locaion of the secondary display relative to the primary. - void SetLayoutForCurrentDisplays(const DisplayLayout& layout); - // Checks if the mouse pointer is on one of displays, and moves to // the center of the nearest display if it's outside of all displays. void EnsurePointerInDisplays(); @@ -179,11 +174,6 @@ class ASH_EXPORT DisplayController : public gfx::DisplayObserver, // map. aura::RootWindow* AddRootWindowForDisplay(const gfx::Display& display); - void UpdateDisplayBoundsForLayout(); - - void SetLayoutForDisplayIdPair(const DisplayIdPair& display_pair, - const DisplayLayout& layout); - void OnFadeOutForSwapDisplayFinished(); void UpdateHostWindowNames(); diff --git a/ash/display/display_controller_unittest.cc b/ash/display/display_controller_unittest.cc index c2e3e7d..3d4acf2 100644 --- a/ash/display/display_controller_unittest.cc +++ b/ash/display/display_controller_unittest.cc @@ -165,7 +165,7 @@ void SetSecondaryDisplayLayoutAndOffset(DisplayLayout::Position position, int offset) { DisplayLayout layout(position, offset); ASSERT_GT(Shell::GetScreen()->GetNumDisplays(), 1); - Shell::GetInstance()->display_controller()-> + Shell::GetInstance()->display_manager()-> SetLayoutForCurrentDisplays(layout); } @@ -530,36 +530,6 @@ TEST_F(DisplayControllerTest, BoundsUpdated) { EXPECT_EQ(0, observer.GetActivationChangedCountAndReset()); } -TEST_F(DisplayControllerTest, InvertLayout) { - EXPECT_EQ("left, 0", - DisplayLayout(DisplayLayout::RIGHT, 0).Invert().ToString()); - EXPECT_EQ("left, -100", - DisplayLayout(DisplayLayout::RIGHT, 100).Invert().ToString()); - EXPECT_EQ("left, 50", - DisplayLayout(DisplayLayout::RIGHT, -50).Invert().ToString()); - - EXPECT_EQ("right, 0", - DisplayLayout(DisplayLayout::LEFT, 0).Invert().ToString()); - EXPECT_EQ("right, -90", - DisplayLayout(DisplayLayout::LEFT, 90).Invert().ToString()); - EXPECT_EQ("right, 60", - DisplayLayout(DisplayLayout::LEFT, -60).Invert().ToString()); - - EXPECT_EQ("bottom, 0", - DisplayLayout(DisplayLayout::TOP, 0).Invert().ToString()); - EXPECT_EQ("bottom, -80", - DisplayLayout(DisplayLayout::TOP, 80).Invert().ToString()); - EXPECT_EQ("bottom, 70", - DisplayLayout(DisplayLayout::TOP, -70).Invert().ToString()); - - EXPECT_EQ("top, 0", - DisplayLayout(DisplayLayout::BOTTOM, 0).Invert().ToString()); - EXPECT_EQ("top, -70", - DisplayLayout(DisplayLayout::BOTTOM, 70).Invert().ToString()); - EXPECT_EQ("top, 80", - DisplayLayout(DisplayLayout::BOTTOM, -80).Invert().ToString()); -} - TEST_F(DisplayControllerTest, SwapPrimary) { if (!SupportsMultipleDisplays()) return; @@ -574,7 +544,7 @@ TEST_F(DisplayControllerTest, SwapPrimary) { gfx::Display secondary_display = ScreenAsh::GetSecondaryDisplay(); DisplayLayout display_layout(DisplayLayout::RIGHT, 50); - display_controller->SetLayoutForCurrentDisplays(display_layout); + display_manager->SetLayoutForCurrentDisplays(display_layout); EXPECT_NE(primary_display.id(), secondary_display.id()); aura::RootWindow* primary_root = @@ -668,7 +638,7 @@ TEST_F(DisplayControllerTest, SwapPrimaryForLegacyShelfLayout) { gfx::Display secondary_display = ScreenAsh::GetSecondaryDisplay(); DisplayLayout display_layout(DisplayLayout::RIGHT, 50); - display_controller->SetLayoutForCurrentDisplays(display_layout); + display_manager->SetLayoutForCurrentDisplays(display_layout); EXPECT_NE(primary_display.id(), secondary_display.id()); aura::RootWindow* primary_root = @@ -759,7 +729,7 @@ TEST_F(DisplayControllerTest, SwapPrimaryById) { gfx::Display secondary_display = ScreenAsh::GetSecondaryDisplay(); DisplayLayout display_layout(DisplayLayout::RIGHT, 50); - display_controller->SetLayoutForCurrentDisplays(display_layout); + display_manager->SetLayoutForCurrentDisplays(display_layout); EXPECT_NE(primary_display.id(), secondary_display.id()); aura::RootWindow* primary_root = @@ -924,48 +894,6 @@ TEST_F(DisplayControllerTest, CursorDeviceScaleFactorSwapPrimary) { EXPECT_EQ(1.0f, test_api.GetDisplay().device_scale_factor()); } -#if defined(OS_WIN) -// TODO(scottmg): RootWindow doesn't get resized on Windows -// Ash. http://crbug.com/247916. -#define MAYBE_UpdateDisplayWithHostOrigin DISABLED_UpdateDisplayWithHostOrigin -#else -#define MAYBE_UpdateDisplayWithHostOrigin UpdateDisplayWithHostOrigin -#endif - -TEST_F(DisplayControllerTest, MAYBE_UpdateDisplayWithHostOrigin) { - UpdateDisplay("100x200,300x400"); - ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays()); - Shell::RootWindowList root_windows = - Shell::GetInstance()->GetAllRootWindows(); - ASSERT_EQ(2U, root_windows.size()); - EXPECT_EQ("1,1", root_windows[0]->GetHostOrigin().ToString()); - EXPECT_EQ("100x200", root_windows[0]->GetHostSize().ToString()); - // UpdateDisplay set the origin if it's not set. - EXPECT_NE("1,1", root_windows[1]->GetHostOrigin().ToString()); - EXPECT_EQ("300x400", root_windows[1]->GetHostSize().ToString()); - - UpdateDisplay("100x200,200+300-300x400"); - ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays()); - EXPECT_EQ("0,0", root_windows[0]->GetHostOrigin().ToString()); - EXPECT_EQ("100x200", root_windows[0]->GetHostSize().ToString()); - EXPECT_EQ("200,300", root_windows[1]->GetHostOrigin().ToString()); - EXPECT_EQ("300x400", root_windows[1]->GetHostSize().ToString()); - - UpdateDisplay("400+500-200x300,300x400"); - ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays()); - EXPECT_EQ("400,500", root_windows[0]->GetHostOrigin().ToString()); - EXPECT_EQ("200x300", root_windows[0]->GetHostSize().ToString()); - EXPECT_EQ("0,0", root_windows[1]->GetHostOrigin().ToString()); - EXPECT_EQ("300x400", root_windows[1]->GetHostSize().ToString()); - - UpdateDisplay("100+200-100x200,300+500-200x300"); - ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays()); - EXPECT_EQ("100,200", root_windows[0]->GetHostOrigin().ToString()); - EXPECT_EQ("100x200", root_windows[0]->GetHostSize().ToString()); - EXPECT_EQ("300,500", root_windows[1]->GetHostOrigin().ToString()); - EXPECT_EQ("200x300", root_windows[1]->GetHostSize().ToString()); -} - TEST_F(DisplayControllerTest, OverscanInsets) { if (!SupportsMultipleDisplays()) return; @@ -1018,8 +946,6 @@ TEST_F(DisplayControllerTest, Rotate) { if (!SupportsMultipleDisplays()) return; - DisplayController* display_controller = - Shell::GetInstance()->display_controller(); internal::DisplayManager* display_manager = Shell::GetInstance()->display_manager(); TestEventHandler event_handler; @@ -1052,7 +978,7 @@ TEST_F(DisplayControllerTest, Rotate) { EXPECT_EQ(gfx::Display::ROTATE_0, GetStoredRotation(display2_id)); DisplayLayout display_layout(DisplayLayout::BOTTOM, 50); - display_controller->SetLayoutForCurrentDisplays(display_layout); + display_manager->SetLayoutForCurrentDisplays(display_layout); EXPECT_EQ("50,120 150x200", ScreenAsh::GetSecondaryDisplay().bounds().ToString()); diff --git a/ash/display/display_manager.cc b/ash/display/display_manager.cc index 73b8302..ebaea67 100644 --- a/ash/display/display_manager.cc +++ b/ash/display/display_manager.cc @@ -282,6 +282,43 @@ DisplayIdPair DisplayManager::GetCurrentDisplayIdPair() const { } } +void DisplayManager::SetLayoutForCurrentDisplays( + const DisplayLayout& layout_relative_to_primary) { + DCHECK_EQ(2U, GetNumDisplays()); + if (GetNumDisplays() < 2) + return; + const gfx::Display& primary = Shell::GetScreen()->GetPrimaryDisplay(); + const DisplayIdPair pair = GetCurrentDisplayIdPair(); + // Invert if the primary was swapped. + DisplayLayout to_set = pair.first == primary.id() ? + layout_relative_to_primary : layout_relative_to_primary.Invert(); + + DisplayLayout current_layout = + layout_store_->GetRegisteredDisplayLayout(pair); + if (to_set.position != current_layout.position || + to_set.offset != current_layout.offset) { + to_set.primary_id = primary.id(); + layout_store_->RegisterLayoutForDisplayIdPair( + pair.first, pair.second, to_set); + if (delegate_) + delegate_->PreDisplayConfigurationChange(false); + // PreDisplayConfigurationChange(false); + // TODO(oshima): Call UpdateDisplays instead. + const DisplayLayout layout = GetCurrentDisplayLayout(); + UpdateDisplayBoundsForLayoutById( + layout, primary, + ScreenAsh::GetSecondaryDisplay().id()); + + //UpdateCurrentDisplayBoundsForLayout(); + // Primary's bounds stay the same. Just notify bounds change + // on the secondary. + Shell::GetInstance()->screen()->NotifyBoundsChanged( + ScreenAsh::GetSecondaryDisplay()); + if (delegate_) + delegate_->PostDisplayConfigurationChange(); + } +} + const gfx::Display& DisplayManager::GetDisplayForId(int64 id) const { gfx::Display* display = const_cast<DisplayManager*>(this)->FindDisplayForId(id); @@ -903,7 +940,6 @@ bool DisplayManager::UpdateSecondaryDisplayBoundsForLayout( return false; } - // static void DisplayManager::UpdateDisplayBoundsForLayout( const DisplayLayout& layout, diff --git a/ash/display/display_manager.h b/ash/display/display_manager.h index d905f7c..6b547eb 100644 --- a/ash/display/display_manager.h +++ b/ash/display/display_manager.h @@ -113,6 +113,11 @@ class ASH_EXPORT DisplayManager // Returns the current display pair. DisplayIdPair GetCurrentDisplayIdPair() const; + // Sets the layout for the current display pair. The |layout| specifies + // the locaion of the secondary display relative to the primary. + void SetLayoutForCurrentDisplays( + const DisplayLayout& layout_relative_to_primary); + // Returns display for given |id|; const gfx::Display& GetDisplayForId(int64 id) const; diff --git a/ash/display/display_manager_unittest.cc b/ash/display/display_manager_unittest.cc index 58c7cb5..7e8652e 100644 --- a/ash/display/display_manager_unittest.cc +++ b/ash/display/display_manager_unittest.cc @@ -1048,5 +1048,77 @@ TEST_F(DisplayManagerTest, MirroredLayout) { EXPECT_EQ(2U, display_manager->num_connected_displays()); } +TEST_F(DisplayManagerTest, InvertLayout) { + EXPECT_EQ("left, 0", + DisplayLayout(DisplayLayout::RIGHT, 0).Invert().ToString()); + EXPECT_EQ("left, -100", + DisplayLayout(DisplayLayout::RIGHT, 100).Invert().ToString()); + EXPECT_EQ("left, 50", + DisplayLayout(DisplayLayout::RIGHT, -50).Invert().ToString()); + + EXPECT_EQ("right, 0", + DisplayLayout(DisplayLayout::LEFT, 0).Invert().ToString()); + EXPECT_EQ("right, -90", + DisplayLayout(DisplayLayout::LEFT, 90).Invert().ToString()); + EXPECT_EQ("right, 60", + DisplayLayout(DisplayLayout::LEFT, -60).Invert().ToString()); + + EXPECT_EQ("bottom, 0", + DisplayLayout(DisplayLayout::TOP, 0).Invert().ToString()); + EXPECT_EQ("bottom, -80", + DisplayLayout(DisplayLayout::TOP, 80).Invert().ToString()); + EXPECT_EQ("bottom, 70", + DisplayLayout(DisplayLayout::TOP, -70).Invert().ToString()); + + EXPECT_EQ("top, 0", + DisplayLayout(DisplayLayout::BOTTOM, 0).Invert().ToString()); + EXPECT_EQ("top, -70", + DisplayLayout(DisplayLayout::BOTTOM, 70).Invert().ToString()); + EXPECT_EQ("top, 80", + DisplayLayout(DisplayLayout::BOTTOM, -80).Invert().ToString()); +} + +#if defined(OS_WIN) +// TODO(scottmg): RootWindow doesn't get resized on Windows +// Ash. http://crbug.com/247916. +#define MAYBE_UpdateDisplayWithHostOrigin DISABLED_UpdateDisplayWithHostOrigin +#else +#define MAYBE_UpdateDisplayWithHostOrigin UpdateDisplayWithHostOrigin +#endif + +TEST_F(DisplayManagerTest, MAYBE_UpdateDisplayWithHostOrigin) { + UpdateDisplay("100x200,300x400"); + ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays()); + Shell::RootWindowList root_windows = + Shell::GetInstance()->GetAllRootWindows(); + ASSERT_EQ(2U, root_windows.size()); + EXPECT_EQ("1,1", root_windows[0]->GetHostOrigin().ToString()); + EXPECT_EQ("100x200", root_windows[0]->GetHostSize().ToString()); + // UpdateDisplay set the origin if it's not set. + EXPECT_NE("1,1", root_windows[1]->GetHostOrigin().ToString()); + EXPECT_EQ("300x400", root_windows[1]->GetHostSize().ToString()); + + UpdateDisplay("100x200,200+300-300x400"); + ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays()); + EXPECT_EQ("0,0", root_windows[0]->GetHostOrigin().ToString()); + EXPECT_EQ("100x200", root_windows[0]->GetHostSize().ToString()); + EXPECT_EQ("200,300", root_windows[1]->GetHostOrigin().ToString()); + EXPECT_EQ("300x400", root_windows[1]->GetHostSize().ToString()); + + UpdateDisplay("400+500-200x300,300x400"); + ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays()); + EXPECT_EQ("400,500", root_windows[0]->GetHostOrigin().ToString()); + EXPECT_EQ("200x300", root_windows[0]->GetHostSize().ToString()); + EXPECT_EQ("0,0", root_windows[1]->GetHostOrigin().ToString()); + EXPECT_EQ("300x400", root_windows[1]->GetHostSize().ToString()); + + UpdateDisplay("100+200-100x200,300+500-200x300"); + ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays()); + EXPECT_EQ("100,200", root_windows[0]->GetHostOrigin().ToString()); + EXPECT_EQ("100x200", root_windows[0]->GetHostSize().ToString()); + EXPECT_EQ("300,500", root_windows[1]->GetHostOrigin().ToString()); + EXPECT_EQ("200x300", root_windows[1]->GetHostSize().ToString()); +} + } // namespace internal } // namespace ash diff --git a/ash/display/mouse_cursor_event_filter_unittest.cc b/ash/display/mouse_cursor_event_filter_unittest.cc index e4a25a8..949c7c0 100644 --- a/ash/display/mouse_cursor_event_filter_unittest.cc +++ b/ash/display/mouse_cursor_event_filter_unittest.cc @@ -7,7 +7,6 @@ #include "ash/shell.h" #include "ash/test/ash_test_base.h" #include "ash/test/cursor_manager_test_api.h" -#include "ash/display/display_controller.h" #include "ash/display/display_layout_store.h" #include "ash/display/display_manager.h" #include "ui/aura/env.h" @@ -219,10 +218,9 @@ TEST_F(MouseCursorEventFilterTest, IndicatorBoundsTestOnRight) { UpdateDisplay("360x360,700x700"); Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); - DisplayController* controller = - Shell::GetInstance()->display_controller(); + DisplayManager* display_manager = Shell::GetInstance()->display_manager(); DisplayLayout layout(DisplayLayout::RIGHT, 0); - controller->SetLayoutForCurrentDisplays(layout); + display_manager->SetLayoutForCurrentDisplays(layout); event_filter()->ShowSharedEdgeIndicator(root_windows[0] /* primary */); EXPECT_EQ("359,16 1x344", event_filter()->src_indicator_bounds_.ToString()); EXPECT_EQ("360,0 1x360", event_filter()->dst_indicator_bounds_.ToString()); @@ -232,7 +230,7 @@ TEST_F(MouseCursorEventFilterTest, IndicatorBoundsTestOnRight) { // Move 2nd display downwards a bit. layout.offset = 5; - controller->SetLayoutForCurrentDisplays(layout); + display_manager->SetLayoutForCurrentDisplays(layout); event_filter()->ShowSharedEdgeIndicator(root_windows[0] /* primary */); // This is same as before because the 2nd display's y is above // the indicator's x. @@ -245,7 +243,7 @@ TEST_F(MouseCursorEventFilterTest, IndicatorBoundsTestOnRight) { // Move it down further so that the shared edge is shorter than // minimum hole size (160). layout.offset = 200; - controller->SetLayoutForCurrentDisplays(layout); + display_manager->SetLayoutForCurrentDisplays(layout); event_filter()->ShowSharedEdgeIndicator(root_windows[0] /* primary */); EXPECT_EQ("359,200 1x160", event_filter()->src_indicator_bounds_.ToString()); EXPECT_EQ("360,200 1x160", event_filter()->dst_indicator_bounds_.ToString()); @@ -255,7 +253,7 @@ TEST_F(MouseCursorEventFilterTest, IndicatorBoundsTestOnRight) { // Now move 2nd display upwards layout.offset = -5; - controller->SetLayoutForCurrentDisplays(layout); + display_manager->SetLayoutForCurrentDisplays(layout); event_filter()->ShowSharedEdgeIndicator(root_windows[0] /* primary */); EXPECT_EQ("359,16 1x344", event_filter()->src_indicator_bounds_.ToString()); EXPECT_EQ("360,0 1x360", event_filter()->dst_indicator_bounds_.ToString()); @@ -275,10 +273,9 @@ TEST_F(MouseCursorEventFilterTest, IndicatorBoundsTestOnLeft) { UpdateDisplay("360x360,700x700"); Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); - DisplayController* controller = - Shell::GetInstance()->display_controller(); + DisplayManager* display_manager = Shell::GetInstance()->display_manager(); DisplayLayout layout(DisplayLayout::LEFT, 0); - controller->SetLayoutForCurrentDisplays(layout); + display_manager->SetLayoutForCurrentDisplays(layout); event_filter()->ShowSharedEdgeIndicator(root_windows[0] /* primary */); EXPECT_EQ("0,16 1x344", event_filter()->src_indicator_bounds_.ToString()); EXPECT_EQ("-1,0 1x360", event_filter()->dst_indicator_bounds_.ToString()); @@ -287,7 +284,7 @@ TEST_F(MouseCursorEventFilterTest, IndicatorBoundsTestOnLeft) { EXPECT_EQ("0,0 1x360", event_filter()->dst_indicator_bounds_.ToString()); layout.offset = 250; - controller->SetLayoutForCurrentDisplays(layout); + display_manager->SetLayoutForCurrentDisplays(layout); event_filter()->ShowSharedEdgeIndicator(root_windows[0] /* primary */); EXPECT_EQ("0,250 1x110", event_filter()->src_indicator_bounds_.ToString()); EXPECT_EQ("-1,250 1x110", event_filter()->dst_indicator_bounds_.ToString()); @@ -304,10 +301,9 @@ TEST_F(MouseCursorEventFilterTest, IndicatorBoundsTestOnTopBottom) { UpdateDisplay("360x360,700x700"); Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); - DisplayController* controller = - Shell::GetInstance()->display_controller(); + DisplayManager* display_manager = Shell::GetInstance()->display_manager(); DisplayLayout layout(DisplayLayout::TOP, 0); - controller->SetLayoutForCurrentDisplays(layout); + display_manager->SetLayoutForCurrentDisplays(layout); event_filter()->ShowSharedEdgeIndicator(root_windows[0] /* primary */); EXPECT_EQ("0,0 360x1", event_filter()->src_indicator_bounds_.ToString()); EXPECT_EQ("0,-1 360x1", event_filter()->dst_indicator_bounds_.ToString()); @@ -316,7 +312,7 @@ TEST_F(MouseCursorEventFilterTest, IndicatorBoundsTestOnTopBottom) { EXPECT_EQ("0,0 360x1", event_filter()->dst_indicator_bounds_.ToString()); layout.offset = 250; - controller->SetLayoutForCurrentDisplays(layout); + display_manager->SetLayoutForCurrentDisplays(layout); event_filter()->ShowSharedEdgeIndicator(root_windows[0] /* primary */); EXPECT_EQ("250,0 110x1", event_filter()->src_indicator_bounds_.ToString()); EXPECT_EQ("250,-1 110x1", event_filter()->dst_indicator_bounds_.ToString()); @@ -326,7 +322,7 @@ TEST_F(MouseCursorEventFilterTest, IndicatorBoundsTestOnTopBottom) { layout.position = DisplayLayout::BOTTOM; layout.offset = 0; - controller->SetLayoutForCurrentDisplays(layout); + display_manager->SetLayoutForCurrentDisplays(layout); event_filter()->ShowSharedEdgeIndicator(root_windows[0] /* primary */); EXPECT_EQ("0,359 360x1", event_filter()->src_indicator_bounds_.ToString()); EXPECT_EQ("0,360 360x1", event_filter()->dst_indicator_bounds_.ToString()); @@ -345,9 +341,8 @@ TEST_F(MouseCursorEventFilterTest, CursorDeviceScaleFactor) { return; UpdateDisplay("400x400,800x800*2"); - DisplayController* controller = - Shell::GetInstance()->display_controller(); - controller->SetLayoutForCurrentDisplays( + DisplayManager* display_manager = Shell::GetInstance()->display_manager(); + display_manager->SetLayoutForCurrentDisplays( DisplayLayout(DisplayLayout::RIGHT, 0)); Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); ASSERT_EQ(2U, root_windows.size()); diff --git a/ash/display/root_window_transformers_unittest.cc b/ash/display/root_window_transformers_unittest.cc index b300036..9cb362e 100644 --- a/ash/display/root_window_transformers_unittest.cc +++ b/ash/display/root_window_transformers_unittest.cc @@ -4,7 +4,6 @@ #include "ash/display/root_window_transformers.h" -#include "ash/display/display_controller.h" #include "ash/display/display_info.h" #include "ash/display/display_manager.h" #include "ash/launcher/launcher.h" @@ -134,8 +133,6 @@ typedef test::AshTestBase RootWindowTransformersTest; #endif TEST_F(RootWindowTransformersTest, MAYBE_RotateAndMagnify) { - DisplayController* display_controller = - Shell::GetInstance()->display_controller(); MagnificationController* magnifier = Shell::GetInstance()->magnification_controller(); DisplayManager* display_manager = Shell::GetInstance()->display_manager(); @@ -185,7 +182,7 @@ TEST_F(RootWindowTransformersTest, MAYBE_RotateAndMagnify) { magnifier->SetEnabled(false); DisplayLayout display_layout(DisplayLayout::BOTTOM, 50); - display_controller->SetLayoutForCurrentDisplays(display_layout); + display_manager->SetLayoutForCurrentDisplays(display_layout); EXPECT_EQ("50,120 150x200", ScreenAsh::GetSecondaryDisplay().bounds().ToString()); diff --git a/ash/display/screen_position_controller_unittest.cc b/ash/display/screen_position_controller_unittest.cc index 260590a..680ee83 100644 --- a/ash/display/screen_position_controller_unittest.cc +++ b/ash/display/screen_position_controller_unittest.cc @@ -4,7 +4,7 @@ #include "ash/display/screen_position_controller.h" -#include "ash/display/display_controller.h" +#include "ash/display/display_manager.h" #include "ash/screen_ash.h" #include "ash/shell.h" #include "ash/test/ash_test_base.h" @@ -37,7 +37,7 @@ void SetSecondaryDisplayLayout(DisplayLayout::Position position) { DisplayLayout layout = Shell::GetInstance()->display_manager()->GetCurrentDisplayLayout(); layout.position = position; - Shell::GetInstance()->display_controller()-> + Shell::GetInstance()->display_manager()-> SetLayoutForCurrentDisplays(layout); } |