diff options
109 files changed, 588 insertions, 513 deletions
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc index e599f0c..dc48523 100644 --- a/ash/accelerators/accelerator_controller.cc +++ b/ash/accelerators/accelerator_controller.cc @@ -379,8 +379,9 @@ void HandleRotateScreen() { return; base::RecordAction(UserMetricsAction("Accel_Rotate_Window")); - gfx::Point point = Shell::GetScreen()->GetCursorScreenPoint(); - gfx::Display display = Shell::GetScreen()->GetDisplayNearestPoint(point); + gfx::Point point = gfx::Screen::GetScreen()->GetCursorScreenPoint(); + gfx::Display display = + gfx::Screen::GetScreen()->GetDisplayNearestPoint(point); const DisplayInfo& display_info = Shell::GetInstance()->display_manager()->GetDisplayInfo(display.id()); ash::ScreenRotationAnimator(display.id()) diff --git a/ash/accelerators/accelerator_controller_unittest.cc b/ash/accelerators/accelerator_controller_unittest.cc index 5967a04..b2eb9ca 100644 --- a/ash/accelerators/accelerator_controller_unittest.cc +++ b/ash/accelerators/accelerator_controller_unittest.cc @@ -646,8 +646,9 @@ TEST_F(AcceleratorControllerTest, CenterWindowAccelerator) { // Center the window using accelerator. GetController()->PerformActionIfEnabled(WINDOW_POSITION_CENTER); - gfx::Rect work_area = - Shell::GetScreen()->GetDisplayNearestWindow(window.get()).work_area(); + gfx::Rect work_area = gfx::Screen::GetScreen() + ->GetDisplayNearestWindow(window.get()) + .work_area(); gfx::Rect bounds = window->GetBoundsInScreen(); EXPECT_NEAR(bounds.x() - work_area.x(), work_area.right() - bounds.right(), diff --git a/ash/content/keyboard_overlay/keyboard_overlay_delegate.cc b/ash/content/keyboard_overlay/keyboard_overlay_delegate.cc index 91f299a..fe0a5c3 100644 --- a/ash/content/keyboard_overlay/keyboard_overlay_delegate.cc +++ b/ash/content/keyboard_overlay/keyboard_overlay_delegate.cc @@ -77,7 +77,7 @@ views::Widget* KeyboardOverlayDelegate::Show(views::WebDialogView* view) { gfx::Size size; GetDialogSize(&size); const gfx::Rect& rect = - Shell::GetScreen() + gfx::Screen::GetScreen() ->GetDisplayNearestWindow(widget_->GetNativeView()) .work_area(); gfx::Rect bounds(rect.x() + (rect.width() - size.width()) / 2, @@ -108,7 +108,7 @@ void KeyboardOverlayDelegate::GetWebUIMessageHandlers( void KeyboardOverlayDelegate::GetDialogSize(gfx::Size* size) const { using std::min; DCHECK(widget_); - gfx::Rect rect = ash::Shell::GetScreen() + gfx::Rect rect = gfx::Screen::GetScreen() ->GetDisplayNearestWindow(widget_->GetNativeView()) .work_area(); const int width = min(kBaseWidth, rect.width() - kHorizontalMargin); diff --git a/ash/content/keyboard_overlay/keyboard_overlay_delegate_unittest.cc b/ash/content/keyboard_overlay/keyboard_overlay_delegate_unittest.cc index ff206b3..124513a 100644 --- a/ash/content/keyboard_overlay/keyboard_overlay_delegate_unittest.cc +++ b/ash/content/keyboard_overlay/keyboard_overlay_delegate_unittest.cc @@ -48,7 +48,8 @@ TEST_P(KeyboardOverlayDelegateTest, ShowAndClose) { widget->GetNativeWindow()->GetRootWindow()); // The widget is horizontally centered at the bottom of the work area. - gfx::Rect work_area = Shell::GetScreen()->GetPrimaryDisplay().work_area(); + gfx::Rect work_area = + gfx::Screen::GetScreen()->GetPrimaryDisplay().work_area(); gfx::Rect bounds = widget->GetRestoredBounds(); EXPECT_EQ(work_area.CenterPoint().x(), bounds.CenterPoint().x()); EXPECT_EQ(work_area.bottom(), bounds.bottom()); diff --git a/ash/desktop_background/desktop_background_controller.cc b/ash/desktop_background/desktop_background_controller.cc index a002f6b..b19e98f 100644 --- a/ash/desktop_background/desktop_background_controller.cc +++ b/ash/desktop_background/desktop_background_controller.cc @@ -29,6 +29,7 @@ #include "ui/gfx/codec/jpeg_codec.h" #include "ui/gfx/geometry/rect.h" #include "ui/gfx/image/image_skia.h" +#include "ui/gfx/screen.h" #include "ui/views/widget/widget.h" using wallpaper::WallpaperResizer; @@ -162,7 +163,8 @@ void DesktopBackgroundController::OnRootWindowAdded(aura::Window* root_window) { gfx::Size DesktopBackgroundController::GetMaxDisplaySizeInNative() { int width = 0; int height = 0; - std::vector<gfx::Display> displays = Shell::GetScreen()->GetAllDisplays(); + std::vector<gfx::Display> displays = + gfx::Screen::GetScreen()->GetAllDisplays(); DisplayManager* display_manager = Shell::GetInstance()->display_manager(); for (std::vector<gfx::Display>::iterator iter = displays.begin(); diff --git a/ash/desktop_background/desktop_background_view.cc b/ash/desktop_background/desktop_background_view.cc index afa536e..1a915a2 100644 --- a/ash/desktop_background/desktop_background_view.cc +++ b/ash/desktop_background/desktop_background_view.cc @@ -25,6 +25,7 @@ #include "ui/gfx/geometry/safe_integer_conversions.h" #include "ui/gfx/geometry/size_conversions.h" #include "ui/gfx/image/image.h" +#include "ui/gfx/screen.h" #include "ui/gfx/transform.h" #include "ui/views/widget/widget.h" @@ -52,7 +53,7 @@ class LayerControlView : public views::View { // Overrides views::View. void Layout() override { - gfx::Display display = Shell::GetScreen()->GetDisplayNearestWindow( + gfx::Display display = gfx::Screen::GetScreen()->GetDisplayNearestWindow( GetWidget()->GetNativeView()); DisplayManager* display_manager = Shell::GetInstance()->display_manager(); DisplayInfo info = display_manager->GetDisplayInfo(display.id()); diff --git a/ash/dip_unittest.cc b/ash/dip_unittest.cc index a922da4..fc0066a 100644 --- a/ash/dip_unittest.cc +++ b/ash/dip_unittest.cc @@ -37,7 +37,7 @@ TEST_F(DIPTest, WorkArea) { aura::Window* root = Shell::GetPrimaryRootWindow(); const gfx::Display display = - Shell::GetScreen()->GetDisplayNearestWindow(root); + gfx::Screen::GetScreen()->GetDisplayNearestWindow(root); EXPECT_EQ("0,0 1000x900", display.bounds().ToString()); gfx::Rect work_area = display.work_area(); @@ -45,7 +45,7 @@ TEST_F(DIPTest, WorkArea) { EXPECT_EQ("0,0,47,0", display.bounds().InsetsFrom(work_area).ToString()); UpdateDisplay("2000x1800*2.0f"); - gfx::Screen* screen = Shell::GetScreen(); + gfx::Screen* screen = gfx::Screen::GetScreen(); const gfx::Display display_2x = screen->GetDisplayNearestWindow(root); const DisplayInfo display_info_2x = diff --git a/ash/display/cursor_window_controller.cc b/ash/display/cursor_window_controller.cc index eb334b8..fb0bff9 100644 --- a/ash/display/cursor_window_controller.cc +++ b/ash/display/cursor_window_controller.cc @@ -23,6 +23,7 @@ #include "ui/gfx/geometry/dip_util.h" #include "ui/gfx/image/image_skia.h" #include "ui/gfx/image/image_skia_operations.h" +#include "ui/gfx/screen.h" namespace ash { @@ -101,7 +102,7 @@ void CursorWindowController::SetCursorCompositingEnabled(bool enabled) { void CursorWindowController::UpdateContainer() { if (is_cursor_compositing_enabled_) { - gfx::Screen* screen = Shell::GetScreen(); + gfx::Screen* screen = gfx::Screen::GetScreen(); gfx::Display display = screen->GetDisplayNearestPoint( screen->GetCursorScreenPoint()); DCHECK(display.is_valid()); @@ -113,7 +114,7 @@ void CursorWindowController::UpdateContainer() { ->mirror_window_controller() ->GetWindow(); if (mirror_window) - display_ = Shell::GetScreen()->GetPrimaryDisplay(); + display_ = gfx::Screen::GetScreen()->GetPrimaryDisplay(); SetContainer(mirror_window); } // Updates the hot point based on the current display. diff --git a/ash/display/cursor_window_controller_unittest.cc b/ash/display/cursor_window_controller_unittest.cc index 5640bb1..3311095 100644 --- a/ash/display/cursor_window_controller_unittest.cc +++ b/ash/display/cursor_window_controller_unittest.cc @@ -154,17 +154,19 @@ TEST_F(CursorWindowControllerTest, VisibilityTest) { // the DSF becomes 1x as a result of zooming out. TEST_F(CursorWindowControllerTest, DSF) { UpdateDisplay("1000x500*2"); - int64_t primary_id = Shell::GetScreen()->GetPrimaryDisplay().id(); + int64_t primary_id = gfx::Screen::GetScreen()->GetPrimaryDisplay().id(); test::ScopedSetInternalDisplayId set_internal(primary_id); SetCursorCompositionEnabled(true); - ASSERT_EQ(2.0f, - Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor()); + ASSERT_EQ( + 2.0f, + gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor()); EXPECT_TRUE(GetCursorImage().HasRepresentation(2.0f)); ASSERT_TRUE(SetDisplayUIScale(primary_id, 2.0f)); - ASSERT_EQ(1.0f, - Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor()); + ASSERT_EQ( + 1.0f, + gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor()); EXPECT_TRUE(GetCursorImage().HasRepresentation(2.0f)); } #endif diff --git a/ash/display/display_manager_unittest.cc b/ash/display/display_manager_unittest.cc index d773c08..4bad4eb 100644 --- a/ash/display/display_manager_unittest.cc +++ b/ash/display/display_manager_unittest.cc @@ -59,12 +59,12 @@ class DisplayManagerTest : public test::AshTestBase, void SetUp() override { AshTestBase::SetUp(); - Shell::GetScreen()->AddObserver(this); + gfx::Screen::GetScreen()->AddObserver(this); Shell::GetPrimaryRootWindow()->AddObserver(this); } void TearDown() override { Shell::GetPrimaryRootWindow()->RemoveObserver(this); - Shell::GetScreen()->RemoveObserver(this); + gfx::Screen::GetScreen()->RemoveObserver(this); AshTestBase::TearDown(); } @@ -415,31 +415,32 @@ TEST_F(DisplayManagerTest, OverscanInsetsTest) { GetDisplayInfo(ScreenUtil::GetSecondaryDisplay()). bounds_in_native().ToString()); EXPECT_EQ("0,501 400x400", - GetDisplayInfo(Shell::GetScreen()->GetPrimaryDisplay()). - bounds_in_native().ToString()); + GetDisplayInfo(gfx::Screen::GetScreen()->GetPrimaryDisplay()) + .bounds_in_native() + .ToString()); EXPECT_EQ("0,0 188x190", - Shell::GetScreen()->GetPrimaryDisplay().bounds().ToString()); + gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds().ToString()); // Make sure just moving the overscan area should property notify observers. UpdateDisplay("0+0-500x500"); - int64_t primary_id = Shell::GetScreen()->GetPrimaryDisplay().id(); + int64_t primary_id = gfx::Screen::GetScreen()->GetPrimaryDisplay().id(); display_manager()->SetOverscanInsets(primary_id, gfx::Insets(0, 0, 20, 20)); EXPECT_EQ("0,0 480x480", - Shell::GetScreen()->GetPrimaryDisplay().bounds().ToString()); + gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds().ToString()); reset(); display_manager()->SetOverscanInsets(primary_id, gfx::Insets(10, 10, 10, 10)); EXPECT_TRUE(changed_metrics() & gfx::DisplayObserver::DISPLAY_METRIC_BOUNDS); EXPECT_TRUE( changed_metrics() & gfx::DisplayObserver::DISPLAY_METRIC_WORK_AREA); EXPECT_EQ("0,0 480x480", - Shell::GetScreen()->GetPrimaryDisplay().bounds().ToString()); + gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds().ToString()); reset(); display_manager()->SetOverscanInsets(primary_id, gfx::Insets(0, 0, 0, 0)); EXPECT_TRUE(changed_metrics() & gfx::DisplayObserver::DISPLAY_METRIC_BOUNDS); EXPECT_TRUE( changed_metrics() & gfx::DisplayObserver::DISPLAY_METRIC_WORK_AREA); EXPECT_EQ("0,0 500x500", - Shell::GetScreen()->GetPrimaryDisplay().bounds().ToString()); + gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds().ToString()); } TEST_F(DisplayManagerTest, ZeroOverscanInsets) { @@ -530,7 +531,7 @@ TEST_F(DisplayManagerTest, TestNativeDisplaysChanged) { GetDisplayInfoForId(external_id).bounds_in_native().ToString()); EXPECT_EQ(1U, display_manager()->num_connected_displays()); EXPECT_FALSE(display_manager()->IsInMirrorMode()); - EXPECT_EQ(external_id, Shell::GetScreen()->GetPrimaryDisplay().id()); + EXPECT_EQ(external_id, gfx::Screen::GetScreen()->GetPrimaryDisplay().id()); EXPECT_EQ(internal_display_id, gfx::Display::InternalDisplayId()); @@ -540,7 +541,8 @@ TEST_F(DisplayManagerTest, TestNativeDisplaysChanged) { display_info_list.push_back(external_display_info); display_manager()->OnNativeDisplaysChanged(display_info_list); EXPECT_EQ(2U, display_manager()->GetNumDisplays()); - EXPECT_EQ(internal_display_id, Shell::GetScreen()->GetPrimaryDisplay().id()); + EXPECT_EQ(internal_display_id, + gfx::Screen::GetScreen()->GetPrimaryDisplay().id()); // This combinatino is new, so internal display becomes primary. EXPECT_EQ("0,0 500x500", @@ -955,7 +957,7 @@ TEST_F(DisplayManagerTest, UIScale) { test::ScopedDisable125DSFForUIScaling disable; UpdateDisplay("1280x800"); - int64_t display_id = Shell::GetScreen()->GetPrimaryDisplay().id(); + int64_t display_id = gfx::Screen::GetScreen()->GetPrimaryDisplay().id(); SetDisplayUIScale(display_id, 1.125f); EXPECT_EQ(1.0, GetDisplayInfoAt(0).configured_ui_scale()); SetDisplayUIScale(display_id, 0.8f); @@ -1012,7 +1014,7 @@ TEST_F(DisplayManagerTest, UIScale) { EXPECT_EQ(1.125f, GetDisplayInfoAt(0).configured_ui_scale()); SetDisplayUIScale(display_id, 1.0f); EXPECT_EQ(1.0f, GetDisplayInfoAt(0).configured_ui_scale()); - gfx::Display display = Shell::GetScreen()->GetPrimaryDisplay(); + gfx::Display display = gfx::Screen::GetScreen()->GetPrimaryDisplay(); EXPECT_EQ(2.0f, display.device_scale_factor()); EXPECT_EQ("640x425", display.bounds().size().ToString()); @@ -1030,7 +1032,7 @@ TEST_F(DisplayManagerTest, UIScale) { SetDisplayUIScale(display_id, 2.0f); EXPECT_EQ(2.0f, GetDisplayInfoAt(0).configured_ui_scale()); EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveUIScale()); - display = Shell::GetScreen()->GetPrimaryDisplay(); + display = gfx::Screen::GetScreen()->GetPrimaryDisplay(); EXPECT_EQ(1.0f, display.device_scale_factor()); EXPECT_EQ("1280x850", display.bounds().size().ToString()); @@ -1040,7 +1042,7 @@ TEST_F(DisplayManagerTest, UIScale) { SetDisplayUIScale(display_id, 1.25f); EXPECT_EQ(1.25f, GetDisplayInfoAt(0).configured_ui_scale()); EXPECT_EQ(1.0f, GetDisplayInfoAt(0).GetEffectiveUIScale()); - display = Shell::GetScreen()->GetPrimaryDisplay(); + display = gfx::Screen::GetScreen()->GetPrimaryDisplay(); EXPECT_EQ(1.0f, display.device_scale_factor()); EXPECT_EQ("1280x850", display.bounds().size().ToString()); } @@ -1105,7 +1107,7 @@ TEST_F(DisplayManagerTest, UIScaleWithDisplayMode) { } TEST_F(DisplayManagerTest, Use125DSFForUIScaling) { - int64_t display_id = Shell::GetScreen()->GetPrimaryDisplay().id(); + int64_t display_id = gfx::Screen::GetScreen()->GetPrimaryDisplay().id(); test::ScopedSetInternalDisplayId set_internal(display_id); UpdateDisplay("1920x1080*1.25"); @@ -1139,7 +1141,7 @@ TEST_F(DisplayManagerTest, ResolutionChangeInUnifiedMode) { UpdateDisplay("200x200, 400x400"); - int64_t unified_id = Shell::GetScreen()->GetPrimaryDisplay().id(); + int64_t unified_id = gfx::Screen::GetScreen()->GetPrimaryDisplay().id(); DisplayInfo info = display_manager->GetDisplayInfo(unified_id); ASSERT_EQ(2u, info.display_modes().size()); EXPECT_EQ("400x200", info.display_modes()[0].size.ToString()); @@ -1147,7 +1149,7 @@ TEST_F(DisplayManagerTest, ResolutionChangeInUnifiedMode) { EXPECT_EQ("800x400", info.display_modes()[1].size.ToString()); EXPECT_FALSE(info.display_modes()[1].native); EXPECT_EQ("400x200", - Shell::GetScreen()->GetPrimaryDisplay().size().ToString()); + gfx::Screen::GetScreen()->GetPrimaryDisplay().size().ToString()); DisplayMode active_mode = display_manager->GetActiveModeForDisplayId(unified_id); EXPECT_EQ(1.0f, active_mode.ui_scale); @@ -1155,7 +1157,7 @@ TEST_F(DisplayManagerTest, ResolutionChangeInUnifiedMode) { EXPECT_TRUE(test::SetDisplayResolution(unified_id, gfx::Size(800, 400))); EXPECT_EQ("800x400", - Shell::GetScreen()->GetPrimaryDisplay().size().ToString()); + gfx::Screen::GetScreen()->GetPrimaryDisplay().size().ToString()); active_mode = display_manager->GetActiveModeForDisplayId(unified_id); EXPECT_EQ(1.0f, active_mode.ui_scale); @@ -1164,7 +1166,7 @@ TEST_F(DisplayManagerTest, ResolutionChangeInUnifiedMode) { // resolution change will not persist in unified desktop mode. UpdateDisplay("600x600, 200x200"); EXPECT_EQ("1200x600", - Shell::GetScreen()->GetPrimaryDisplay().size().ToString()); + gfx::Screen::GetScreen()->GetPrimaryDisplay().size().ToString()); active_mode = display_manager->GetActiveModeForDisplayId(unified_id); EXPECT_EQ(1.0f, active_mode.ui_scale); EXPECT_TRUE(active_mode.native); @@ -1270,7 +1272,7 @@ TEST_F(DisplayManagerTest, SoftwareMirroring) { EXPECT_EQ(NULL, test_api.GetHost()); TestDisplayObserver display_observer; - Shell::GetScreen()->AddObserver(&display_observer); + gfx::Screen::GetScreen()->AddObserver(&display_observer); DisplayManager* display_manager = Shell::GetInstance()->display_manager(); display_manager->SetMultiDisplayMode(DisplayManager::MIRRORING); @@ -1279,7 +1281,7 @@ TEST_F(DisplayManagerTest, SoftwareMirroring) { EXPECT_TRUE(display_observer.changed_and_reset()); EXPECT_EQ(1U, display_manager->GetNumDisplays()); EXPECT_EQ("0,0 300x400", - Shell::GetScreen()->GetPrimaryDisplay().bounds().ToString()); + gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds().ToString()); EXPECT_EQ("400x500", test_api.GetHost()->GetBounds().size().ToString()); EXPECT_EQ("300x400", test_api.GetHost()->window()->bounds().size().ToString()); @@ -1322,7 +1324,7 @@ TEST_F(DisplayManagerTest, SoftwareMirroring) { EXPECT_EQ("400x600", test_api.GetHost()->window()->bounds().size().ToString()); - Shell::GetScreen()->RemoveObserver(&display_observer); + gfx::Screen::GetScreen()->RemoveObserver(&display_observer); } TEST_F(DisplayManagerTest, SingleDisplayToSoftwareMirroring) { @@ -1395,17 +1397,17 @@ TEST_F(DisplayManagerTest, MirroredLayout) { DisplayManager* display_manager = Shell::GetInstance()->display_manager(); UpdateDisplay("500x500,400x400"); EXPECT_FALSE(display_manager->GetCurrentDisplayLayout().mirrored); - EXPECT_EQ(2, Shell::GetScreen()->GetNumDisplays()); + EXPECT_EQ(2, gfx::Screen::GetScreen()->GetNumDisplays()); EXPECT_EQ(2U, display_manager->num_connected_displays()); UpdateDisplay("1+0-500x500,1+0-500x500"); EXPECT_TRUE(display_manager->GetCurrentDisplayLayout().mirrored); - EXPECT_EQ(1, Shell::GetScreen()->GetNumDisplays()); + EXPECT_EQ(1, gfx::Screen::GetScreen()->GetNumDisplays()); EXPECT_EQ(2U, display_manager->num_connected_displays()); UpdateDisplay("500x500,500x500"); EXPECT_FALSE(display_manager->GetCurrentDisplayLayout().mirrored); - EXPECT_EQ(2, Shell::GetScreen()->GetNumDisplays()); + EXPECT_EQ(2, gfx::Screen::GetScreen()->GetNumDisplays()); EXPECT_EQ(2U, display_manager->num_connected_displays()); } @@ -1491,7 +1493,7 @@ TEST_F(DisplayManagerTest, NotifyPrimaryChangeUndock) { TEST_F(DisplayManagerTest, MAYBE_UpdateDisplayWithHostOrigin) { UpdateDisplay("100x200,300x400"); - ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays()); + ASSERT_EQ(2, gfx::Screen::GetScreen()->GetNumDisplays()); aura::Window::Windows root_windows = Shell::GetInstance()->GetAllRootWindows(); ASSERT_EQ(2U, root_windows.size()); @@ -1505,21 +1507,21 @@ TEST_F(DisplayManagerTest, MAYBE_UpdateDisplayWithHostOrigin) { EXPECT_EQ("300x400", host1->GetBounds().size().ToString()); UpdateDisplay("100x200,200+300-300x400"); - ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays()); + ASSERT_EQ(2, gfx::Screen::GetScreen()->GetNumDisplays()); EXPECT_EQ("0,0", host0->GetBounds().origin().ToString()); EXPECT_EQ("100x200", host0->GetBounds().size().ToString()); EXPECT_EQ("200,300", host1->GetBounds().origin().ToString()); EXPECT_EQ("300x400", host1->GetBounds().size().ToString()); UpdateDisplay("400+500-200x300,300x400"); - ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays()); + ASSERT_EQ(2, gfx::Screen::GetScreen()->GetNumDisplays()); EXPECT_EQ("400,500", host0->GetBounds().origin().ToString()); EXPECT_EQ("200x300", host0->GetBounds().size().ToString()); EXPECT_EQ("0,0", host1->GetBounds().origin().ToString()); EXPECT_EQ("300x400", host1->GetBounds().size().ToString()); UpdateDisplay("100+200-100x200,300+500-200x300"); - ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays()); + ASSERT_EQ(2, gfx::Screen::GetScreen()->GetNumDisplays()); EXPECT_EQ("100,200", host0->GetBounds().origin().ToString()); EXPECT_EQ("100x200", host0->GetBounds().size().ToString()); EXPECT_EQ("300,500", host1->GetBounds().origin().ToString()); @@ -1924,7 +1926,8 @@ typedef testing::Test DisplayManagerFontTest; TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf100Internal) { FontTestHelper helper(1.0f, FontTestHelper::INTERNAL); ASSERT_DOUBLE_EQ( - 1.0f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor()); + 1.0f, + gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor()); EXPECT_FALSE(IsTextSubpixelPositioningEnabled()); EXPECT_NE(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams()); } @@ -1933,7 +1936,8 @@ TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf125Internal) { test::ScopedDisable125DSFForUIScaling disable; FontTestHelper helper(1.25f, FontTestHelper::INTERNAL); ASSERT_DOUBLE_EQ( - 1.25f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor()); + 1.25f, + gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor()); EXPECT_TRUE(IsTextSubpixelPositioningEnabled()); EXPECT_EQ(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams()); } @@ -1941,14 +1945,16 @@ TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf125Internal) { TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf200Internal) { FontTestHelper helper(2.0f, FontTestHelper::INTERNAL); ASSERT_DOUBLE_EQ( - 2.0f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor()); + 2.0f, + gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor()); EXPECT_TRUE(IsTextSubpixelPositioningEnabled()); EXPECT_EQ(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams()); - SetDisplayUIScale(Shell::GetScreen()->GetPrimaryDisplay().id(), 2.0f); + SetDisplayUIScale(gfx::Screen::GetScreen()->GetPrimaryDisplay().id(), 2.0f); ASSERT_DOUBLE_EQ( - 1.0f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor()); + 1.0f, + gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor()); EXPECT_FALSE(IsTextSubpixelPositioningEnabled()); EXPECT_NE(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams()); } @@ -1956,7 +1962,8 @@ TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf200Internal) { TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf100External) { FontTestHelper helper(1.0f, FontTestHelper::EXTERNAL); ASSERT_DOUBLE_EQ( - 1.0f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor()); + 1.0f, + gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor()); EXPECT_FALSE(IsTextSubpixelPositioningEnabled()); EXPECT_NE(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams()); } @@ -1964,7 +1971,8 @@ TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf100External) { TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf125External) { FontTestHelper helper(1.25f, FontTestHelper::EXTERNAL); ASSERT_DOUBLE_EQ( - 1.25f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor()); + 1.25f, + gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor()); EXPECT_TRUE(IsTextSubpixelPositioningEnabled()); EXPECT_EQ(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams()); } @@ -1972,7 +1980,8 @@ TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf125External) { TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf200External) { FontTestHelper helper(2.0f, FontTestHelper::EXTERNAL); ASSERT_DOUBLE_EQ( - 2.0f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor()); + 2.0f, + gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor()); EXPECT_TRUE(IsTextSubpixelPositioningEnabled()); EXPECT_EQ(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams()); } @@ -1981,14 +1990,16 @@ TEST_F(DisplayManagerFontTest, TextSubpixelPositioningWithDsf125InternalWithScaling) { FontTestHelper helper(1.25f, FontTestHelper::INTERNAL); ASSERT_DOUBLE_EQ( - 1.0f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor()); + 1.0f, + gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor()); EXPECT_FALSE(IsTextSubpixelPositioningEnabled()); EXPECT_NE(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams()); - SetDisplayUIScale(Shell::GetScreen()->GetPrimaryDisplay().id(), 0.8f); + SetDisplayUIScale(gfx::Screen::GetScreen()->GetPrimaryDisplay().id(), 0.8f); ASSERT_DOUBLE_EQ( - 1.25f, Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor()); + 1.25f, + gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor()); EXPECT_TRUE(IsTextSubpixelPositioningEnabled()); EXPECT_EQ(gfx::FontRenderParams::HINTING_NONE, GetFontHintingParams()); } diff --git a/ash/display/event_transformation_handler.cc b/ash/display/event_transformation_handler.cc index e1af21f..484a20a 100644 --- a/ash/display/event_transformation_handler.cc +++ b/ash/display/event_transformation_handler.cc @@ -8,7 +8,6 @@ #include "ash/display/display_info.h" #include "ash/display/display_manager.h" -#include "ash/shell.h" #include "ash/wm/window_util.h" #include "ui/aura/window.h" #include "ui/aura/window_event_dispatcher.h" @@ -43,7 +42,7 @@ void EventTransformationHandler::OnScrollEvent(ui::ScrollEvent* event) { aura::Window* target = static_cast<aura::Window*>(event->target()); ::wm::ConvertPointToScreen(target, &point_in_screen); const gfx::Display& display = - Shell::GetScreen()->GetDisplayNearestPoint(point_in_screen); + gfx::Screen::GetScreen()->GetDisplayNearestPoint(point_in_screen); // Apply some additional scaling if the display is non-integrated. if (!display.IsInternal()) diff --git a/ash/display/extended_mouse_warp_controller.cc b/ash/display/extended_mouse_warp_controller.cc index f17444b..3d28c5f 100644 --- a/ash/display/extended_mouse_warp_controller.cc +++ b/ash/display/extended_mouse_warp_controller.cc @@ -42,7 +42,7 @@ aura::Window* GetRootWindowForDisplayId(int64_t display_id) { // Helper method that maps an aura::Window to a gfx::Display. gfx::Display GetDisplayFromWindow(aura::Window* window) { - return Shell::GetScreen()->GetDisplayNearestWindow(window); + return gfx::Screen::GetScreen()->GetDisplayNearestWindow(window); } } // namespace @@ -94,7 +94,7 @@ ExtendedMouseWarpController::ExtendedMouseWarpController( // display. DisplayLayout::Position is defined in terms of primary. DisplayLayout::Position position = display_manager->GetCurrentDisplayLayout().position; - const gfx::Display& a = Shell::GetScreen()->GetPrimaryDisplay(); + const gfx::Display& a = gfx::Screen::GetScreen()->GetPrimaryDisplay(); const gfx::Display& b = ScreenUtil::GetSecondaryDisplay(); // TODO(oshima): Use ComputeBondary instead. @@ -112,7 +112,7 @@ ExtendedMouseWarpController::~ExtendedMouseWarpController() { } bool ExtendedMouseWarpController::WarpMouseCursor(ui::MouseEvent* event) { - if (Shell::GetScreen()->GetNumDisplays() <= 1 || !enabled_) + if (gfx::Screen::GetScreen()->GetNumDisplays() <= 1 || !enabled_) return false; aura::Window* target = static_cast<aura::Window*>(event->target()); diff --git a/ash/display/mirror_window_controller.cc b/ash/display/mirror_window_controller.cc index df57174..c93bba0 100644 --- a/ash/display/mirror_window_controller.cc +++ b/ash/display/mirror_window_controller.cc @@ -35,6 +35,7 @@ #include "ui/compositor/reflector.h" #include "ui/gfx/canvas.h" #include "ui/gfx/native_widget_types.h" +#include "ui/gfx/screen.h" #if defined(USE_X11) #include "ui/gfx/x/x11_types.h" @@ -159,7 +160,7 @@ void MirrorWindowController::UpdateWindow( const std::vector<DisplayInfo>& display_info_list) { static int mirror_host_count = 0; DisplayManager* display_manager = Shell::GetInstance()->display_manager(); - const gfx::Display& primary = Shell::GetScreen()->GetPrimaryDisplay(); + const gfx::Display& primary = gfx::Screen::GetScreen()->GetPrimaryDisplay(); const DisplayInfo& source_display_info = display_manager->GetDisplayInfo(primary.id()); @@ -214,7 +215,7 @@ void MirrorWindowController::UpdateWindow( Shell::GetInstance() ->window_tree_host_manager() ->GetAshWindowTreeHostForDisplayId( - Shell::GetScreen()->GetPrimaryDisplay().id()); + gfx::Screen::GetScreen()->GetPrimaryDisplay().id()); unified_ash_host->RegisterMirroringHost(host_info->ash_host.get()); aura::client::SetScreenPositionClient(host->window(), screen_position_client_.get()); diff --git a/ash/display/resolution_notification_controller.cc b/ash/display/resolution_notification_controller.cc index 609b4ea0..9f50d1c 100644 --- a/ash/display/resolution_notification_controller.cc +++ b/ash/display/resolution_notification_controller.cc @@ -152,12 +152,12 @@ ResolutionNotificationController::ResolutionChangeInfo:: ResolutionNotificationController::ResolutionNotificationController() { Shell::GetInstance()->window_tree_host_manager()->AddObserver(this); - Shell::GetScreen()->AddObserver(this); + gfx::Screen::GetScreen()->AddObserver(this); } ResolutionNotificationController::~ResolutionNotificationController() { Shell::GetInstance()->window_tree_host_manager()->RemoveObserver(this); - Shell::GetScreen()->RemoveObserver(this); + gfx::Screen::GetScreen()->RemoveObserver(this); } void ResolutionNotificationController::PrepareNotification( diff --git a/ash/display/resolution_notification_controller_unittest.cc b/ash/display/resolution_notification_controller_unittest.cc index a6a7f1e..79922fe 100644 --- a/ash/display/resolution_notification_controller_unittest.cc +++ b/ash/display/resolution_notification_controller_unittest.cc @@ -233,7 +233,7 @@ TEST_F(ResolutionNotificationControllerTest, AcceptButton) { ash::Shell::GetInstance()->display_manager(); UpdateDisplay("300x300#300x300%59|200x200%60"); - const gfx::Display& display = ash::Shell::GetScreen()->GetPrimaryDisplay(); + const gfx::Display& display = gfx::Screen::GetScreen()->GetPrimaryDisplay(); SetDisplayResolutionAndNotify(display, gfx::Size(200, 200)); EXPECT_TRUE(IsNotificationVisible()); @@ -298,7 +298,7 @@ TEST_F(ResolutionNotificationControllerTest, Timeout) { return; UpdateDisplay("300x300#300x300%59|200x200%60"); - const gfx::Display& display = ash::Shell::GetScreen()->GetPrimaryDisplay(); + const gfx::Display& display = gfx::Screen::GetScreen()->GetPrimaryDisplay(); SetDisplayResolutionAndNotify(display, gfx::Size(200, 200)); for (int i = 0; i < ResolutionNotificationController::kTimeoutInSec; ++i) { diff --git a/ash/display/root_window_transformers.cc b/ash/display/root_window_transformers.cc index 830cdba..4e3d139 100644 --- a/ash/display/root_window_transformers.cc +++ b/ash/display/root_window_transformers.cc @@ -21,6 +21,7 @@ #include "ui/gfx/display.h" #include "ui/gfx/geometry/insets.h" #include "ui/gfx/geometry/size_conversions.h" +#include "ui/gfx/screen.h" #include "ui/gfx/transform.h" #include "ui/gfx/transform.h" @@ -279,7 +280,7 @@ class PartialBoundsRootWindowTransformer : public RootWindowTransformer { PartialBoundsRootWindowTransformer(const gfx::Rect& screen_bounds, const gfx::Display& display) { gfx::Display unified_display = - Shell::GetInstance()->GetScreen()->GetPrimaryDisplay(); + gfx::Screen::GetScreen()->GetPrimaryDisplay(); DisplayInfo display_info = Shell::GetInstance()->display_manager()->GetDisplayInfo(display.id()); root_bounds_ = gfx::Rect(display_info.bounds_in_native().size()); diff --git a/ash/display/root_window_transformers_unittest.cc b/ash/display/root_window_transformers_unittest.cc index cf16d70..1da6c92 100644 --- a/ash/display/root_window_transformers_unittest.cc +++ b/ash/display/root_window_transformers_unittest.cc @@ -120,7 +120,7 @@ CreateCurrentRootWindowTransformerForMirroring() { const DisplayInfo& mirror_display_info = display_manager->GetDisplayInfo(display_manager->mirroring_display_id()); const DisplayInfo& source_display_info = display_manager->GetDisplayInfo( - Shell::GetScreen()->GetPrimaryDisplay().id()); + gfx::Screen::GetScreen()->GetPrimaryDisplay().id()); return scoped_ptr<RootWindowTransformer>( CreateRootWindowTransformerForMirroredDisplay(source_display_info, mirror_display_info)); @@ -151,7 +151,7 @@ TEST_F(RootWindowTransformersTest, MAYBE_RotateAndMagnify) { Shell::GetInstance()->AddPreTargetHandler(&event_handler); UpdateDisplay("120x200,300x400*2"); - gfx::Display display1 = Shell::GetScreen()->GetPrimaryDisplay(); + gfx::Display display1 = gfx::Screen::GetScreen()->GetPrimaryDisplay(); int64_t display2_id = ScreenUtil::GetSecondaryDisplay().id(); aura::Window::Windows root_windows = Shell::GetAllRootWindows(); @@ -243,7 +243,7 @@ TEST_F(RootWindowTransformersTest, ScaleAndMagnify) { UpdateDisplay("600x400*2@1.5,500x300"); - gfx::Display display1 = Shell::GetScreen()->GetPrimaryDisplay(); + gfx::Display display1 = gfx::Screen::GetScreen()->GetPrimaryDisplay(); test::ScopedSetInternalDisplayId set_internal(display1.id()); gfx::Display display2 = ScreenUtil::GetSecondaryDisplay(); aura::Window::Windows root_windows = Shell::GetAllRootWindows(); @@ -264,7 +264,7 @@ TEST_F(RootWindowTransformersTest, ScaleAndMagnify) { magnifier->SetEnabled(false); SetDisplayUIScale(display1.id(), 1.25f); - display1 = Shell::GetScreen()->GetPrimaryDisplay(); + display1 = gfx::Screen::GetScreen()->GetPrimaryDisplay(); display2 = ScreenUtil::GetSecondaryDisplay(); magnifier->SetEnabled(true); EXPECT_EQ(2.0f, magnifier->GetScale()); @@ -283,7 +283,7 @@ TEST_F(RootWindowTransformersTest, MAYBE_TouchScaleAndMagnify) { Shell::GetInstance()->AddPreTargetHandler(&event_handler); UpdateDisplay("200x200*2"); - gfx::Display display = Shell::GetScreen()->GetPrimaryDisplay(); + gfx::Display display = gfx::Screen::GetScreen()->GetPrimaryDisplay(); aura::Window::Windows root_windows = Shell::GetAllRootWindows(); aura::Window* root_window = root_windows[0]; ui::test::EventGenerator generator(root_window); @@ -323,7 +323,7 @@ TEST_F(RootWindowTransformersTest, MAYBE_ConvertHostToRootCoords) { // Test 1 UpdateDisplay("600x400*2/r@1.5"); - gfx::Display display1 = Shell::GetScreen()->GetPrimaryDisplay(); + gfx::Display display1 = gfx::Screen::GetScreen()->GetPrimaryDisplay(); aura::Window::Windows root_windows = Shell::GetAllRootWindows(); EXPECT_EQ("0,0 300x450", display1.bounds().ToString()); EXPECT_EQ("0,0 300x450", root_windows[0]->bounds().ToString()); @@ -349,7 +349,7 @@ TEST_F(RootWindowTransformersTest, MAYBE_ConvertHostToRootCoords) { // Test 2 UpdateDisplay("600x400*2/u@1.5"); - display1 = Shell::GetScreen()->GetPrimaryDisplay(); + display1 = gfx::Screen::GetScreen()->GetPrimaryDisplay(); root_windows = Shell::GetAllRootWindows(); EXPECT_EQ("0,0 450x300", display1.bounds().ToString()); EXPECT_EQ("0,0 450x300", root_windows[0]->bounds().ToString()); @@ -374,7 +374,7 @@ TEST_F(RootWindowTransformersTest, MAYBE_ConvertHostToRootCoords) { // Test 3 UpdateDisplay("600x400*2/l@1.5"); - display1 = Shell::GetScreen()->GetPrimaryDisplay(); + display1 = gfx::Screen::GetScreen()->GetPrimaryDisplay(); root_windows = Shell::GetAllRootWindows(); EXPECT_EQ("0,0 300x450", display1.bounds().ToString()); EXPECT_EQ("0,0 300x450", root_windows[0]->bounds().ToString()); diff --git a/ash/display/screen_ash.cc b/ash/display/screen_ash.cc index 477c710..d5c33a4 100644 --- a/ash/display/screen_ash.cc +++ b/ash/display/screen_ash.cc @@ -99,7 +99,8 @@ gfx::Point ScreenAsh::GetCursorScreenPoint() { } gfx::NativeWindow ScreenAsh::GetWindowUnderCursor() { - return GetWindowAtScreenPoint(Shell::GetScreen()->GetCursorScreenPoint()); + return GetWindowAtScreenPoint( + gfx::Screen::GetScreen()->GetCursorScreenPoint()); } gfx::NativeWindow ScreenAsh::GetWindowAtScreenPoint(const gfx::Point& point) { diff --git a/ash/display/screen_ash_unittest.cc b/ash/display/screen_ash_unittest.cc index 798b5e6..a60d54f 100644 --- a/ash/display/screen_ash_unittest.cc +++ b/ash/display/screen_ash_unittest.cc @@ -15,8 +15,6 @@ class ScreenAshTest : public test::AshTestBase { ScreenAshTest() {} ~ScreenAshTest() override {} - static gfx::Screen* Screen() { return Shell::GetScreen(); } - private: DISALLOW_COPY_AND_ASSIGN(ScreenAshTest); }; @@ -38,8 +36,10 @@ TEST_F(ScreenAshTest, TestGetWindowAtScreenPoint) { ASSERT_NE(win1->GetRootWindow(), win2->GetRootWindow()); - EXPECT_EQ(win1.get(), Screen()->GetWindowAtScreenPoint(gfx::Point(50, 60))); - EXPECT_EQ(win2.get(), Screen()->GetWindowAtScreenPoint(gfx::Point(250, 260))); + EXPECT_EQ(win1.get(), gfx::Screen::GetScreen()->GetWindowAtScreenPoint( + gfx::Point(50, 60))); + EXPECT_EQ(win2.get(), gfx::Screen::GetScreen()->GetWindowAtScreenPoint( + gfx::Point(250, 260))); } } // namespace ash diff --git a/ash/display/screen_position_controller.cc b/ash/display/screen_position_controller.cc index 9503fd4..2c146a8 100644 --- a/ash/display/screen_position_controller.cc +++ b/ash/display/screen_position_controller.cc @@ -123,8 +123,11 @@ void ScreenPositionController::ConvertPointToScreen( gfx::Point* point) { const aura::Window* root = window->GetRootWindow(); aura::Window::ConvertPointToTarget(window, root, point); - const gfx::Point display_origin = Shell::GetScreen()->GetDisplayNearestWindow( - const_cast<aura::Window*>(root)).bounds().origin(); + const gfx::Point display_origin = + gfx::Screen::GetScreen() + ->GetDisplayNearestWindow(const_cast<aura::Window*>(root)) + .bounds() + .origin(); point->Offset(display_origin.x(), display_origin.y()); } @@ -132,8 +135,11 @@ void ScreenPositionController::ConvertPointFromScreen( const aura::Window* window, gfx::Point* point) { const aura::Window* root = window->GetRootWindow(); - const gfx::Point display_origin = Shell::GetScreen()->GetDisplayNearestWindow( - const_cast<aura::Window*>(root)).bounds().origin(); + const gfx::Point display_origin = + gfx::Screen::GetScreen() + ->GetDisplayNearestWindow(const_cast<aura::Window*>(root)) + .bounds() + .origin(); point->Offset(-display_origin.x(), -display_origin.y()); aura::Window::ConvertPointToTarget(root, window, point); } @@ -222,8 +228,10 @@ void ScreenPositionController::SetBounds(aura::Window* window, } } gfx::Point origin(bounds.origin()); - const gfx::Point display_origin = Shell::GetScreen()->GetDisplayNearestWindow( - window).bounds().origin(); + const gfx::Point display_origin = gfx::Screen::GetScreen() + ->GetDisplayNearestWindow(window) + .bounds() + .origin(); origin.Offset(-display_origin.x(), -display_origin.y()); window->SetBounds(gfx::Rect(origin, bounds.size())); } diff --git a/ash/display/screen_position_controller_unittest.cc b/ash/display/screen_position_controller_unittest.cc index a35b565..35a4727 100644 --- a/ash/display/screen_position_controller_unittest.cc +++ b/ash/display/screen_position_controller_unittest.cc @@ -114,7 +114,7 @@ TEST_F(ScreenPositionControllerTest, MAYBE_ConvertHostPointToScreen) { const gfx::Point window_pos(100, 100); window_->SetBoundsInScreen( gfx::Rect(window_pos, gfx::Size(100, 100)), - Shell::GetScreen()->GetDisplayNearestPoint(window_pos)); + gfx::Screen::GetScreen()->GetDisplayNearestPoint(window_pos)); SetSecondaryDisplayLayout(DisplayLayout::RIGHT); // The point is on the primary root window. EXPECT_EQ("50,50", ConvertHostPointToScreen(50, 50)); @@ -152,7 +152,7 @@ TEST_F(ScreenPositionControllerTest, MAYBE_ConvertHostPointToScreen) { const gfx::Point window_pos2(300, 100); window_->SetBoundsInScreen( gfx::Rect(window_pos2, gfx::Size(100, 100)), - Shell::GetScreen()->GetDisplayNearestPoint(window_pos2)); + gfx::Screen::GetScreen()->GetDisplayNearestPoint(window_pos2)); // The point is on the secondary display. EXPECT_EQ("250,50", ConvertHostPointToScreen(50, 50)); // The point is out of the all root windows. @@ -197,7 +197,7 @@ TEST_F(ScreenPositionControllerTest, MAYBE_ConvertHostPointToScreenHiDPI) { // Put |window_| to the primary 2x display. window_->SetBoundsInScreen(gfx::Rect(20, 20, 50, 50), - Shell::GetScreen()->GetPrimaryDisplay()); + gfx::Screen::GetScreen()->GetPrimaryDisplay()); // (30, 30) means the host coordinate, so the point is still on the primary // root window. Since it's 2x, the specified native point was halved. EXPECT_EQ("15,15", ConvertHostPointToScreen(30, 30)); @@ -223,7 +223,7 @@ TEST_F(ScreenPositionControllerTest, MAYBE_ConvertHostPointToScreenRotate) { UpdateDisplay("100+100-200x200/r,100+500-200x200/l"); // Put |window_| to the 1st. window_->SetBoundsInScreen(gfx::Rect(20, 20, 50, 50), - Shell::GetScreen()->GetPrimaryDisplay()); + gfx::Screen::GetScreen()->GetPrimaryDisplay()); // The point is on the 1st host. EXPECT_EQ("70,149", ConvertHostPointToScreen(50, 70)); @@ -255,7 +255,7 @@ TEST_F(ScreenPositionControllerTest, MAYBE_ConvertHostPointToScreenUIScale) { UpdateDisplay("100+100-200x200*2@1.5,100+500-200x200"); // Put |window_| to the 1st. window_->SetBoundsInScreen(gfx::Rect(20, 20, 50, 50), - Shell::GetScreen()->GetPrimaryDisplay()); + gfx::Screen::GetScreen()->GetPrimaryDisplay()); // The point is on the 1st host. EXPECT_EQ("45,45", ConvertHostPointToScreen(60, 60)); diff --git a/ash/display/shared_display_edge_indicator.cc b/ash/display/shared_display_edge_indicator.cc index 09d666a..0618622 100644 --- a/ash/display/shared_display_edge_indicator.cc +++ b/ash/display/shared_display_edge_indicator.cc @@ -57,7 +57,7 @@ views::Widget* CreateWidget(const gfx::Rect& bounds, widget->SetVisibilityChangedAnimationsEnabled(false); widget->GetNativeWindow()->SetName("SharedEdgeIndicator"); widget->SetContentsView(contents_view); - gfx::Display display = Shell::GetScreen()->GetDisplayMatching(bounds); + gfx::Display display = gfx::Screen::GetScreen()->GetDisplayMatching(bounds); aura::Window* window = widget->GetNativeWindow(); aura::client::ScreenPositionClient* screen_position_client = aura::client::GetScreenPositionClient(window->GetRootWindow()); diff --git a/ash/display/window_tree_host_manager.cc b/ash/display/window_tree_host_manager.cc index f99f7a4..f298e9c 100644 --- a/ash/display/window_tree_host_manager.cc +++ b/ash/display/window_tree_host_manager.cc @@ -246,7 +246,7 @@ WindowTreeHostManager::WindowTreeHostManager() WindowTreeHostManager::~WindowTreeHostManager() {} void WindowTreeHostManager::Start() { - Shell::GetScreen()->AddObserver(this); + gfx::Screen::GetScreen()->AddObserver(this); Shell::GetInstance()->display_manager()->set_delegate(this); } @@ -260,9 +260,9 @@ void WindowTreeHostManager::Shutdown() { cursor_window_controller_.reset(); mirror_window_controller_.reset(); - Shell::GetScreen()->RemoveObserver(this); + gfx::Screen::GetScreen()->RemoveObserver(this); - int64_t primary_id = Shell::GetScreen()->GetPrimaryDisplay().id(); + int64_t primary_id = gfx::Screen::GetScreen()->GetPrimaryDisplay().id(); // Delete non primary root window controllers first, then // delete the primary root window controller. @@ -391,7 +391,7 @@ WindowTreeHostManager::GetAllRootWindowControllers() { } void WindowTreeHostManager::SwapPrimaryDisplayForTest() { - if (Shell::GetScreen()->GetNumDisplays() <= 1) + if (gfx::Screen::GetScreen()->GetNumDisplays() <= 1) return; SetPrimaryDisplay(ScreenUtil::GetSecondaryDisplay()); } @@ -432,7 +432,8 @@ void WindowTreeHostManager::SetPrimaryDisplay( if (!non_primary_host) return; - gfx::Display old_primary_display = Shell::GetScreen()->GetPrimaryDisplay(); + gfx::Display old_primary_display = + gfx::Screen::GetScreen()->GetPrimaryDisplay(); // Swap root windows between current and new primary display. AshWindowTreeHost* primary_host = window_tree_hosts_[primary_display_id]; @@ -467,7 +468,7 @@ void WindowTreeHostManager::UpdateMouseLocationAfterDisplayChange() { // use the same native location. Otherwise find the display closest // to the current cursor location in screen coordinates. - gfx::Point point_in_screen = Shell::GetScreen()->GetCursorScreenPoint(); + gfx::Point point_in_screen = gfx::Screen::GetScreen()->GetCursorScreenPoint(); gfx::Point target_location_in_native; int64_t closest_distance_squared = -1; DisplayManager* display_manager = GetDisplayManager(); @@ -707,7 +708,7 @@ void WindowTreeHostManager::OnDisplayMetricsChanged(const gfx::Display& display, } void WindowTreeHostManager::OnHostResized(const aura::WindowTreeHost* host) { - gfx::Display display = Shell::GetScreen()->GetDisplayNearestWindow( + gfx::Display display = gfx::Screen::GetScreen()->GetDisplayNearestWindow( const_cast<aura::Window*>(host->window())); DisplayManager* display_manager = GetDisplayManager(); @@ -741,7 +742,7 @@ void WindowTreeHostManager::CloseMirroringDisplayIfNotNecessary() { void WindowTreeHostManager::PreDisplayConfigurationChange(bool clear_focus) { FOR_EACH_OBSERVER(Observer, observers_, OnDisplayConfigurationChanging()); focus_activation_store_->Store(clear_focus); - gfx::Screen* screen = Shell::GetScreen(); + gfx::Screen* screen = gfx::Screen::GetScreen(); gfx::Point point_in_screen = screen->GetCursorScreenPoint(); cursor_location_in_screen_coords_for_restore_ = point_in_screen; @@ -766,7 +767,7 @@ void WindowTreeHostManager::PostDisplayConfigurationChange() { layout_store->UpdateMultiDisplayState( pair, display_manager->IsInMirrorMode(), layout.default_unified); - if (Shell::GetScreen()->GetNumDisplays() > 1) { + if (gfx::Screen::GetScreen()->GetNumDisplays() > 1) { int64_t primary_id = layout.primary_id; SetPrimaryDisplayId(primary_id == gfx::Display::kInvalidDisplayID ? pair.first @@ -776,7 +777,7 @@ void WindowTreeHostManager::PostDisplayConfigurationChange() { // doesn't exist, or b) the primary_id has already been // set to the same and didn't update it. layout_store->UpdatePrimaryDisplayId( - pair, Shell::GetScreen()->GetPrimaryDisplay().id()); + pair, gfx::Screen::GetScreen()->GetPrimaryDisplay().id()); } } FOR_EACH_OBSERVER(Observer, observers_, OnDisplayConfigurationChanged()); diff --git a/ash/display/window_tree_host_manager_unittest.cc b/ash/display/window_tree_host_manager_unittest.cc index 391e53b..8481b19 100644 --- a/ash/display/window_tree_host_manager_unittest.cc +++ b/ash/display/window_tree_host_manager_unittest.cc @@ -71,7 +71,7 @@ class TestObserver : public WindowTreeHostManager::Observer, focus_changed_count_(0), activation_changed_count_(0) { Shell::GetInstance()->window_tree_host_manager()->AddObserver(this); - Shell::GetScreen()->AddObserver(this); + gfx::Screen::GetScreen()->AddObserver(this); aura::client::GetFocusClient(Shell::GetPrimaryRootWindow()) ->AddObserver(this); aura::client::GetActivationClient(Shell::GetPrimaryRootWindow()) @@ -80,7 +80,7 @@ class TestObserver : public WindowTreeHostManager::Observer, ~TestObserver() override { Shell::GetInstance()->window_tree_host_manager()->RemoveObserver(this); - Shell::GetScreen()->RemoveObserver(this); + gfx::Screen::GetScreen()->RemoveObserver(this); aura::client::GetFocusClient(Shell::GetPrimaryRootWindow()) ->RemoveObserver(this); aura::client::GetActivationClient(Shell::GetPrimaryRootWindow()) @@ -174,19 +174,19 @@ class TestObserver : public WindowTreeHostManager::Observer, }; gfx::Display GetPrimaryDisplay() { - return Shell::GetScreen()->GetDisplayNearestWindow( + return gfx::Screen::GetScreen()->GetDisplayNearestWindow( Shell::GetAllRootWindows()[0]); } gfx::Display GetSecondaryDisplay() { - return Shell::GetScreen()->GetDisplayNearestWindow( + return gfx::Screen::GetScreen()->GetDisplayNearestWindow( Shell::GetAllRootWindows()[1]); } void SetSecondaryDisplayLayoutAndOffset(DisplayLayout::Position position, int offset) { DisplayLayout layout(position, offset); - ASSERT_GT(Shell::GetScreen()->GetNumDisplays(), 1); + ASSERT_GT(gfx::Screen::GetScreen()->GetNumDisplays(), 1); Shell::GetInstance()->display_manager()->SetLayoutForCurrentDisplays(layout); } @@ -212,9 +212,9 @@ class WindowTreeHostManagerShutdownTest : public test::AshTestBase { return; // Make sure that primary display is accessible after shutdown. - gfx::Display primary = Shell::GetScreen()->GetPrimaryDisplay(); + gfx::Display primary = gfx::Screen::GetScreen()->GetPrimaryDisplay(); EXPECT_EQ("0,0 444x333", primary.bounds().ToString()); - EXPECT_EQ(2, Shell::GetScreen()->GetNumDisplays()); + EXPECT_EQ(2, gfx::Screen::GetScreen()->GetNumDisplays()); } private: @@ -640,13 +640,13 @@ TEST_F(WindowTreeHostManagerTest, BoundsUpdated) { EXPECT_LE(1, observer.GetFocusChangedCountAndReset()); EXPECT_LE(1, observer.GetActivationChangedCountAndReset()); EXPECT_EQ("0,0 400x400", GetPrimaryDisplay().bounds().ToString()); - EXPECT_EQ(1, Shell::GetScreen()->GetNumDisplays()); + EXPECT_EQ(1, gfx::Screen::GetScreen()->GetNumDisplays()); UpdateDisplay("400x500*2,300x300"); EXPECT_EQ(1, observer.CountAndReset()); EXPECT_EQ(0, observer.GetFocusChangedCountAndReset()); EXPECT_EQ(0, observer.GetActivationChangedCountAndReset()); - ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays()); + ASSERT_EQ(2, gfx::Screen::GetScreen()->GetNumDisplays()); EXPECT_EQ("0,0 200x250", GetPrimaryDisplay().bounds().ToString()); EXPECT_EQ("0,250 300x300", GetSecondaryDisplay().bounds().ToString()); @@ -713,7 +713,7 @@ TEST_F(WindowTreeHostManagerTest, SwapPrimary) { DisplayManager* display_manager = Shell::GetInstance()->display_manager(); UpdateDisplay("200x200,300x300"); - gfx::Display primary_display = Shell::GetScreen()->GetPrimaryDisplay(); + gfx::Display primary_display = gfx::Screen::GetScreen()->GetPrimaryDisplay(); gfx::Display secondary_display = ScreenUtil::GetSecondaryDisplay(); DisplayLayout display_layout(DisplayLayout::RIGHT, 50); @@ -730,11 +730,12 @@ TEST_F(WindowTreeHostManagerTest, SwapPrimary) { Shelf::ForPrimaryDisplay()->shelf_widget()->GetNativeView(); EXPECT_TRUE(primary_root->Contains(shelf_window)); EXPECT_FALSE(secondary_root->Contains(shelf_window)); - EXPECT_EQ( - primary_display.id(), - Shell::GetScreen()->GetDisplayNearestPoint(gfx::Point(-100, -100)).id()); EXPECT_EQ(primary_display.id(), - Shell::GetScreen()->GetDisplayNearestWindow(NULL).id()); + gfx::Screen::GetScreen() + ->GetDisplayNearestPoint(gfx::Point(-100, -100)) + .id()); + EXPECT_EQ(primary_display.id(), + gfx::Screen::GetScreen()->GetDisplayNearestWindow(NULL).id()); EXPECT_EQ("0,0 200x200", primary_display.bounds().ToString()); EXPECT_EQ("0,0 200x153", primary_display.work_area().ToString()); @@ -749,13 +750,14 @@ TEST_F(WindowTreeHostManagerTest, SwapPrimary) { EXPECT_EQ("left, -50", inverted_layout.ToString()); EXPECT_EQ(secondary_display.id(), - Shell::GetScreen()->GetPrimaryDisplay().id()); + gfx::Screen::GetScreen()->GetPrimaryDisplay().id()); EXPECT_EQ(primary_display.id(), ScreenUtil::GetSecondaryDisplay().id()); - EXPECT_EQ( - primary_display.id(), - Shell::GetScreen()->GetDisplayNearestPoint(gfx::Point(-100, -100)).id()); + EXPECT_EQ(primary_display.id(), + gfx::Screen::GetScreen() + ->GetDisplayNearestPoint(gfx::Point(-100, -100)) + .id()); EXPECT_EQ(secondary_display.id(), - Shell::GetScreen()->GetDisplayNearestWindow(NULL).id()); + gfx::Screen::GetScreen()->GetDisplayNearestWindow(NULL).id()); EXPECT_EQ(primary_root, window_tree_host_manager->GetRootWindowForDisplayId( secondary_display.id())); @@ -765,7 +767,7 @@ TEST_F(WindowTreeHostManagerTest, SwapPrimary) { EXPECT_FALSE(secondary_root->Contains(shelf_window)); // Test if the bounds are correctly swapped. - gfx::Display swapped_primary = Shell::GetScreen()->GetPrimaryDisplay(); + gfx::Display swapped_primary = gfx::Screen::GetScreen()->GetPrimaryDisplay(); gfx::Display swapped_secondary = ScreenUtil::GetSecondaryDisplay(); EXPECT_EQ("0,0 300x300", swapped_primary.bounds().ToString()); EXPECT_EQ("0,0 300x253", swapped_primary.work_area().ToString()); @@ -780,13 +782,15 @@ TEST_F(WindowTreeHostManagerTest, SwapPrimary) { // Deleting 2nd display should move the primary to original primary display. UpdateDisplay("200x200"); RunAllPendingInMessageLoop(); // RootWindow is deleted in a posted task. - EXPECT_EQ(1, Shell::GetScreen()->GetNumDisplays()); - EXPECT_EQ(primary_display.id(), Shell::GetScreen()->GetPrimaryDisplay().id()); - EXPECT_EQ( - primary_display.id(), - Shell::GetScreen()->GetDisplayNearestPoint(gfx::Point(-100, -100)).id()); + EXPECT_EQ(1, gfx::Screen::GetScreen()->GetNumDisplays()); + EXPECT_EQ(primary_display.id(), + gfx::Screen::GetScreen()->GetPrimaryDisplay().id()); EXPECT_EQ(primary_display.id(), - Shell::GetScreen()->GetDisplayNearestWindow(NULL).id()); + gfx::Screen::GetScreen() + ->GetDisplayNearestPoint(gfx::Point(-100, -100)) + .id()); + EXPECT_EQ(primary_display.id(), + gfx::Screen::GetScreen()->GetDisplayNearestWindow(NULL).id()); EXPECT_TRUE(tracker.Contains(primary_root)); EXPECT_FALSE(tracker.Contains(secondary_root)); EXPECT_TRUE(primary_root->Contains(shelf_window)); @@ -804,7 +808,7 @@ TEST_F(WindowTreeHostManagerTest, FindNearestDisplay) { DisplayLayout display_layout(DisplayLayout::RIGHT, 50); display_manager->SetLayoutForCurrentDisplays(display_layout); - gfx::Display primary_display = Shell::GetScreen()->GetPrimaryDisplay(); + gfx::Display primary_display = gfx::Screen::GetScreen()->GetPrimaryDisplay(); gfx::Display secondary_display = ScreenUtil::GetSecondaryDisplay(); EXPECT_NE(primary_display.id(), secondary_display.id()); aura::Window* primary_root = @@ -815,33 +819,42 @@ TEST_F(WindowTreeHostManagerTest, FindNearestDisplay) { EXPECT_NE(primary_root, secondary_root); // Test that points outside of any display return the nearest display. - EXPECT_EQ( - primary_display.id(), - Shell::GetScreen()->GetDisplayNearestPoint(gfx::Point(-100, 0)).id()); - EXPECT_EQ( - primary_display.id(), - Shell::GetScreen()->GetDisplayNearestPoint(gfx::Point(0, -100)).id()); - EXPECT_EQ( - primary_display.id(), - Shell::GetScreen()->GetDisplayNearestPoint(gfx::Point(100, 100)).id()); - EXPECT_EQ( - primary_display.id(), - Shell::GetScreen()->GetDisplayNearestPoint(gfx::Point(224, 25)).id()); - EXPECT_EQ( - secondary_display.id(), - Shell::GetScreen()->GetDisplayNearestPoint(gfx::Point(226, 25)).id()); - EXPECT_EQ( - secondary_display.id(), - Shell::GetScreen()->GetDisplayNearestPoint(gfx::Point(600, 100)).id()); - EXPECT_EQ( - primary_display.id(), - Shell::GetScreen()->GetDisplayNearestPoint(gfx::Point(174, 225)).id()); - EXPECT_EQ( - secondary_display.id(), - Shell::GetScreen()->GetDisplayNearestPoint(gfx::Point(176, 225)).id()); - EXPECT_EQ( - secondary_display.id(), - Shell::GetScreen()->GetDisplayNearestPoint(gfx::Point(300, 400)).id()); + EXPECT_EQ(primary_display.id(), + gfx::Screen::GetScreen() + ->GetDisplayNearestPoint(gfx::Point(-100, 0)) + .id()); + EXPECT_EQ(primary_display.id(), + gfx::Screen::GetScreen() + ->GetDisplayNearestPoint(gfx::Point(0, -100)) + .id()); + EXPECT_EQ(primary_display.id(), + gfx::Screen::GetScreen() + ->GetDisplayNearestPoint(gfx::Point(100, 100)) + .id()); + EXPECT_EQ(primary_display.id(), + gfx::Screen::GetScreen() + ->GetDisplayNearestPoint(gfx::Point(224, 25)) + .id()); + EXPECT_EQ(secondary_display.id(), + gfx::Screen::GetScreen() + ->GetDisplayNearestPoint(gfx::Point(226, 25)) + .id()); + EXPECT_EQ(secondary_display.id(), + gfx::Screen::GetScreen() + ->GetDisplayNearestPoint(gfx::Point(600, 100)) + .id()); + EXPECT_EQ(primary_display.id(), + gfx::Screen::GetScreen() + ->GetDisplayNearestPoint(gfx::Point(174, 225)) + .id()); + EXPECT_EQ(secondary_display.id(), + gfx::Screen::GetScreen() + ->GetDisplayNearestPoint(gfx::Point(176, 225)) + .id()); + EXPECT_EQ(secondary_display.id(), + gfx::Screen::GetScreen() + ->GetDisplayNearestPoint(gfx::Point(300, 400)) + .id()); } TEST_F(WindowTreeHostManagerTest, SwapPrimaryById) { @@ -853,7 +866,7 @@ TEST_F(WindowTreeHostManagerTest, SwapPrimaryById) { DisplayManager* display_manager = Shell::GetInstance()->display_manager(); UpdateDisplay("200x200,300x300"); - gfx::Display primary_display = Shell::GetScreen()->GetPrimaryDisplay(); + gfx::Display primary_display = gfx::Screen::GetScreen()->GetPrimaryDisplay(); gfx::Display secondary_display = ScreenUtil::GetSecondaryDisplay(); DisplayLayout display_layout(DisplayLayout::RIGHT, 50); @@ -870,17 +883,18 @@ TEST_F(WindowTreeHostManagerTest, SwapPrimaryById) { EXPECT_TRUE(primary_root->Contains(shelf_window)); EXPECT_FALSE(secondary_root->Contains(shelf_window)); EXPECT_NE(primary_root, secondary_root); - EXPECT_EQ( - primary_display.id(), - Shell::GetScreen()->GetDisplayNearestPoint(gfx::Point(-100, -100)).id()); EXPECT_EQ(primary_display.id(), - Shell::GetScreen()->GetDisplayNearestWindow(NULL).id()); + gfx::Screen::GetScreen() + ->GetDisplayNearestPoint(gfx::Point(-100, -100)) + .id()); + EXPECT_EQ(primary_display.id(), + gfx::Screen::GetScreen()->GetDisplayNearestWindow(NULL).id()); // Switch primary and secondary by display ID. TestObserver observer; window_tree_host_manager->SetPrimaryDisplayId(secondary_display.id()); EXPECT_EQ(secondary_display.id(), - Shell::GetScreen()->GetPrimaryDisplay().id()); + gfx::Screen::GetScreen()->GetPrimaryDisplay().id()); EXPECT_EQ(primary_display.id(), ScreenUtil::GetSecondaryDisplay().id()); EXPECT_LT(0, observer.CountAndReset()); @@ -907,13 +921,15 @@ TEST_F(WindowTreeHostManagerTest, SwapPrimaryById) { // Deleting 2nd display should move the primary to original primary display. UpdateDisplay("200x200"); RunAllPendingInMessageLoop(); // RootWindow is deleted in a posted task. - EXPECT_EQ(1, Shell::GetScreen()->GetNumDisplays()); - EXPECT_EQ(primary_display.id(), Shell::GetScreen()->GetPrimaryDisplay().id()); - EXPECT_EQ( - primary_display.id(), - Shell::GetScreen()->GetDisplayNearestPoint(gfx::Point(-100, -100)).id()); + EXPECT_EQ(1, gfx::Screen::GetScreen()->GetNumDisplays()); + EXPECT_EQ(primary_display.id(), + gfx::Screen::GetScreen()->GetPrimaryDisplay().id()); EXPECT_EQ(primary_display.id(), - Shell::GetScreen()->GetDisplayNearestWindow(NULL).id()); + gfx::Screen::GetScreen() + ->GetDisplayNearestPoint(gfx::Point(-100, -100)) + .id()); + EXPECT_EQ(primary_display.id(), + gfx::Screen::GetScreen()->GetDisplayNearestWindow(NULL).id()); EXPECT_TRUE(tracker.Contains(primary_root)); EXPECT_FALSE(tracker.Contains(secondary_root)); EXPECT_TRUE(primary_root->Contains(shelf_window)); @@ -927,9 +943,9 @@ TEST_F(WindowTreeHostManagerTest, SwapPrimaryById) { display_manager->GetDisplayInfo(secondary_display.id())); display_manager->OnNativeDisplaysChanged(display_info_list); - EXPECT_EQ(2, Shell::GetScreen()->GetNumDisplays()); + EXPECT_EQ(2, gfx::Screen::GetScreen()->GetNumDisplays()); EXPECT_EQ(secondary_display.id(), - Shell::GetScreen()->GetPrimaryDisplay().id()); + gfx::Screen::GetScreen()->GetPrimaryDisplay().id()); EXPECT_EQ(primary_display.id(), ScreenUtil::GetSecondaryDisplay().id()); EXPECT_EQ(primary_root, window_tree_host_manager->GetRootWindowForDisplayId( secondary_display.id())); @@ -951,8 +967,9 @@ TEST_F(WindowTreeHostManagerTest, SwapPrimaryById) { display_info_list2.push_back(primary_display_info); display_info_list2.push_back(third_display_info); display_manager->OnNativeDisplaysChanged(display_info_list2); - EXPECT_EQ(2, Shell::GetScreen()->GetNumDisplays()); - EXPECT_EQ(primary_display.id(), Shell::GetScreen()->GetPrimaryDisplay().id()); + EXPECT_EQ(2, gfx::Screen::GetScreen()->GetNumDisplays()); + EXPECT_EQ(primary_display.id(), + gfx::Screen::GetScreen()->GetPrimaryDisplay().id()); EXPECT_EQ(third_display_info.id(), ScreenUtil::GetSecondaryDisplay().id()); EXPECT_EQ(primary_root, window_tree_host_manager->GetRootWindowForDisplayId( primary_display.id())); @@ -971,7 +988,7 @@ TEST_F(WindowTreeHostManagerTest, OverscanInsets) { Shell::GetInstance()->AddPreTargetHandler(&event_handler); UpdateDisplay("120x200,300x400*2"); - gfx::Display display1 = Shell::GetScreen()->GetPrimaryDisplay(); + gfx::Display display1 = gfx::Screen::GetScreen()->GetPrimaryDisplay(); aura::Window::Windows root_windows = Shell::GetAllRootWindows(); window_tree_host_manager->SetOverscanInsets(display1.id(), @@ -1020,7 +1037,7 @@ TEST_F(WindowTreeHostManagerTest, Rotate) { Shell::GetInstance()->AddPreTargetHandler(&event_handler); UpdateDisplay("120x200,300x400*2"); - gfx::Display display1 = Shell::GetScreen()->GetPrimaryDisplay(); + gfx::Display display1 = gfx::Screen::GetScreen()->GetPrimaryDisplay(); int64_t display2_id = ScreenUtil::GetSecondaryDisplay().id(); aura::Window::Windows root_windows = Shell::GetAllRootWindows(); ui::test::EventGenerator generator1(root_windows[0]); @@ -1095,7 +1112,7 @@ TEST_F(WindowTreeHostManagerTest, ScaleRootWindow) { UpdateDisplay("600x400*2@1.5,500x300"); - gfx::Display display1 = Shell::GetScreen()->GetPrimaryDisplay(); + gfx::Display display1 = gfx::Screen::GetScreen()->GetPrimaryDisplay(); test::ScopedSetInternalDisplayId set_internal(display1.id()); gfx::Display display2 = ScreenUtil::GetSecondaryDisplay(); @@ -1111,7 +1128,7 @@ TEST_F(WindowTreeHostManagerTest, ScaleRootWindow) { EXPECT_EQ("449,150", event_handler.GetLocationAndReset()); SetDisplayUIScale(display1.id(), 1.25f); - display1 = Shell::GetScreen()->GetPrimaryDisplay(); + display1 = gfx::Screen::GetScreen()->GetPrimaryDisplay(); display2 = ScreenUtil::GetSecondaryDisplay(); EXPECT_EQ("0,0 375x250", display1.bounds().ToString()); EXPECT_EQ("0,0 375x250", root_windows[0]->bounds().ToString()); @@ -1130,7 +1147,7 @@ TEST_F(WindowTreeHostManagerTest, TouchScale) { Shell::GetInstance()->AddPreTargetHandler(&event_handler); UpdateDisplay("200x200*2"); - gfx::Display display = Shell::GetScreen()->GetPrimaryDisplay(); + gfx::Display display = gfx::Screen::GetScreen()->GetPrimaryDisplay(); aura::Window::Windows root_windows = Shell::GetAllRootWindows(); aura::Window* root_window = root_windows[0]; ui::test::EventGenerator generator(root_window); @@ -1163,7 +1180,7 @@ TEST_F(WindowTreeHostManagerTest, ConvertHostToRootCoords) { UpdateDisplay("600x400*2/r@1.5"); - gfx::Display display1 = Shell::GetScreen()->GetPrimaryDisplay(); + gfx::Display display1 = gfx::Screen::GetScreen()->GetPrimaryDisplay(); aura::Window::Windows root_windows = Shell::GetAllRootWindows(); EXPECT_EQ("0,0 300x450", display1.bounds().ToString()); EXPECT_EQ("0,0 300x450", root_windows[0]->bounds().ToString()); @@ -1180,7 +1197,7 @@ TEST_F(WindowTreeHostManagerTest, ConvertHostToRootCoords) { EXPECT_EQ("299,449", event_handler.GetLocationAndReset()); UpdateDisplay("600x400*2/u@1.5"); - display1 = Shell::GetScreen()->GetPrimaryDisplay(); + display1 = gfx::Screen::GetScreen()->GetPrimaryDisplay(); root_windows = Shell::GetAllRootWindows(); EXPECT_EQ("0,0 450x300", display1.bounds().ToString()); EXPECT_EQ("0,0 450x300", root_windows[0]->bounds().ToString()); @@ -1196,7 +1213,7 @@ TEST_F(WindowTreeHostManagerTest, ConvertHostToRootCoords) { EXPECT_EQ("449,0", event_handler.GetLocationAndReset()); UpdateDisplay("600x400*2/l@1.5"); - display1 = Shell::GetScreen()->GetPrimaryDisplay(); + display1 = gfx::Screen::GetScreen()->GetPrimaryDisplay(); root_windows = Shell::GetAllRootWindows(); EXPECT_EQ("0,0 300x450", display1.bounds().ToString()); EXPECT_EQ("0,0 300x450", root_windows[0]->bounds().ToString()); @@ -1280,7 +1297,7 @@ TEST_F(WindowTreeHostManagerTest, ReplaceSwappedPrimary) { Shell::GetInstance()->window_tree_host_manager()->SwapPrimaryDisplayForTest(); - EXPECT_EQ(11, Shell::GetScreen()->GetPrimaryDisplay().id()); + EXPECT_EQ(11, gfx::Screen::GetScreen()->GetPrimaryDisplay().id()); display_info_list.clear(); const DisplayInfo new_first_display_info = @@ -1291,7 +1308,7 @@ TEST_F(WindowTreeHostManagerTest, ReplaceSwappedPrimary) { display_info_list.push_back(new_second_display_info); display_manager->OnNativeDisplaysChanged(display_info_list); - EXPECT_EQ(20, Shell::GetScreen()->GetPrimaryDisplay().id()); + EXPECT_EQ(20, gfx::Screen::GetScreen()->GetPrimaryDisplay().id()); } namespace { diff --git a/ash/extended_desktop_unittest.cc b/ash/extended_desktop_unittest.cc index 64eee29..b35b459 100644 --- a/ash/extended_desktop_unittest.cc +++ b/ash/extended_desktop_unittest.cc @@ -289,15 +289,18 @@ TEST_F(ExtendedDesktopTest, TestCursorLocation) { aura::test::WindowTestApi root_window1_test_api(root_windows[1]); root_windows[0]->MoveCursorTo(gfx::Point(10, 10)); - EXPECT_EQ("10,10", Shell::GetScreen()->GetCursorScreenPoint().ToString()); + EXPECT_EQ("10,10", + gfx::Screen::GetScreen()->GetCursorScreenPoint().ToString()); EXPECT_TRUE(root_window0_test_api.ContainsMouse()); EXPECT_FALSE(root_window1_test_api.ContainsMouse()); root_windows[1]->MoveCursorTo(gfx::Point(10, 20)); - EXPECT_EQ("1010,20", Shell::GetScreen()->GetCursorScreenPoint().ToString()); + EXPECT_EQ("1010,20", + gfx::Screen::GetScreen()->GetCursorScreenPoint().ToString()); EXPECT_FALSE(root_window0_test_api.ContainsMouse()); EXPECT_TRUE(root_window1_test_api.ContainsMouse()); root_windows[0]->MoveCursorTo(gfx::Point(20, 10)); - EXPECT_EQ("20,10", Shell::GetScreen()->GetCursorScreenPoint().ToString()); + EXPECT_EQ("20,10", + gfx::Screen::GetScreen()->GetCursorScreenPoint().ToString()); EXPECT_TRUE(root_window0_test_api.ContainsMouse()); EXPECT_FALSE(root_window1_test_api.ContainsMouse()); } @@ -609,9 +612,9 @@ TEST_F(ExtendedDesktopTest, MoveWindowToDisplay) { UpdateDisplay("1000x1000,1000x1000"); aura::Window::Windows root_windows = Shell::GetAllRootWindows(); - gfx::Display display0 = Shell::GetScreen()->GetDisplayMatching( + gfx::Display display0 = gfx::Screen::GetScreen()->GetDisplayMatching( root_windows[0]->GetBoundsInScreen()); - gfx::Display display1 = Shell::GetScreen()->GetDisplayMatching( + gfx::Display display1 = gfx::Screen::GetScreen()->GetDisplayMatching( root_windows[1]->GetBoundsInScreen()); EXPECT_NE(display0.id(), display1.id()); @@ -697,7 +700,7 @@ TEST_F(ExtendedDesktopTest, MoveWindowWithTransient) { TEST_F(ExtendedDesktopTest, ConvertPoint) { if (!SupportsMultipleDisplays()) return; - gfx::Screen* screen = Shell::GetScreen(); + gfx::Screen* screen = gfx::Screen::GetScreen(); UpdateDisplay("1000x600,600x400"); aura::Window::Windows root_windows = Shell::GetAllRootWindows(); gfx::Display display_1 = screen->GetDisplayNearestWindow(root_windows[0]); @@ -835,8 +838,8 @@ TEST_F(ExtendedDesktopTest, KeyEventsOnLockScreen) { aura::Window::Windows root_windows = Shell::GetAllRootWindows(); // Create normal windows on both displays. - views::Widget* widget1 = CreateTestWidget( - Shell::GetScreen()->GetPrimaryDisplay().bounds()); + views::Widget* widget1 = + CreateTestWidget(gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds()); widget1->Show(); EXPECT_EQ(root_windows[0], widget1->GetNativeView()->GetRootWindow()); views::Widget* widget2 = CreateTestWidget( @@ -845,8 +848,8 @@ TEST_F(ExtendedDesktopTest, KeyEventsOnLockScreen) { EXPECT_EQ(root_windows[1], widget2->GetNativeView()->GetRootWindow()); // Create a LockScreen window. - views::Widget* lock_widget = CreateTestWidget( - Shell::GetScreen()->GetPrimaryDisplay().bounds()); + views::Widget* lock_widget = + CreateTestWidget(gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds()); views::Textfield* textfield = new views::Textfield; lock_widget->client_view()->AddChildView(textfield); diff --git a/ash/first_run/first_run_helper_impl.cc b/ash/first_run/first_run_helper_impl.cc index 19d107f..ec21cf2 100644 --- a/ash/first_run/first_run_helper_impl.cc +++ b/ash/first_run/first_run_helper_impl.cc @@ -12,6 +12,7 @@ #include "ui/app_list/views/app_list_view.h" #include "ui/aura/window.h" #include "ui/gfx/geometry/rect.h" +#include "ui/gfx/screen.h" #include "ui/views/view.h" #include "ui/views/widget/widget.h" @@ -22,7 +23,7 @@ namespace { views::Widget* CreateFirstRunWindow() { views::Widget::InitParams params( views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); - params.bounds = Shell::GetScreen()->GetPrimaryDisplay().bounds(); + params.bounds = gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds(); params.show_state = ui::SHOW_STATE_FULLSCREEN; params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; params.parent = Shell::GetContainer(Shell::GetPrimaryRootWindow(), diff --git a/ash/frame/caption_buttons/frame_size_button_unittest.cc b/ash/frame/caption_buttons/frame_size_button_unittest.cc index c63e49e..f1b31eb 100644 --- a/ash/frame/caption_buttons/frame_size_button_unittest.cc +++ b/ash/frame/caption_buttons/frame_size_button_unittest.cc @@ -337,7 +337,7 @@ TEST_F(FrameSizeButtonTest, ResetButtonsAfterClick) { EXPECT_EQ(CAPTION_BUTTON_ICON_RIGHT_SNAPPED, close_button()->icon()); const gfx::Rect& kWorkAreaBoundsInScreen = - ash::Shell::GetScreen()->GetPrimaryDisplay().work_area(); + gfx::Screen::GetScreen()->GetPrimaryDisplay().work_area(); generator.MoveMouseTo(kWorkAreaBoundsInScreen.bottom_left()); // None of the buttons should be pressed because we are really far away from @@ -388,7 +388,7 @@ TEST_F(FrameSizeButtonTest, SizeButtonPressedWhenSnapButtonHovered) { // the close button (snap right button) should hover the close button and // keep the size button pressed. const gfx::Rect& kWorkAreaBoundsInScreen = - ash::Shell::GetScreen()->GetPrimaryDisplay().work_area(); + gfx::Screen::GetScreen()->GetPrimaryDisplay().work_area(); generator.MoveMouseTo(kWorkAreaBoundsInScreen.bottom_left()); EXPECT_TRUE(AllButtonsInNormalState()); generator.MoveMouseTo(CenterPointInScreen(close_button())); diff --git a/ash/magnifier/magnification_controller.cc b/ash/magnifier/magnification_controller.cc index d0ec016..c48d820 100644 --- a/ash/magnifier/magnification_controller.cc +++ b/ash/magnifier/magnification_controller.cc @@ -372,7 +372,7 @@ bool MagnificationControllerImpl::RedrawDIP(const gfx::PointF& position_in_dip, base::TimeDelta::FromMilliseconds(duration_in_ms)); gfx::Display display = - Shell::GetScreen()->GetDisplayNearestWindow(root_window_); + gfx::Screen::GetScreen()->GetDisplayNearestWindow(root_window_); scoped_ptr<RootWindowTransformer> transformer( CreateRootWindowTransformerForDisplay(root_window_, display)); GetRootWindowController(root_window_) diff --git a/ash/root_window_controller_unittest.cc b/ash/root_window_controller_unittest.cc index cd8bcc4..4d1c863 100644 --- a/ash/root_window_controller_unittest.cc +++ b/ash/root_window_controller_unittest.cc @@ -830,19 +830,19 @@ TEST_F(VirtualKeyboardRootWindowControllerTest, RestoreWorkspaceAfterLogin) { root_window->bounds(), 100)); keyboard_window->Show(); - gfx::Rect before = ash::Shell::GetScreen()->GetPrimaryDisplay().work_area(); + gfx::Rect before = gfx::Screen::GetScreen()->GetPrimaryDisplay().work_area(); // Notify keyboard bounds changing. controller->NotifyKeyboardBoundsChanging(keyboard_container->bounds()); if (!keyboard::IsKeyboardOverscrollEnabled()) { - gfx::Rect after = ash::Shell::GetScreen()->GetPrimaryDisplay().work_area(); + gfx::Rect after = gfx::Screen::GetScreen()->GetPrimaryDisplay().work_area(); EXPECT_LT(after, before); } // Mock a login user profile change to reinitialize the keyboard. ash::Shell::GetInstance()->OnLoginUserProfilePrepared(); - EXPECT_EQ(ash::Shell::GetScreen()->GetPrimaryDisplay().work_area(), before); + EXPECT_EQ(gfx::Screen::GetScreen()->GetPrimaryDisplay().work_area(), before); } // Ensure that system modal dialogs do not block events targeted at the virtual diff --git a/ash/screen_util.cc b/ash/screen_util.cc index 02d90e2..c27d896 100644 --- a/ash/screen_util.cc +++ b/ash/screen_util.cc @@ -42,14 +42,14 @@ gfx::Rect ScreenUtil::GetMaximizedWindowBoundsInParent(aura::Window* window) { gfx::Rect ScreenUtil::GetDisplayBoundsInParent(aura::Window* window) { return ConvertRectFromScreen( window->parent(), - Shell::GetScreen()->GetDisplayNearestWindow(window).bounds()); + gfx::Screen::GetScreen()->GetDisplayNearestWindow(window).bounds()); } // static gfx::Rect ScreenUtil::GetDisplayWorkAreaBoundsInParent(aura::Window* window) { return ConvertRectFromScreen( window->parent(), - Shell::GetScreen()->GetDisplayNearestWindow(window).work_area()); + gfx::Screen::GetScreen()->GetDisplayNearestWindow(window).work_area()); } gfx::Rect ScreenUtil::GetShelfDisplayBoundsInRoot(aura::Window* window) { @@ -92,8 +92,9 @@ const gfx::Display& ScreenUtil::GetSecondaryDisplay() { DisplayManager* display_manager = GetDisplayManager(); CHECK_LE(2U, display_manager->GetNumDisplays()); return display_manager->GetDisplayAt(0).id() == - Shell::GetScreen()->GetPrimaryDisplay().id() ? - display_manager->GetDisplayAt(1) : display_manager->GetDisplayAt(0); + gfx::Screen::GetScreen()->GetPrimaryDisplay().id() + ? display_manager->GetDisplayAt(1) + : display_manager->GetDisplayAt(0); } } // namespace ash diff --git a/ash/shelf/overflow_bubble_view.cc b/ash/shelf/overflow_bubble_view.cc index 7dae49a..5273e506 100644 --- a/ash/shelf/overflow_bubble_view.cc +++ b/ash/shelf/overflow_bubble_view.cc @@ -111,8 +111,10 @@ void OverflowBubbleView::ScrollByYOffset(int y_offset) { gfx::Size OverflowBubbleView::GetPreferredSize() const { gfx::Size preferred_size = GetContentsSize(); - const gfx::Rect monitor_rect = Shell::GetScreen()->GetDisplayNearestPoint( - GetAnchorRect().CenterPoint()).work_area(); + const gfx::Rect monitor_rect = + gfx::Screen::GetScreen() + ->GetDisplayNearestPoint(GetAnchorRect().CenterPoint()) + .work_area(); if (!monitor_rect.IsEmpty()) { if (IsHorizontalAlignment()) { preferred_size.set_width(std::min( @@ -194,8 +196,10 @@ gfx::Rect OverflowBubbleView::GetBubbleBounds() { content_size, false); - gfx::Rect monitor_rect = Shell::GetScreen()->GetDisplayNearestPoint( - anchor_rect.CenterPoint()).work_area(); + gfx::Rect monitor_rect = + gfx::Screen::GetScreen() + ->GetDisplayNearestPoint(anchor_rect.CenterPoint()) + .work_area(); int offset = 0; if (views::BubbleBorder::is_arrow_on_horizontal(arrow())) { diff --git a/ash/shelf/shelf_bezel_event_filter.cc b/ash/shelf/shelf_bezel_event_filter.cc index c3c46f3..14ec7dc 100644 --- a/ash/shelf/shelf_bezel_event_filter.cc +++ b/ash/shelf/shelf_bezel_event_filter.cc @@ -7,6 +7,7 @@ #include "ash/shelf/shelf_layout_manager.h" #include "ash/shell.h" #include "ui/aura/window.h" +#include "ui/gfx/screen.h" #include "ui/wm/core/coordinate_conversion.h" namespace ash { @@ -27,8 +28,9 @@ void ShelfBezelEventFilter::OnGestureEvent( gfx::Point point_in_screen(event->location()); aura::Window* target = static_cast<aura::Window*>(event->target()); ::wm::ConvertPointToScreen(target, &point_in_screen); - gfx::Rect screen = - Shell::GetScreen()->GetDisplayNearestPoint(point_in_screen).bounds(); + gfx::Rect screen = gfx::Screen::GetScreen() + ->GetDisplayNearestPoint(point_in_screen) + .bounds(); if ((!screen.Contains(point_in_screen) && IsShelfOnBezel(screen, point_in_screen)) || in_touch_drag_) { diff --git a/ash/shelf/shelf_layout_manager.cc b/ash/shelf/shelf_layout_manager.cc index 57683ff..aae4793 100644 --- a/ash/shelf/shelf_layout_manager.cc +++ b/ash/shelf/shelf_layout_manager.cc @@ -371,7 +371,7 @@ void ShelfLayoutManager::UpdateAutoHideState() { if (!auto_hide_timer_.IsRunning()) { mouse_over_shelf_when_auto_hide_timer_started_ = shelf_->GetWindowBoundsInScreen().Contains( - Shell::GetScreen()->GetCursorScreenPoint()); + gfx::Screen::GetScreen()->GetCursorScreenPoint()); } auto_hide_timer_.Start( FROM_HERE, @@ -1085,7 +1085,7 @@ ShelfAutoHideState ShelfLayoutManager::CalculateAutoHideState( } gfx::Point cursor_position_in_screen = - Shell::GetScreen()->GetCursorScreenPoint(); + gfx::Screen::GetScreen()->GetCursorScreenPoint(); if (shelf_region.Contains(cursor_position_in_screen)) return SHELF_AUTO_HIDE_SHOWN; diff --git a/ash/shelf/shelf_layout_manager_unittest.cc b/ash/shelf/shelf_layout_manager_unittest.cc index d4cd5c3..33802dc 100644 --- a/ash/shelf/shelf_layout_manager_unittest.cc +++ b/ash/shelf/shelf_layout_manager_unittest.cc @@ -717,7 +717,7 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetVisible) { gfx::Rect shelf_bounds( shelf->GetWindowBoundsInScreen()); int shelf_height = manager->GetIdealBounds().height(); - gfx::Screen* screen = Shell::GetScreen(); + gfx::Screen* screen = gfx::Screen::GetScreen(); gfx::Display display = screen->GetDisplayNearestWindow( Shell::GetPrimaryRootWindow()); ASSERT_NE(-1, display.id()); @@ -814,15 +814,15 @@ TEST_F(ShelfLayoutManagerTest, LayoutShelfWhileAnimating) { SetState(shelf->shelf_layout_manager(), SHELF_HIDDEN); shelf->shelf_layout_manager()->LayoutShelf(); EXPECT_EQ(SHELF_HIDDEN, shelf->shelf_layout_manager()->visibility_state()); - gfx::Display display = Shell::GetScreen()->GetDisplayNearestWindow( + gfx::Display display = gfx::Screen::GetScreen()->GetDisplayNearestWindow( Shell::GetPrimaryRootWindow()); EXPECT_EQ(0, display.GetWorkAreaInsets().bottom()); // Make sure the bounds of the two widgets changed. EXPECT_GE(shelf->GetNativeView()->bounds().y(), - Shell::GetScreen()->GetPrimaryDisplay().bounds().bottom()); + gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds().bottom()); EXPECT_GE(shelf->status_area_widget()->GetNativeView()->bounds().y(), - Shell::GetScreen()->GetPrimaryDisplay().bounds().bottom()); + gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds().bottom()); } // Test that switching to a different visibility state does not restart the @@ -898,8 +898,10 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_AutoHide) { EXPECT_EQ(root->bounds().bottom() - ShelfLayoutManager::kAutoHideSize, GetShelfWidget()->GetWindowBoundsInScreen().y()); EXPECT_EQ(root->bounds().bottom() - ShelfLayoutManager::kAutoHideSize, - Shell::GetScreen()->GetDisplayNearestWindow( - root).work_area().bottom()); + gfx::Screen::GetScreen() + ->GetDisplayNearestWindow(root) + .work_area() + .bottom()); // Move the mouse to the bottom of the screen. generator.MoveMouseTo(0, root->bounds().bottom() - 1); @@ -911,8 +913,10 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_AutoHide) { EXPECT_EQ(root->bounds().bottom() - shelf->GetIdealBounds().height(), GetShelfWidget()->GetWindowBoundsInScreen().y()); EXPECT_EQ(root->bounds().bottom() - ShelfLayoutManager::kAutoHideSize, - Shell::GetScreen()->GetDisplayNearestWindow( - root).work_area().bottom()); + gfx::Screen::GetScreen() + ->GetDisplayNearestWindow(root) + .work_area() + .bottom()); // Move mouse back up. generator.MoveMouseTo(0, 0); @@ -977,7 +981,8 @@ TEST_F(ShelfLayoutManagerTest, AutoHideShelfOnScreenBoundary) { generator.MoveMouseTo(right_edge - 1, y); UpdateAutoHideStateNow(); EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->auto_hide_state()); - EXPECT_EQ(right_edge - 1, Shell::GetScreen()->GetCursorScreenPoint().x()); + EXPECT_EQ(right_edge - 1, + gfx::Screen::GetScreen()->GetCursorScreenPoint().x()); // Moving the mouse off the light bar should hide the shelf. generator.MoveMouseTo(right_edge - 50, y); @@ -990,7 +995,8 @@ TEST_F(ShelfLayoutManagerTest, AutoHideShelfOnScreenBoundary) { generator.MoveMouseTo(right_edge - 1, y); generator.MoveMouseTo(right_edge, y); UpdateAutoHideStateNow(); - EXPECT_NE(right_edge - 1, Shell::GetScreen()->GetCursorScreenPoint().x()); + EXPECT_NE(right_edge - 1, + gfx::Screen::GetScreen()->GetCursorScreenPoint().x()); EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->auto_hide_state()); // Hide the shelf. @@ -1103,7 +1109,7 @@ TEST_F(ShelfLayoutManagerTest, SetAutoHideBehavior) { widget->Show(); aura::Window* window = widget->GetNativeWindow(); gfx::Rect display_bounds( - Shell::GetScreen()->GetDisplayNearestWindow(window).bounds()); + gfx::Screen::GetScreen()->GetDisplayNearestWindow(window).bounds()); shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state()); @@ -1113,14 +1119,18 @@ TEST_F(ShelfLayoutManagerTest, SetAutoHideBehavior) { widget->Maximize(); EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state()); - EXPECT_EQ(Shell::GetScreen()->GetDisplayNearestWindow( - window).work_area().bottom(), + EXPECT_EQ(gfx::Screen::GetScreen() + ->GetDisplayNearestWindow(window) + .work_area() + .bottom(), widget->GetWorkAreaBoundsInScreen().bottom()); shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state()); - EXPECT_EQ(Shell::GetScreen()->GetDisplayNearestWindow( - window).work_area().bottom(), + EXPECT_EQ(gfx::Screen::GetScreen() + ->GetDisplayNearestWindow(window) + .work_area() + .bottom(), widget->GetWorkAreaBoundsInScreen().bottom()); ui::ScopedAnimationDurationScaleMode animation_duration( @@ -1132,8 +1142,10 @@ TEST_F(ShelfLayoutManagerTest, SetAutoHideBehavior) { StepWidgetLayerAnimatorToEnd(shelf_widget); StepWidgetLayerAnimatorToEnd(shelf_widget->status_area_widget()); EXPECT_EQ(SHELF_VISIBLE, shelf->visibility_state()); - EXPECT_EQ(Shell::GetScreen()->GetDisplayNearestWindow( - window).work_area().bottom(), + EXPECT_EQ(gfx::Screen::GetScreen() + ->GetDisplayNearestWindow(window) + .work_area() + .bottom(), widget->GetWorkAreaBoundsInScreen().bottom()); } @@ -1157,7 +1169,7 @@ TEST_F(ShelfLayoutManagerTest, DimmingBehavior) { widget->Show(); aura::Window* window = widget->GetNativeWindow(); gfx::Rect display_bounds( - Shell::GetScreen()->GetDisplayNearestWindow(window).bounds()); + gfx::Screen::GetScreen()->GetDisplayNearestWindow(window).bounds()); gfx::Point off_shelf = display_bounds.CenterPoint(); gfx::Point on_shelf = @@ -1288,7 +1300,7 @@ TEST_F(ShelfLayoutManagerTest, DimmingBehaviorWithMenus) { widget->Show(); aura::Window* window = widget->GetNativeWindow(); gfx::Rect display_bounds( - Shell::GetScreen()->GetDisplayNearestWindow(window).bounds()); + gfx::Screen::GetScreen()->GetDisplayNearestWindow(window).bounds()); // After maximization, the shelf should be visible and the dimmer created. widget->Maximize(); @@ -1714,7 +1726,7 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetAlignment) { shelf->SetAlignment(SHELF_ALIGNMENT_LEFT); gfx::Rect shelf_bounds( GetShelfWidget()->GetWindowBoundsInScreen()); - const gfx::Screen* screen = Shell::GetScreen(); + const gfx::Screen* screen = gfx::Screen::GetScreen(); gfx::Display display = screen->GetDisplayNearestWindow(Shell::GetPrimaryRootWindow()); ASSERT_NE(-1, display.id()); diff --git a/ash/shelf/shelf_window_watcher.cc b/ash/shelf/shelf_window_watcher.cc index 4146b50..80df891 100644 --- a/ash/shelf/shelf_window_watcher.cc +++ b/ash/shelf/shelf_window_watcher.cc @@ -120,11 +120,11 @@ ShelfWindowWatcher::ShelfWindowWatcher( it != root_windows.end(); ++it) OnRootWindowAdded(*it); - Shell::GetScreen()->AddObserver(this); + gfx::Screen::GetScreen()->AddObserver(this); } ShelfWindowWatcher::~ShelfWindowWatcher() { - Shell::GetScreen()->RemoveObserver(this); + gfx::Screen::GetScreen()->RemoveObserver(this); } void ShelfWindowWatcher::AddShelfItem(aura::Window* window) { diff --git a/ash/shell.cc b/ash/shell.cc index f31c36d..391a935 100644 --- a/ash/shell.cc +++ b/ash/shell.cc @@ -242,11 +242,6 @@ aura::Window* Shell::GetTargetRootWindow() { } // static -gfx::Screen* Shell::GetScreen() { - return gfx::Screen::GetScreen(); -} - -// static aura::Window::Windows Shell::GetAllRootWindows() { CHECK(HasInstance()); return Shell::GetInstance()->window_tree_host_manager()->GetAllRootWindows(); @@ -910,7 +905,7 @@ void Shell::Init(const ShellInitParams& init_params) { new ResolutionNotificationController); #endif - cursor_manager_.SetDisplay(GetScreen()->GetPrimaryDisplay()); + cursor_manager_.SetDisplay(gfx::Screen::GetScreen()->GetPrimaryDisplay()); nested_accelerator_controller_.reset( new ::wm::NestedAcceleratorController(new NestedAcceleratorDelegate)); diff --git a/ash/shell.h b/ash/shell.h index 819c80a..32e9b9a 100644 --- a/ash/shell.h +++ b/ash/shell.h @@ -209,9 +209,6 @@ class ASH_EXPORT Shell : public SystemModalContainerEventFilterDelegate, // |wm::GetActiveWindow()->GetRootWindow()|. static aura::Window* GetTargetRootWindow(); - // Returns the global Screen object that's always active in ash. - static gfx::Screen* GetScreen(); - // Returns all root windows. static aura::Window::Windows GetAllRootWindows(); diff --git a/ash/shell/content/client/shell_browser_main_parts.cc b/ash/shell/content/client/shell_browser_main_parts.cc index 2a9613b..73bde55 100644 --- a/ash/shell/content/client/shell_browser_main_parts.cc +++ b/ash/shell/content/client/shell_browser_main_parts.cc @@ -134,8 +134,7 @@ void ShellBrowserMainParts::PreMainMessageLoopRun() { ash::Shell::GetInstance()->UpdateAfterLoginStatusChange(user::LOGGED_IN_USER); window_watcher_.reset(new ash::shell::WindowWatcher); - gfx::Screen* screen = Shell::GetInstance()->GetScreen(); - screen->AddObserver(window_watcher_.get()); + gfx::Screen::GetScreen()->AddObserver(window_watcher_.get()); ash::shell::InitWindowTypeLauncher(); @@ -143,8 +142,7 @@ void ShellBrowserMainParts::PreMainMessageLoopRun() { } void ShellBrowserMainParts::PostMainMessageLoopRun() { - gfx::Screen* screen = Shell::GetInstance()->GetScreen(); - screen->RemoveObserver(window_watcher_.get()); + gfx::Screen::GetScreen()->RemoveObserver(window_watcher_.get()); window_watcher_.reset(); delegate_ = nullptr; diff --git a/ash/shell/toplevel_window.cc b/ash/shell/toplevel_window.cc index ef28e5d..61c7daf 100644 --- a/ash/shell/toplevel_window.cc +++ b/ash/shell/toplevel_window.cc @@ -84,11 +84,7 @@ bool ToplevelWindow::GetSavedWindowPlacement( bounds->SetRect(10, 150, 300, 300); } ash::WindowPositioner::GetBoundsAndShowStateForNewWindow( - ash::Shell::GetScreen(), - NULL, - is_saved_bounds, - *show_state, - bounds, + gfx::Screen::GetScreen(), NULL, is_saved_bounds, *show_state, bounds, show_state); return true; } diff --git a/ash/system/audio/tray_audio.cc b/ash/system/audio/tray_audio.cc index 332dd44..975d692 100644 --- a/ash/system/audio/tray_audio.cc +++ b/ash/system/audio/tray_audio.cc @@ -48,11 +48,11 @@ TrayAudio::TrayAudio(SystemTray* system_tray, volume_view_(NULL), pop_up_volume_view_(false) { Shell::GetInstance()->system_tray_notifier()->AddAudioObserver(this); - Shell::GetScreen()->AddObserver(this); + gfx::Screen::GetScreen()->AddObserver(this); } TrayAudio::~TrayAudio() { - Shell::GetScreen()->RemoveObserver(this); + gfx::Screen::GetScreen()->RemoveObserver(this); Shell::GetInstance()->system_tray_notifier()->RemoveAudioObserver(this); } diff --git a/ash/system/chromeos/rotation/tray_rotation_lock.cc b/ash/system/chromeos/rotation/tray_rotation_lock.cc index 4704586..f288ce3 100644 --- a/ash/system/chromeos/rotation/tray_rotation_lock.cc +++ b/ash/system/chromeos/rotation/tray_rotation_lock.cc @@ -150,7 +150,7 @@ bool TrayRotationLock::ShouldBeVisible() { bool TrayRotationLock::OnPrimaryDisplay() const { gfx::NativeView native_view = system_tray()->GetWidget()->GetNativeView(); gfx::Display parent_display = - Shell::GetScreen()->GetDisplayNearestWindow(native_view); + gfx::Screen::GetScreen()->GetDisplayNearestWindow(native_view); return parent_display.IsInternal(); } diff --git a/ash/system/chromeos/tray_display.cc b/ash/system/chromeos/tray_display.cc index 3018344..d44056a 100644 --- a/ash/system/chromeos/tray_display.cc +++ b/ash/system/chromeos/tray_display.cc @@ -250,7 +250,7 @@ class DisplayView : public ActionableView { if (display_manager->IsInUnifiedMode()) return l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_DISPLAY_UNIFIED); - int64_t primary_id = Shell::GetScreen()->GetPrimaryDisplay().id(); + int64_t primary_id = gfx::Screen::GetScreen()->GetPrimaryDisplay().id(); if (gfx::Display::HasInternalDisplay() && !(gfx::Display::IsInternalDisplayId(primary_id))) { if (additional_message_out) { diff --git a/ash/system/tray/system_tray.cc b/ash/system/tray/system_tray.cc index 396762c..a3130a9 100644 --- a/ash/system/tray/system_tray.cc +++ b/ash/system/tray/system_tray.cc @@ -365,7 +365,7 @@ bool SystemTray::IsMouseInNotificationBubble() const { if (!notification_bubble_) return false; return notification_bubble_->bubble_view()->GetBoundsInScreen().Contains( - Shell::GetScreen()->GetCursorScreenPoint()); + gfx::Screen::GetScreen()->GetCursorScreenPoint()); } bool SystemTray::CloseSystemBubble() const { @@ -595,8 +595,10 @@ void SystemTray::UpdateWebNotifications() { int height = 0; if (bubble_view) { - gfx::Rect work_area = Shell::GetScreen()->GetDisplayNearestWindow( - bubble_view->GetWidget()->GetNativeView()).work_area(); + gfx::Rect work_area = + gfx::Screen::GetScreen() + ->GetDisplayNearestWindow(bubble_view->GetWidget()->GetNativeView()) + .work_area(); if (GetShelfLayoutManager()->GetAlignment() != SHELF_ALIGNMENT_TOP) { height = std::max( 0, work_area.height() - bubble_view->GetBoundsInScreen().y()); diff --git a/ash/system/web_notification/ash_popup_alignment_delegate.cc b/ash/system/web_notification/ash_popup_alignment_delegate.cc index a452f18..84e21a9 100644 --- a/ash/system/web_notification/ash_popup_alignment_delegate.cc +++ b/ash/system/web_notification/ash_popup_alignment_delegate.cc @@ -130,7 +130,7 @@ void AshPopupAlignmentDelegate::UpdateShelf() { } gfx::Display AshPopupAlignmentDelegate::GetCurrentDisplay() const { - return Shell::GetScreen()->GetDisplayNearestWindow( + return gfx::Screen::GetScreen()->GetDisplayNearestWindow( shelf_->shelf_widget()->GetNativeView()); } diff --git a/ash/system/web_notification/ash_popup_alignment_delegate_unittest.cc b/ash/system/web_notification/ash_popup_alignment_delegate_unittest.cc index 9884e4b..29ade18 100644 --- a/ash/system/web_notification/ash_popup_alignment_delegate_unittest.cc +++ b/ash/system/web_notification/ash_popup_alignment_delegate_unittest.cc @@ -60,7 +60,7 @@ class AshPopupAlignmentDelegateTest : public test::AshTestBase { void UpdateWorkArea(AshPopupAlignmentDelegate* alignment_delegate, const gfx::Display& display) { - alignment_delegate->StartObserving(Shell::GetScreen(), display); + alignment_delegate->StartObserving(gfx::Screen::GetScreen(), display); // Update the layout alignment_delegate->OnDisplayWorkAreaInsetsChanged(); } @@ -72,12 +72,12 @@ class AshPopupAlignmentDelegateTest : public test::AshTestBase { } alignment_delegate_ = std::move(delegate); UpdateWorkArea(alignment_delegate_.get(), - Shell::GetScreen()->GetPrimaryDisplay()); + gfx::Screen::GetScreen()->GetPrimaryDisplay()); } Position GetPositionInDisplay(const gfx::Point& point) { const gfx::Rect& work_area = - Shell::GetScreen()->GetPrimaryDisplay().work_area(); + gfx::Screen::GetScreen()->GetPrimaryDisplay().work_area(); const gfx::Point center_point = work_area.CenterPoint(); if (work_area.x() > point.x() || work_area.y() > point.y() || work_area.right() < point.x() || work_area.bottom() < point.y()) { diff --git a/ash/system/web_notification/web_notification_tray.cc b/ash/system/web_notification/web_notification_tray.cc index a2d70a3..4b3c0b5 100644 --- a/ash/system/web_notification/web_notification_tray.cc +++ b/ash/system/web_notification/web_notification_tray.cc @@ -189,9 +189,10 @@ WebNotificationTray::WebNotificationTray(StatusAreaWidget* status_area_widget) message_center(), message_center_tray_.get(), popup_alignment_delegate_.get())); - const gfx::Display& display = Shell::GetScreen()->GetDisplayNearestWindow( - status_area_widget->GetNativeView()); - popup_alignment_delegate_->StartObserving(Shell::GetScreen(), display); + const gfx::Display& display = + gfx::Screen::GetScreen()->GetDisplayNearestWindow( + status_area_widget->GetNativeView()); + popup_alignment_delegate_->StartObserving(gfx::Screen::GetScreen(), display); OnMessageCenterTrayChanged(); } diff --git a/ash/system/web_notification/web_notification_tray_unittest.cc b/ash/system/web_notification/web_notification_tray_unittest.cc index 946e3ce..55cd0ac 100644 --- a/ash/system/web_notification/web_notification_tray_unittest.cc +++ b/ash/system/web_notification/web_notification_tray_unittest.cc @@ -436,7 +436,7 @@ TEST_F(WebNotificationTrayTest, MAYBE_PopupAndFullscreen) { // Move the mouse cursor at the bottom, which shows the shelf. ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow()); gfx::Point bottom_right = - Shell::GetScreen()->GetPrimaryDisplay().bounds().bottom_right(); + gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds().bottom_right(); bottom_right.Offset(-1, -1); generator.MoveMouseTo(bottom_right); shelf->UpdateAutoHideStateNow(); @@ -444,7 +444,7 @@ TEST_F(WebNotificationTrayTest, MAYBE_PopupAndFullscreen) { EXPECT_EQ(bottom, GetPopupWorkAreaBottom()); generator.MoveMouseTo( - Shell::GetScreen()->GetPrimaryDisplay().bounds().CenterPoint()); + gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds().CenterPoint()); shelf->UpdateAutoHideStateNow(); EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); EXPECT_EQ(bottom_auto_hidden, GetPopupWorkAreaBottom()); diff --git a/ash/test/ash_test_base.cc b/ash/test/ash_test_base.cc index 93d770f..6805926 100644 --- a/ash/test/ash_test_base.cc +++ b/ash/test/ash_test_base.cc @@ -61,7 +61,7 @@ class AshEventGeneratorDelegate // aura::test::EventGeneratorDelegateAura overrides: aura::WindowTreeHost* GetHostAt( const gfx::Point& point_in_screen) const override { - gfx::Screen* screen = Shell::GetScreen(); + gfx::Screen* screen = gfx::Screen::GetScreen(); gfx::Display display = screen->GetDisplayNearestPoint(point_in_screen); return Shell::GetInstance() ->window_tree_host_manager() @@ -244,8 +244,7 @@ aura::Window* AshTestBase::CreateTestWindowInShellWithDelegateAndType( if (bounds.IsEmpty()) { ParentWindowInPrimaryRootWindow(window); } else { - gfx::Display display = - Shell::GetScreen()->GetDisplayMatching(bounds); + gfx::Display display = gfx::Screen::GetScreen()->GetDisplayMatching(bounds); aura::Window* root = ash::Shell::GetInstance() ->window_tree_host_manager() ->GetRootWindowForDisplayId(display.id()); diff --git a/ash/test/ui_controls_factory_ash.cc b/ash/test/ui_controls_factory_ash.cc index 26f8c24..2ac98c8 100644 --- a/ash/test/ui_controls_factory_ash.cc +++ b/ash/test/ui_controls_factory_ash.cc @@ -97,7 +97,7 @@ class UIControlsAsh : public UIControlsAura { } bool SendMouseEvents(MouseButton type, int state) override { - gfx::Point p(ash::Shell::GetScreen()->GetCursorScreenPoint()); + gfx::Point p(gfx::Screen::GetScreen()->GetCursorScreenPoint()); UIControlsAura* ui_controls = GetUIControlsAt(p); return ui_controls && ui_controls->SendMouseEvents(type, state); } @@ -112,7 +112,7 @@ class UIControlsAsh : public UIControlsAura { } bool SendMouseClick(MouseButton type) override { - gfx::Point p(ash::Shell::GetScreen()->GetCursorScreenPoint()); + gfx::Point p(gfx::Screen::GetScreen()->GetCursorScreenPoint()); UIControlsAura* ui_controls = GetUIControlsAt(p); return ui_controls && ui_controls->SendMouseClick(type); } diff --git a/ash/touch/touch_observer_hud.cc b/ash/touch/touch_observer_hud.cc index 1ace7fd..72f9a4e 100644 --- a/ash/touch/touch_observer_hud.cc +++ b/ash/touch/touch_observer_hud.cc @@ -46,7 +46,7 @@ TouchObserverHUD::TouchObserverHUD(aura::Window* initial_root) widget_->AddObserver(this); // Observe changes in display size and mode to update touch HUD. - Shell::GetScreen()->AddObserver(this); + gfx::Screen::GetScreen()->AddObserver(this); #if defined(OS_CHROMEOS) Shell::GetInstance()->display_configurator()->AddObserver(this); #endif // defined(OS_CHROMEOS) @@ -61,7 +61,7 @@ TouchObserverHUD::~TouchObserverHUD() { #if defined(OS_CHROMEOS) Shell::GetInstance()->display_configurator()->RemoveObserver(this); #endif // defined(OS_CHROMEOS) - Shell::GetScreen()->RemoveObserver(this); + gfx::Screen::GetScreen()->RemoveObserver(this); widget_->RemoveObserver(this); } diff --git a/ash/touch/touch_observer_hud_unittest.cc b/ash/touch/touch_observer_hud_unittest.cc index e9d544e..8b2e6c8 100644 --- a/ash/touch/touch_observer_hud_unittest.cc +++ b/ash/touch/touch_observer_hud_unittest.cc @@ -45,7 +45,7 @@ class TouchHudTestBase : public test::AshTestBase { } gfx::Display GetPrimaryDisplay() { - return Shell::GetScreen()->GetPrimaryDisplay(); + return gfx::Screen::GetScreen()->GetPrimaryDisplay(); } const gfx::Display& GetSecondaryDisplay() { diff --git a/ash/utility/partial_screenshot_controller.cc b/ash/utility/partial_screenshot_controller.cc index f7ac242..bce3453 100644 --- a/ash/utility/partial_screenshot_controller.cc +++ b/ash/utility/partial_screenshot_controller.cc @@ -15,6 +15,7 @@ #include "ui/events/event.h" #include "ui/events/event_handler.h" #include "ui/gfx/canvas.h" +#include "ui/gfx/screen.h" #include "ui/wm/core/cursor_manager.h" namespace ash { @@ -144,7 +145,7 @@ void PartialScreenshotController::StartPartialScreenshotSession( } screenshot_delegate_ = screenshot_delegate; - Shell::GetScreen()->AddObserver(this); + gfx::Screen::GetScreen()->AddObserver(this); for (aura::Window* root : Shell::GetAllRootWindows()) { layers_[root] = new PartialScreenshotLayer( Shell::GetContainer(root, kShellWindowId_OverlayContainer)->layer()); @@ -185,7 +186,7 @@ void PartialScreenshotController::Complete() { void PartialScreenshotController::Cancel() { root_window_ = nullptr; screenshot_delegate_ = nullptr; - Shell::GetScreen()->RemoveObserver(this); + gfx::Screen::GetScreen()->RemoveObserver(this); STLDeleteValues(&layers_); cursor_setter_.reset(); EnableMouseWarp(true); diff --git a/ash/wm/ash_native_cursor_manager_unittest.cc b/ash/wm/ash_native_cursor_manager_unittest.cc index 5a244af..8c7fe2e 100644 --- a/ash/wm/ash_native_cursor_manager_unittest.cc +++ b/ash/wm/ash_native_cursor_manager_unittest.cc @@ -159,27 +159,30 @@ TEST_F(AshNativeCursorManagerTest, FractionalScale) { #endif TEST_F(AshNativeCursorManagerTest, UIScaleShouldNotChangeCursor) { - int64_t display_id = Shell::GetScreen()->GetPrimaryDisplay().id(); + int64_t display_id = gfx::Screen::GetScreen()->GetPrimaryDisplay().id(); gfx::Display::SetInternalDisplayId(display_id); ::wm::CursorManager* cursor_manager = Shell::GetInstance()->cursor_manager(); CursorManagerTestApi test_api(cursor_manager); SetDisplayUIScale(display_id, 0.5f); - EXPECT_EQ(1.0f, - Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor()); + EXPECT_EQ( + 1.0f, + gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor()); EXPECT_EQ(1.0f, test_api.GetCurrentCursor().device_scale_factor()); SetDisplayUIScale(display_id, 1.0f); // 2x display should keep using 2x cursor regardless of the UI scale. UpdateDisplay("800x800*2"); - EXPECT_EQ(2.0f, - Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor()); + EXPECT_EQ( + 2.0f, + gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor()); EXPECT_EQ(2.0f, test_api.GetCurrentCursor().device_scale_factor()); SetDisplayUIScale(display_id, 2.0f); - EXPECT_EQ(1.0f, - Shell::GetScreen()->GetPrimaryDisplay().device_scale_factor()); + EXPECT_EQ( + 1.0f, + gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor()); EXPECT_EQ(2.0f, test_api.GetCurrentCursor().device_scale_factor()); } diff --git a/ash/wm/coordinate_conversion.cc b/ash/wm/coordinate_conversion.cc index c09448c..e591f3f 100644 --- a/ash/wm/coordinate_conversion.cc +++ b/ash/wm/coordinate_conversion.cc @@ -17,7 +17,7 @@ namespace wm { aura::Window* GetRootWindowAt(const gfx::Point& point) { const gfx::Display& display = - Shell::GetScreen()->GetDisplayNearestPoint(point); + gfx::Screen::GetScreen()->GetDisplayNearestPoint(point); DCHECK(display.is_valid()); // TODO(yusukes): Move coordinate_conversion.cc and .h to ui/aura/ once // GetRootWindowForDisplayId() is moved to aura::Env. @@ -27,7 +27,8 @@ aura::Window* GetRootWindowAt(const gfx::Point& point) { } aura::Window* GetRootWindowMatching(const gfx::Rect& rect) { - const gfx::Display& display = Shell::GetScreen()->GetDisplayMatching(rect); + const gfx::Display& display = + gfx::Screen::GetScreen()->GetDisplayMatching(rect); return Shell::GetInstance() ->window_tree_host_manager() ->GetRootWindowForDisplayId(display.id()); diff --git a/ash/wm/default_state.cc b/ash/wm/default_state.cc index c1897e6..c5a1972 100644 --- a/ash/wm/default_state.cc +++ b/ash/wm/default_state.cc @@ -54,12 +54,13 @@ void MoveToDisplayForRestore(WindowState* window_state) { // TODO(oshima): Restore information should contain the // work area information like WindowResizer does for the // last window location. - gfx::Rect display_area = Shell::GetScreen()->GetDisplayNearestWindow( - window_state->window()).bounds(); + gfx::Rect display_area = gfx::Screen::GetScreen() + ->GetDisplayNearestWindow(window_state->window()) + .bounds(); if (!display_area.Intersects(restore_bounds)) { const gfx::Display& display = - Shell::GetScreen()->GetDisplayMatching(restore_bounds); + gfx::Screen::GetScreen()->GetDisplayMatching(restore_bounds); WindowTreeHostManager* window_tree_host_manager = Shell::GetInstance()->window_tree_host_manager(); aura::Window* new_root = @@ -260,8 +261,8 @@ void DefaultState::AttachState( // If the display has changed while in the another mode, // we need to let windows know the change. - gfx::Display current_display = Shell::GetScreen()-> - GetDisplayNearestWindow(window_state->window()); + gfx::Display current_display = + gfx::Screen::GetScreen()->GetDisplayNearestWindow(window_state->window()); if (stored_display_state_.bounds() != current_display.bounds()) { const WMEvent event(wm::WM_EVENT_DISPLAY_BOUNDS_CHANGED); window_state->OnWMEvent(&event); @@ -281,8 +282,8 @@ void DefaultState::DetachState(WindowState* window_state) { // while in the other mode, we can perform necessary action to // restore the window state to the proper state for the current // display. - stored_display_state_ = Shell::GetScreen()-> - GetDisplayNearestWindow(window_state->window()); + stored_display_state_ = + gfx::Screen::GetScreen()->GetDisplayNearestWindow(window_state->window()); } // static @@ -739,7 +740,7 @@ void DefaultState::CenterWindow(WindowState* window_state) { aura::Window* window = window_state->window(); if (window_state->IsSnapped()) { gfx::Rect center_in_screen = - Shell::GetScreen()->GetDisplayNearestWindow(window).work_area(); + gfx::Screen::GetScreen()->GetDisplayNearestWindow(window).work_area(); gfx::Size size = window_state->HasRestoreBounds() ? window_state->GetRestoreBoundsInScreen().size() : window->bounds().size(); diff --git a/ash/wm/dock/docked_window_layout_manager.cc b/ash/wm/dock/docked_window_layout_manager.cc index 653d09a..d79bcac 100644 --- a/ash/wm/dock/docked_window_layout_manager.cc +++ b/ash/wm/dock/docked_window_layout_manager.cc @@ -614,8 +614,9 @@ bool DockedWindowLayoutManager::CanDockWindow( } // If a window is tall and cannot be resized down to maximum height allowed // then it cannot be docked. - const gfx::Rect work_area = - Shell::GetScreen()->GetDisplayNearestWindow(dock_container_).work_area(); + const gfx::Rect work_area = gfx::Screen::GetScreen() + ->GetDisplayNearestWindow(dock_container_) + .work_area(); if (GetWindowHeightCloseTo(window, work_area.height()) > work_area.height()) return false; // Cannot dock on the other size from an existing dock. @@ -932,8 +933,9 @@ void DockedWindowLayoutManager::OnWindowActivated( void DockedWindowLayoutManager::MaybeMinimizeChildrenExcept( aura::Window* child) { // Minimize any windows that don't fit without overlap. - const gfx::Rect work_area = - Shell::GetScreen()->GetDisplayNearestWindow(dock_container_).work_area(); + const gfx::Rect work_area = gfx::Screen::GetScreen() + ->GetDisplayNearestWindow(dock_container_) + .work_area(); int available_room = work_area.height(); bool gap_needed = !!child; if (child) @@ -978,8 +980,8 @@ void DockedWindowLayoutManager::RestoreDockedWindow( // Always place restored window at the bottom shuffling the other windows up. // TODO(varkha): add a separate container for docked windows to keep track // of ordering. - gfx::Display display = Shell::GetScreen()->GetDisplayNearestWindow( - dock_container_); + gfx::Display display = + gfx::Screen::GetScreen()->GetDisplayNearestWindow(dock_container_); const gfx::Rect work_area = display.work_area(); // Evict the window if it can no longer be docked because of its height. @@ -1112,8 +1114,9 @@ void DockedWindowLayoutManager::Relayout() { } // Position docked windows as well as the window being dragged. - gfx::Rect work_area = - Shell::GetScreen()->GetDisplayNearestWindow(dock_container_).work_area(); + gfx::Rect work_area = gfx::Screen::GetScreen() + ->GetDisplayNearestWindow(dock_container_) + .work_area(); if (shelf_observer_) work_area.Subtract(shelf_observer_->shelf_bounds_in_screen()); int available_room = CalculateWindowHeightsAndRemainingRoom(work_area, @@ -1276,8 +1279,9 @@ void DockedWindowLayoutManager::FanOutChildren( void DockedWindowLayoutManager::UpdateDockBounds( DockedWindowLayoutManagerObserver::Reason reason) { int dock_inset = docked_width_ + (docked_width_ > 0 ? kMinDockGap : 0); - const gfx::Rect work_area = - Shell::GetScreen()->GetDisplayNearestWindow(dock_container_).work_area(); + const gfx::Rect work_area = gfx::Screen::GetScreen() + ->GetDisplayNearestWindow(dock_container_) + .work_area(); gfx::Rect bounds = gfx::Rect( alignment_ == DOCKED_ALIGNMENT_RIGHT && dock_inset > 0 ? dock_container_->bounds().right() - dock_inset: diff --git a/ash/wm/dock/docked_window_layout_manager_unittest.cc b/ash/wm/dock/docked_window_layout_manager_unittest.cc index 9f007211..2baad5e 100644 --- a/ash/wm/dock/docked_window_layout_manager_unittest.cc +++ b/ash/wm/dock/docked_window_layout_manager_unittest.cc @@ -186,7 +186,7 @@ class DockedWindowLayoutManagerTest ASSERT_NO_FATAL_FAILURE(DragStartAtOffsetFromwindowOrigin(window, 25, 5)); gfx::Rect work_area = - Shell::GetScreen()->GetDisplayNearestWindow(window).work_area(); + gfx::Screen::GetScreen()->GetDisplayNearestWindow(window).work_area(); gfx::Point initial_location_in_screen = initial_location_in_parent_; ::wm::ConvertPointToScreen(window->parent(), &initial_location_in_screen); // Drag the window left or right to the edge (or almost to it). @@ -428,7 +428,7 @@ TEST_P(DockedWindowLayoutManagerTest, AddTwoWindows) { // Test that the gaps differ at most by a single pixel. gfx::Rect work_area = - Shell::GetScreen()->GetDisplayNearestWindow(w1.get()).work_area(); + gfx::Screen::GetScreen()->GetDisplayNearestWindow(w1.get()).work_area(); int gap1 = w1->GetBoundsInScreen().y(); int gap2 = w2->GetBoundsInScreen().y() - w1->GetBoundsInScreen().bottom(); int gap3 = work_area.bottom() - w2->GetBoundsInScreen().bottom(); @@ -462,7 +462,7 @@ TEST_P(DockedWindowLayoutManagerTest, TwoWindowsDragging) { // Test the new windows order and that the gaps differ at most by a pixel. gfx::Rect work_area = - Shell::GetScreen()->GetDisplayNearestWindow(w1.get()).work_area(); + gfx::Screen::GetScreen()->GetDisplayNearestWindow(w1.get()).work_area(); int gap1 = w2->GetBoundsInScreen().y() - work_area.y(); int gap2 = w1->GetBoundsInScreen().y() - w2->GetBoundsInScreen().bottom(); int gap3 = work_area.bottom() - w1->GetBoundsInScreen().bottom(); @@ -498,7 +498,7 @@ TEST_P(DockedWindowLayoutManagerTest, ThreeWindowsDragging) { // Test that the top and bottom windows are clamped in work area and // that the gaps between the windows differ at most by a pixel. gfx::Rect work_area = - Shell::GetScreen()->GetDisplayNearestWindow(w1.get()).work_area(); + gfx::Screen::GetScreen()->GetDisplayNearestWindow(w1.get()).work_area(); int gap1 = w1->GetBoundsInScreen().y() - work_area.y(); int gap2 = w2->GetBoundsInScreen().y() - w1->GetBoundsInScreen().bottom(); int gap3 = w3->GetBoundsInScreen().y() - w2->GetBoundsInScreen().bottom(); @@ -542,7 +542,7 @@ TEST_P(DockedWindowLayoutManagerTest, ThreeWindowsDraggingSecondScreen) { UpdateDisplay("600x1000,600x1000"); // Layout the secondary display to the bottom of the primary. DisplayLayout layout(DisplayLayout::BOTTOM, 0); - ASSERT_GT(Shell::GetScreen()->GetNumDisplays(), 1); + ASSERT_GT(gfx::Screen::GetScreen()->GetNumDisplays(), 1); Shell::GetInstance()->display_manager()-> SetLayoutForCurrentDisplays(layout); @@ -565,7 +565,7 @@ TEST_P(DockedWindowLayoutManagerTest, ThreeWindowsDraggingSecondScreen) { EXPECT_EQ(kShellWindowId_DockedContainer, w3->parent()->id()); gfx::Rect work_area = - Shell::GetScreen()->GetDisplayNearestWindow(w1.get()).work_area(); + gfx::Screen::GetScreen()->GetDisplayNearestWindow(w1.get()).work_area(); // Test that the top and bottom windows are clamped in work area and // that the overlaps between the windows differ at most by a pixel. int gap1 = w1->GetBoundsInScreen().y() - work_area.y(); @@ -761,7 +761,7 @@ TEST_P(DockedWindowLayoutManagerTest, ThreeWindowsSplitHeightEvenly) { // The two windows should be same size vertically and almost 1/2 of work area. gfx::Rect work_area = - Shell::GetScreen()->GetDisplayNearestWindow(w1.get()).work_area(); + gfx::Screen::GetScreen()->GetDisplayNearestWindow(w1.get()).work_area(); EXPECT_NEAR(w1->GetBoundsInScreen().height(), w2->GetBoundsInScreen().height(), 1); @@ -823,7 +823,7 @@ TEST_P(DockedWindowLayoutManagerTest, TwoWindowsHeightRestrictions) { // w1 should be more than half of the work area height (even with a margin). // w2 should be less than half of the work area height (even with a margin). gfx::Rect work_area = - Shell::GetScreen()->GetDisplayNearestWindow(w1.get()).work_area(); + gfx::Screen::GetScreen()->GetDisplayNearestWindow(w1.get()).work_area(); EXPECT_GT(w1->GetBoundsInScreen().height(), work_area.height() / 2 + 10); EXPECT_LT(w2->GetBoundsInScreen().height(), work_area.height() / 2 - 10); } @@ -851,8 +851,9 @@ TEST_P(DockedWindowLayoutManagerTest, DisplayDisconnectionMovesDocked) { window->GetBoundsInScreen().right()); EXPECT_EQ(kShellWindowId_DockedContainer, window->parent()->id()); EXPECT_EQ(ideal_width(), window->bounds().width()); - gfx::Rect work_area = - Shell::GetScreen()->GetDisplayNearestWindow(window.get()).work_area(); + gfx::Rect work_area = gfx::Screen::GetScreen() + ->GetDisplayNearestWindow(window.get()) + .work_area(); EXPECT_EQ(work_area.height(), window->GetBoundsInScreen().height()); } diff --git a/ash/wm/dock/docked_window_resizer_unittest.cc b/ash/wm/dock/docked_window_resizer_unittest.cc index a96c262..8232bb3 100644 --- a/ash/wm/dock/docked_window_resizer_unittest.cc +++ b/ash/wm/dock/docked_window_resizer_unittest.cc @@ -100,7 +100,7 @@ class DockedWindowResizerTest ParentWindowInPrimaryRootWindow(window); } else { gfx::Display display = - Shell::GetScreen()->GetDisplayMatching(bounds); + gfx::Screen::GetScreen()->GetDisplayMatching(bounds); aura::Window* root = ash::Shell::GetInstance() ->window_tree_host_manager() ->GetRootWindowForDisplayId(display.id()); @@ -214,7 +214,7 @@ class DockedWindowResizerTest grab_x, grab_y)); gfx::Rect work_area = - Shell::GetScreen()->GetDisplayNearestWindow(window).work_area(); + gfx::Screen::GetScreen()->GetDisplayNearestWindow(window).work_area(); gfx::Point initial_location_in_screen = initial_location_in_parent_; ::wm::ConvertPointToScreen(window->parent(), &initial_location_in_screen); // Drag the window left or right to the edge (or almost to it). @@ -597,7 +597,7 @@ TEST_P(DockedWindowResizerTest, AttachOneAutoHideShelf) { EXPECT_TRUE(wm::GetWindowState(w2.get())->IsMaximized()); gfx::Rect work_area = - Shell::GetScreen()->GetDisplayNearestWindow(w1.get()).work_area(); + gfx::Screen::GetScreen()->GetDisplayNearestWindow(w1.get()).work_area(); DockedWindowLayoutManager* manager = static_cast<DockedWindowLayoutManager*>(w1->parent()->layout_manager()); @@ -611,7 +611,7 @@ TEST_P(DockedWindowResizerTest, AttachOneAutoHideShelf) { shell->SetShelfAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, shell->GetPrimaryRootWindow()); work_area = - Shell::GetScreen()->GetDisplayNearestWindow(w1.get()).work_area(); + gfx::Screen::GetScreen()->GetDisplayNearestWindow(w1.get()).work_area(); // Docked window should be centered vertically in the work area. EXPECT_EQ(work_area.CenterPoint().y(), w1->bounds().CenterPoint().y()); // Docked background should extend to the bottom of work area. diff --git a/ash/wm/drag_window_resizer.cc b/ash/wm/drag_window_resizer.cc index f6a714c2..765dd17 100644 --- a/ash/wm/drag_window_resizer.cc +++ b/ash/wm/drag_window_resizer.cc @@ -100,7 +100,7 @@ void DragWindowResizer::CompleteDrag() { gfx::Point last_mouse_location_in_screen = last_mouse_location_; ::wm::ConvertPointToScreen(GetTarget()->parent(), &last_mouse_location_in_screen); - gfx::Screen* screen = Shell::GetScreen(); + gfx::Screen* screen = gfx::Screen::GetScreen(); const gfx::Display dst_display = screen->GetDisplayNearestPoint(last_mouse_location_in_screen); @@ -190,7 +190,7 @@ void DragWindowResizer::UpdateDragWindow(const gfx::Rect& bounds, drag_window_controller = new DragWindowController(GetTarget()); // Always show the drag phantom on the |another_root| window. drag_window_controller->SetDestinationDisplay( - Shell::GetScreen()->GetDisplayNearestWindow(another_root)); + gfx::Screen::GetScreen()->GetDisplayNearestWindow(another_root)); drag_window_controller->Show(); } else { // No animation. diff --git a/ash/wm/drag_window_resizer_unittest.cc b/ash/wm/drag_window_resizer_unittest.cc index 2b3faa3..0fdd488 100644 --- a/ash/wm/drag_window_resizer_unittest.cc +++ b/ash/wm/drag_window_resizer_unittest.cc @@ -156,7 +156,7 @@ TEST_F(DragWindowResizerTest, WindowDragWithMultiDisplays) { ASSERT_EQ(2U, root_windows.size()); window_->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60), - Shell::GetScreen()->GetPrimaryDisplay()); + gfx::Screen::GetScreen()->GetPrimaryDisplay()); EXPECT_EQ(root_windows[0], window_->GetRootWindow()); { // Grab (0, 0) of the window. @@ -174,7 +174,7 @@ TEST_F(DragWindowResizerTest, WindowDragWithMultiDisplays) { } window_->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60), - Shell::GetScreen()->GetPrimaryDisplay()); + gfx::Screen::GetScreen()->GetPrimaryDisplay()); EXPECT_EQ(root_windows[0], window_->GetRootWindow()); { // Grab (0, 0) of the window and move the pointer to (775, 10). @@ -193,7 +193,7 @@ TEST_F(DragWindowResizerTest, WindowDragWithMultiDisplays) { } window_->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60), - Shell::GetScreen()->GetPrimaryDisplay()); + gfx::Screen::GetScreen()->GetPrimaryDisplay()); EXPECT_EQ(root_windows[0], window_->GetRootWindow()); { // Grab the top-right edge of the window and move the pointer to (0, 10) @@ -216,7 +216,7 @@ TEST_F(DragWindowResizerTest, WindowDragWithMultiDisplays) { // Dropping a window that is larger than the destination work area // will shrink to fit to the work area. window_->SetBoundsInScreen(gfx::Rect(0, 0, 700, 500), - Shell::GetScreen()->GetPrimaryDisplay()); + gfx::Screen::GetScreen()->GetPrimaryDisplay()); EXPECT_EQ(root_windows[0], window_->GetRootWindow()); { // Grab the top-right edge of the window and move the pointer to (0, 10) @@ -241,7 +241,7 @@ TEST_F(DragWindowResizerTest, WindowDragWithMultiDisplays) { // Dropping a window that is larger than the destination work area // will shrink to fit to the work area. window_->SetBoundsInScreen(gfx::Rect(0, 0, 700, 500), - Shell::GetScreen()->GetPrimaryDisplay()); + gfx::Screen::GetScreen()->GetPrimaryDisplay()); EXPECT_EQ(root_windows[0], window_->GetRootWindow()); { // Grab the top-left edge of the window and move the pointer to (150, 10) @@ -283,7 +283,7 @@ TEST_F(DragWindowResizerTest, WindowDragWithMultiDisplaysActiveRoot) { window->Init(ui::LAYER_TEXTURED); ParentWindowInPrimaryRootWindow(window.get()); window->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60), - Shell::GetScreen()->GetPrimaryDisplay()); + gfx::Screen::GetScreen()->GetPrimaryDisplay()); window->Show(); EXPECT_TRUE(ash::wm::CanActivateWindow(window.get())); ash::wm::ActivateWindow(window.get()); @@ -316,7 +316,7 @@ TEST_F(DragWindowResizerTest, WindowDragWithMultiDisplaysRightToLeft) { window_->SetBoundsInScreen( gfx::Rect(800, 00, 50, 60), - Shell::GetScreen()->GetDisplayNearestWindow(root_windows[1])); + gfx::Screen::GetScreen()->GetDisplayNearestWindow(root_windows[1])); EXPECT_EQ(root_windows[1], window_->GetRootWindow()); { // Grab (0, 0) of the window. @@ -342,7 +342,7 @@ TEST_F(DragWindowResizerTest, DragWindowController) { ASSERT_EQ(2U, root_windows.size()); window_->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60), - Shell::GetScreen()->GetPrimaryDisplay()); + gfx::Screen::GetScreen()->GetPrimaryDisplay()); EXPECT_EQ(root_windows[0], window_->GetRootWindow()); EXPECT_FLOAT_EQ(1.0f, window_->layer()->opacity()); { @@ -396,7 +396,7 @@ TEST_F(DragWindowResizerTest, DragWindowController) { // Do the same test with RevertDrag(). window_->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60), - Shell::GetScreen()->GetPrimaryDisplay()); + gfx::Screen::GetScreen()->GetPrimaryDisplay()); EXPECT_EQ(root_windows[0], window_->GetRootWindow()); EXPECT_FLOAT_EQ(1.0f, window_->layer()->opacity()); { @@ -476,7 +476,7 @@ TEST_F(DragWindowResizerTest, CursorDeviceScaleFactor) { // window with 2.0 device scale factor. { window_->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60), - Shell::GetScreen()->GetPrimaryDisplay()); + gfx::Screen::GetScreen()->GetPrimaryDisplay()); EXPECT_EQ(root_windows[0], window_->GetRootWindow()); // Grab (0, 0) of the window. scoped_ptr<WindowResizer> resizer(CreateDragWindowResizer( @@ -500,7 +500,7 @@ TEST_F(DragWindowResizerTest, CursorDeviceScaleFactor) { default_container->AddChild(window_.get()); window_->SetBoundsInScreen( gfx::Rect(600, 0, 50, 60), - Shell::GetScreen()->GetDisplayNearestWindow(root_windows[1])); + gfx::Screen::GetScreen()->GetDisplayNearestWindow(root_windows[1])); EXPECT_EQ(root_windows[1], window_->GetRootWindow()); // Grab (0, 0) of the window. scoped_ptr<WindowResizer> resizer(CreateDragWindowResizer( @@ -531,7 +531,7 @@ TEST_F(DragWindowResizerTest, MoveWindowAcrossDisplays) { { aura::Window* window = window_.get(); window->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60), - Shell::GetScreen()->GetPrimaryDisplay()); + gfx::Screen::GetScreen()->GetPrimaryDisplay()); // Grab (0, 0) of the window. scoped_ptr<WindowResizer> resizer(CreateDragWindowResizer( window, gfx::Point(), HTCAPTION)); @@ -547,7 +547,7 @@ TEST_F(DragWindowResizerTest, MoveWindowAcrossDisplays) { { aura::Window* window = always_on_top_window_.get(); window->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60), - Shell::GetScreen()->GetPrimaryDisplay()); + gfx::Screen::GetScreen()->GetPrimaryDisplay()); // Grab (0, 0) of the window. scoped_ptr<WindowResizer> resizer(CreateDragWindowResizer( window, gfx::Point(), HTCAPTION)); @@ -563,7 +563,7 @@ TEST_F(DragWindowResizerTest, MoveWindowAcrossDisplays) { { aura::Window* window = system_modal_window_.get(); window->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60), - Shell::GetScreen()->GetPrimaryDisplay()); + gfx::Screen::GetScreen()->GetPrimaryDisplay()); aura::Env::GetInstance()->set_last_mouse_location(gfx::Point(0, 0)); // Grab (0, 0) of the window. scoped_ptr<WindowResizer> resizer(CreateDragWindowResizer( @@ -580,7 +580,7 @@ TEST_F(DragWindowResizerTest, MoveWindowAcrossDisplays) { { aura::Window* window = transient_child_; window->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60), - Shell::GetScreen()->GetPrimaryDisplay()); + gfx::Screen::GetScreen()->GetPrimaryDisplay()); // Grab (0, 0) of the window. scoped_ptr<WindowResizer> resizer(CreateDragWindowResizer( window, gfx::Point(), HTCAPTION)); @@ -596,7 +596,7 @@ TEST_F(DragWindowResizerTest, MoveWindowAcrossDisplays) { { aura::Window* window = transient_parent_.get(); window->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60), - Shell::GetScreen()->GetPrimaryDisplay()); + gfx::Screen::GetScreen()->GetPrimaryDisplay()); // Grab (0, 0) of the window. scoped_ptr<WindowResizer> resizer(CreateDragWindowResizer( window, gfx::Point(), HTCAPTION)); @@ -612,7 +612,7 @@ TEST_F(DragWindowResizerTest, MoveWindowAcrossDisplays) { { aura::Window* window = panel_window_.get(); window->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60), - Shell::GetScreen()->GetPrimaryDisplay()); + gfx::Screen::GetScreen()->GetPrimaryDisplay()); // Grab (0, 0) of the window. scoped_ptr<WindowResizer> resizer(CreateDragWindowResizer( window, gfx::Point(), HTCAPTION)); diff --git a/ash/wm/immersive_fullscreen_controller.cc b/ash/wm/immersive_fullscreen_controller.cc index 5383236..7d0a851 100644 --- a/ash/wm/immersive_fullscreen_controller.cc +++ b/ash/wm/immersive_fullscreen_controller.cc @@ -99,7 +99,7 @@ gfx::Point GetEventLocationInScreen(const ui::LocatedEvent& event) { // Returns the bounds of the display nearest to |window| in screen coordinates. gfx::Rect GetDisplayBoundsInScreen(aura::Window* window) { - return Shell::GetScreen()->GetDisplayNearestWindow(window).bounds(); + return gfx::Screen::GetScreen()->GetDisplayNearestWindow(window).bounds(); } } // namespace @@ -926,7 +926,7 @@ bool ImmersiveFullscreenController::ShouldHandleGestureEvent( // closest screen ensures that the event is from a valid bezel (as opposed to // another screen in an extended desktop). gfx::Rect screen_bounds = - Shell::GetScreen()->GetDisplayNearestPoint(location).bounds(); + gfx::Screen::GetScreen()->GetDisplayNearestPoint(location).bounds(); return (!screen_bounds.Contains(location) && location.y() < hit_bounds_in_screen.y() && location.x() >= hit_bounds_in_screen.x() && diff --git a/ash/wm/lock_layout_manager_unittest.cc b/ash/wm/lock_layout_manager_unittest.cc index 5439a72..9d56ab7 100644 --- a/ash/wm/lock_layout_manager_unittest.cc +++ b/ash/wm/lock_layout_manager_unittest.cc @@ -105,7 +105,8 @@ class LockLayoutManagerTest : public AshTestBase { }; TEST_F(LockLayoutManagerTest, NorwmalWindowBoundsArePreserved) { - gfx::Rect screen_bounds = Shell::GetScreen()->GetPrimaryDisplay().bounds(); + gfx::Rect screen_bounds = + gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds(); views::Widget::InitParams widget_params( views::Widget::InitParams::TYPE_WINDOW); @@ -131,7 +132,8 @@ TEST_F(LockLayoutManagerTest, MaximizedFullscreenWindowBoundsAreEqualToScreen) { if (!SupportsHostWindowResize()) return; - gfx::Rect screen_bounds = Shell::GetScreen()->GetPrimaryDisplay().bounds(); + gfx::Rect screen_bounds = + gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds(); views::Widget::InitParams widget_params( views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); @@ -183,7 +185,7 @@ TEST_F(LockLayoutManagerTest, KeyboardBounds) { if (!SupportsHostWindowResize()) return; - gfx::Display primary_display = Shell::GetScreen()->GetPrimaryDisplay(); + gfx::Display primary_display = gfx::Screen::GetScreen()->GetPrimaryDisplay(); gfx::Rect screen_bounds = primary_display.bounds(); views::Widget::InitParams widget_params( @@ -219,7 +221,7 @@ TEST_F(LockLayoutManagerTest, KeyboardBounds) { display_manager->SetDisplayRotation(primary_display.id(), gfx::Display::ROTATE_90, gfx::Display::ROTATION_SOURCE_ACTIVE); - primary_display = Shell::GetScreen()->GetPrimaryDisplay(); + primary_display = gfx::Screen::GetScreen()->GetPrimaryDisplay(); screen_bounds = primary_display.bounds(); EXPECT_EQ(screen_bounds.ToString(), window->GetBoundsInScreen().ToString()); display_manager->SetDisplayRotation(primary_display.id(), @@ -233,7 +235,7 @@ TEST_F(LockLayoutManagerTest, KeyboardBounds) { ShowKeyboard(true); keyboard::KeyboardController* keyboard = keyboard::KeyboardController::GetInstance(); - primary_display = Shell::GetScreen()->GetPrimaryDisplay(); + primary_display = gfx::Screen::GetScreen()->GetPrimaryDisplay(); screen_bounds = primary_display.bounds(); gfx::Rect target_bounds(screen_bounds); target_bounds.set_height( @@ -251,7 +253,8 @@ TEST_F(LockLayoutManagerTest, MultipleMonitors) { return; UpdateDisplay("300x400,400x500"); - gfx::Rect screen_bounds = Shell::GetScreen()->GetPrimaryDisplay().bounds(); + gfx::Rect screen_bounds = + gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds(); aura::Window::Windows root_windows = Shell::GetAllRootWindows(); views::Widget::InitParams widget_params( diff --git a/ash/wm/maximize_mode/maximize_mode_window_manager.cc b/ash/wm/maximize_mode/maximize_mode_window_manager.cc index 7adcc00..d414ce1 100644 --- a/ash/wm/maximize_mode/maximize_mode_window_manager.cc +++ b/ash/wm/maximize_mode/maximize_mode_window_manager.cc @@ -47,7 +47,7 @@ MaximizeModeWindowManager::~MaximizeModeWindowManager() { Shell::GetInstance()->RemovePreTargetHandler(this); Shell::GetInstance()->RemoveShellObserver(this); - Shell::GetScreen()->RemoveObserver(this); + gfx::Screen::GetScreen()->RemoveObserver(this); EnableBackdropBehindTopWindowOnEachDisplay(false); RemoveWindowCreationObservers(); RestoreAllWindows(); @@ -195,7 +195,7 @@ MaximizeModeWindowManager::MaximizeModeWindowManager() MaximizeAllWindows(); AddWindowCreationObservers(); EnableBackdropBehindTopWindowOnEachDisplay(true); - Shell::GetScreen()->AddObserver(this); + gfx::Screen::GetScreen()->AddObserver(this); Shell::GetInstance()->AddShellObserver(this); Shell::GetInstance()->AddPreTargetHandler(this); } diff --git a/ash/wm/maximize_mode/maximize_mode_window_manager_unittest.cc b/ash/wm/maximize_mode/maximize_mode_window_manager_unittest.cc index 78d2933..2d62e12 100644 --- a/ash/wm/maximize_mode/maximize_mode_window_manager_unittest.cc +++ b/ash/wm/maximize_mode/maximize_mode_window_manager_unittest.cc @@ -102,8 +102,10 @@ class MaximizeModeWindowManagerTest : public test::AshTestBase { // Resize our desktop. void ResizeDesktop(int width_delta) { - gfx::Size size = Shell::GetScreen()->GetDisplayNearestWindow( - Shell::GetPrimaryRootWindow()).size(); + gfx::Size size = + gfx::Screen::GetScreen() + ->GetDisplayNearestWindow(Shell::GetPrimaryRootWindow()) + .size(); size.Enlarge(0, width_delta); UpdateDisplay(size.ToString()); } diff --git a/ash/wm/overview/window_selector.cc b/ash/wm/overview/window_selector.cc index 50d82da..c940dff 100644 --- a/ash/wm/overview/window_selector.cc +++ b/ash/wm/overview/window_selector.cc @@ -321,7 +321,7 @@ void WindowSelector::Init(const WindowList& windows) { shell->activation_client()->AddObserver(this); - shell->GetScreen()->AddObserver(this); + gfx::Screen::GetScreen()->AddObserver(this); shell->metrics()->RecordUserMetricsAction(UMA_WINDOW_OVERVIEW); // Send an a11y alert. shell->accessibility_delegate()->TriggerAccessibilityAlert( @@ -385,7 +385,7 @@ void WindowSelector::RemoveAllObservers() { window->RemoveObserver(this); shell->activation_client()->RemoveObserver(this); - shell->GetScreen()->RemoveObserver(this); + gfx::Screen::GetScreen()->RemoveObserver(this); if (restore_focus_window_) restore_focus_window_->RemoveObserver(this); } diff --git a/ash/wm/panels/panel_window_resizer.cc b/ash/wm/panels/panel_window_resizer.cc index 57a8de5..7d94aa5 100644 --- a/ash/wm/panels/panel_window_resizer.cc +++ b/ash/wm/panels/panel_window_resizer.cc @@ -58,7 +58,7 @@ void PanelWindowResizer::Drag(const gfx::Point& location, int event_flags) { } // Check if the destination has changed displays. - gfx::Screen* screen = Shell::GetScreen(); + gfx::Screen* screen = gfx::Screen::GetScreen(); const gfx::Display dst_display = screen->GetDisplayNearestPoint(last_location_); if (dst_display.id() != diff --git a/ash/wm/system_gesture_event_filter_unittest.cc b/ash/wm/system_gesture_event_filter_unittest.cc index f874bec..6bb3700 100644 --- a/ash/wm/system_gesture_event_filter_unittest.cc +++ b/ash/wm/system_gesture_event_filter_unittest.cc @@ -477,8 +477,9 @@ TEST_F(SystemGestureEventFilterTest, DragLeftNearEdgeSnaps) { ui::test::EventGenerator generator(root_window, toplevel_window); // Check that dragging left snaps before reaching the screen edge. - gfx::Rect work_area = - Shell::GetScreen()->GetDisplayNearestWindow(root_window).work_area(); + gfx::Rect work_area = gfx::Screen::GetScreen() + ->GetDisplayNearestWindow(root_window) + .work_area(); int drag_x = work_area.x() + 20 - points[0].x(); generator.GestureMultiFingerScroll( kTouchPoints, points, 120, kSteps, drag_x, 0); @@ -505,8 +506,9 @@ TEST_F(SystemGestureEventFilterTest, DragRightNearEdgeSnaps) { ui::test::EventGenerator generator(root_window, toplevel_window); // Check that dragging right snaps before reaching the screen edge. - gfx::Rect work_area = - Shell::GetScreen()->GetDisplayNearestWindow(root_window).work_area(); + gfx::Rect work_area = gfx::Screen::GetScreen() + ->GetDisplayNearestWindow(root_window) + .work_area(); int drag_x = work_area.right() - 20 - points[0].x(); generator.GestureMultiFingerScroll( kTouchPoints, points, 120, kSteps, drag_x, 0); diff --git a/ash/wm/toplevel_window_event_handler_unittest.cc b/ash/wm/toplevel_window_event_handler_unittest.cc index 0322dde..749d5fc 100644 --- a/ash/wm/toplevel_window_event_handler_unittest.cc +++ b/ash/wm/toplevel_window_event_handler_unittest.cc @@ -305,8 +305,9 @@ TEST_F(ToplevelWindowEventHandlerTest, BottomRightPastMinimum) { TEST_F(ToplevelWindowEventHandlerTest, BottomRightWorkArea) { scoped_ptr<aura::Window> target(CreateWindow(HTBOTTOMRIGHT)); - gfx::Rect work_area = Shell::GetScreen()->GetDisplayNearestWindow( - target.get()).work_area(); + gfx::Rect work_area = gfx::Screen::GetScreen() + ->GetDisplayNearestWindow(target.get()) + .work_area(); gfx::Point position = target->bounds().origin(); // Drag further than work_area bottom. DragFromCenterBy(target.get(), 100, work_area.height()); @@ -320,8 +321,9 @@ TEST_F(ToplevelWindowEventHandlerTest, BottomRightWorkArea) { TEST_F(ToplevelWindowEventHandlerTest, BottomLeftWorkArea) { scoped_ptr<aura::Window> target(CreateWindow(HTBOTTOMLEFT)); - gfx::Rect work_area = Shell::GetScreen()->GetDisplayNearestWindow( - target.get()).work_area(); + gfx::Rect work_area = gfx::Screen::GetScreen() + ->GetDisplayNearestWindow(target.get()) + .work_area(); gfx::Point position = target->bounds().origin(); // Drag further than work_area bottom. DragFromCenterBy(target.get(), -30, work_area.height()); @@ -336,8 +338,9 @@ TEST_F(ToplevelWindowEventHandlerTest, BottomLeftWorkArea) { TEST_F(ToplevelWindowEventHandlerTest, BottomWorkArea) { scoped_ptr<aura::Window> target(CreateWindow(HTBOTTOM)); - gfx::Rect work_area = Shell::GetScreen()->GetDisplayNearestWindow( - target.get()).work_area(); + gfx::Rect work_area = gfx::Screen::GetScreen() + ->GetDisplayNearestWindow(target.get()) + .work_area(); gfx::Point position = target->bounds().origin(); // Drag further than work_area bottom. DragFromCenterBy(target.get(), 0, work_area.height()); @@ -383,8 +386,8 @@ TEST_F(ToplevelWindowEventHandlerTest, DontDragToNegativeY) { // Verifies we don't let windows go bigger than the display width. TEST_F(ToplevelWindowEventHandlerTest, DontGotWiderThanScreen) { scoped_ptr<aura::Window> target(CreateWindow(HTRIGHT)); - gfx::Rect work_area = Shell::GetScreen()->GetDisplayNearestWindow( - target.get()).bounds(); + gfx::Rect work_area = + gfx::Screen::GetScreen()->GetDisplayNearestWindow(target.get()).bounds(); DragFromCenterBy(target.get(), work_area.width() * 2, 0); // The y location and height should not have changed. EXPECT_EQ(work_area.width(), target->bounds().width()); diff --git a/ash/wm/window_animations.cc b/ash/wm/window_animations.cc index fc14224..d626108 100644 --- a/ash/wm/window_animations.cc +++ b/ash/wm/window_animations.cc @@ -13,7 +13,6 @@ #include "ash/shelf/shelf.h" #include "ash/shelf/shelf_layout_manager.h" #include "ash/shelf/shelf_widget.h" -#include "ash/shell.h" #include "ash/wm/window_util.h" #include "ash/wm/workspace_controller.h" #include "base/command_line.h" @@ -493,7 +492,7 @@ gfx::Rect GetMinimizeAnimationTargetBoundsInScreen(aura::Window* window) { // to the location of the application launcher (which is fixed as first item // of the shelf). gfx::Rect work_area = - Shell::GetScreen()->GetDisplayNearestWindow(window).work_area(); + gfx::Screen::GetScreen()->GetDisplayNearestWindow(window).work_area(); int ltr_adjusted_x = base::i18n::IsRTL() ? work_area.right() : work_area.x(); switch (layout_manager->GetAlignment()) { case SHELF_ALIGNMENT_BOTTOM: diff --git a/ash/wm/window_manager_unittest.cc b/ash/wm/window_manager_unittest.cc index 5bad49d..14e9cb2 100644 --- a/ash/wm/window_manager_unittest.cc +++ b/ash/wm/window_manager_unittest.cc @@ -603,8 +603,10 @@ TEST_F(WindowManagerTest, MAYBE_TransformActivate) { aura::Window* root_window = Shell::GetPrimaryRootWindow(); gfx::Size size = root_window->bounds().size(); EXPECT_EQ(gfx::Rect(size).ToString(), - Shell::GetScreen()->GetDisplayNearestPoint( - gfx::Point()).bounds().ToString()); + gfx::Screen::GetScreen() + ->GetDisplayNearestPoint(gfx::Point()) + .bounds() + .ToString()); // Rotate it clock-wise 90 degrees. gfx::Transform transform; diff --git a/ash/wm/window_positioner.cc b/ash/wm/window_positioner.cc index 4a1d02e..4c9a38d 100644 --- a/ash/wm/window_positioner.cc +++ b/ash/wm/window_positioner.cc @@ -81,8 +81,10 @@ gfx::Rect GetWorkAreaForWindowInParent(aura::Window* window) { // use window's bounds instead. // TODO(oshima): Emulate host window resize on win8. gfx::Rect work_area = gfx::Rect(window->parent()->bounds().size()); - work_area.Inset(Shell::GetScreen()->GetDisplayMatching( - window->parent()->GetBoundsInScreen()).GetWorkAreaInsets()); + work_area.Inset( + gfx::Screen::GetScreen() + ->GetDisplayMatching(window->parent()->GetBoundsInScreen()) + .GetWorkAreaInsets()); return work_area; #else return ScreenUtil::GetDisplayWorkAreaBoundsInParent(window); @@ -457,9 +459,12 @@ gfx::Rect WindowPositioner::GetPopupPosition(const gfx::Rect& old_pos) { // We handle the Multi monitor support by retrieving the active window's // work area. aura::Window* window = wm::GetActiveWindow(); - const gfx::Rect work_area = window && window->IsVisible() ? - Shell::GetScreen()->GetDisplayNearestWindow(window).work_area() : - Shell::GetScreen()->GetPrimaryDisplay().work_area(); + const gfx::Rect work_area = + window && window->IsVisible() + ? gfx::Screen::GetScreen() + ->GetDisplayNearestWindow(window) + .work_area() + : gfx::Screen::GetScreen()->GetPrimaryDisplay().work_area(); // Only try to reposition the popup when it is not spanning the entire // screen. if ((old_pos.width() + popup_position_offset_from_screen_corner_x >= diff --git a/ash/wm/window_positioner_unittest.cc b/ash/wm/window_positioner_unittest.cc index 0506753..01a3f94 100644 --- a/ash/wm/window_positioner_unittest.cc +++ b/ash/wm/window_positioner_unittest.cc @@ -60,8 +60,10 @@ TEST_F(WindowPositionerTest, OpenDefaultWindowOnSecondDisplay) { // The window should be in the 2nd display with the default size. EXPECT_EQ("300x300", bounds.size().ToString()); #endif - EXPECT_TRUE(Shell::GetScreen()->GetDisplayNearestWindow( - second_root_window).bounds().Contains(bounds)); + EXPECT_TRUE(gfx::Screen::GetScreen() + ->GetDisplayNearestWindow(second_root_window) + .bounds() + .Contains(bounds)); } // Tests that second window inherits first window's maximized state as well as @@ -169,7 +171,7 @@ TEST_F(WindowPositionerTest, FirstRunMaximizeWindowHighResloution) { delegate->SetForceMaximizeOnFirstRun(true); WindowPositioner::GetBoundsAndShowStateForNewWindow( - Shell::GetScreen(), nullptr, false, ui::SHOW_STATE_DEFAULT, + gfx::Screen::GetScreen(), nullptr, false, ui::SHOW_STATE_DEFAULT, &bounds_in_out, &show_state_out); EXPECT_EQ(show_state_out, ui::SHOW_STATE_MAXIMIZED); @@ -189,7 +191,7 @@ TEST_F(WindowPositionerTest, FirstRunMaximizeWindowLowResolution) { delegate->SetForceMaximizeOnFirstRun(true); WindowPositioner::GetBoundsAndShowStateForNewWindow( - Shell::GetScreen(), nullptr, false, ui::SHOW_STATE_DEFAULT, + gfx::Screen::GetScreen(), nullptr, false, ui::SHOW_STATE_DEFAULT, &bounds_in_out, &show_state_out); EXPECT_EQ(show_state_out, ui::SHOW_STATE_MAXIMIZED); diff --git a/ash/wm/window_resizer.cc b/ash/wm/window_resizer.cc index 245d85e..f6ea1c0 100644 --- a/ash/wm/window_resizer.cc +++ b/ash/wm/window_resizer.cc @@ -137,8 +137,9 @@ gfx::Rect WindowResizer::CalculateBoundsForDrag( // has to come first since it might have an impact on the origin as well as // on the size. if (details().bounds_change & kBoundsChange_Resizes) { - gfx::Rect work_area = - Shell::GetScreen()->GetDisplayNearestWindow(GetTarget()).work_area(); + gfx::Rect work_area = gfx::Screen::GetScreen() + ->GetDisplayNearestWindow(GetTarget()) + .work_area(); aura::Window* dock_container = Shell::GetContainer( GetTarget()->GetRootWindow(), kShellWindowId_DockedContainer); DockedWindowLayoutManager* dock_layout = @@ -207,7 +208,7 @@ gfx::Rect WindowResizer::CalculateBoundsForDrag( // Use a pointer location (matching the logic in DragWindowResizer) to // calculate the target display after the drag. const gfx::Display& display = - Shell::GetScreen()->GetDisplayMatching(near_passed_location); + gfx::Screen::GetScreen()->GetDisplayMatching(near_passed_location); aura::Window* dock_container = Shell::GetContainer(wm::GetRootWindowMatching(near_passed_location), kShellWindowId_DockedContainer); @@ -308,8 +309,10 @@ int WindowResizer::GetWidthForDrag(int min_width, int* delta_x) { } // And don't let the window go bigger than the display. - int max_width = Shell::GetScreen()->GetDisplayNearestWindow( - GetTarget()).bounds().width(); + int max_width = gfx::Screen::GetScreen() + ->GetDisplayNearestWindow(GetTarget()) + .bounds() + .width(); gfx::Size max_size = GetTarget()->delegate()->GetMaximumSize(); if (max_size.width() != 0) max_width = std::min(max_width, max_size.width()); @@ -338,8 +341,10 @@ int WindowResizer::GetHeightForDrag(int min_height, int* delta_y) { } // And don't let the window go bigger than the display. - int max_height = Shell::GetScreen()->GetDisplayNearestWindow( - GetTarget()).bounds().height(); + int max_height = gfx::Screen::GetScreen() + ->GetDisplayNearestWindow(GetTarget()) + .bounds() + .height(); gfx::Size max_size = GetTarget()->delegate()->GetMaximumSize(); if (max_size.height() != 0) max_height = std::min(max_height, max_size.height()); diff --git a/ash/wm/window_state_unittest.cc b/ash/wm/window_state_unittest.cc index 4c95ce7..9184d29 100644 --- a/ash/wm/window_state_unittest.cc +++ b/ash/wm/window_state_unittest.cc @@ -7,13 +7,13 @@ #include <utility> #include "ash/screen_util.h" -#include "ash/shell.h" #include "ash/test/ash_test_base.h" #include "ash/wm/window_state.h" #include "ash/wm/wm_event.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/test/test_window_delegate.h" #include "ui/aura/window.h" +#include "ui/gfx/screen.h" namespace ash { namespace wm { @@ -58,7 +58,7 @@ TEST_F(WindowStateTest, SnapWindowBasic) { UpdateDisplay("0+0-500x400, 0+500-600x400"); const gfx::Rect kPrimaryDisplayWorkAreaBounds = - ash::Shell::GetScreen()->GetPrimaryDisplay().work_area(); + gfx::Screen::GetScreen()->GetPrimaryDisplay().work_area(); const gfx::Rect kSecondaryDisplayWorkAreaBounds = ScreenUtil::GetSecondaryDisplay().work_area(); @@ -105,7 +105,7 @@ TEST_F(WindowStateTest, SnapWindowMinimumSize) { UpdateDisplay("0+0-600x900"); const gfx::Rect kWorkAreaBounds = - ash::Shell::GetScreen()->GetPrimaryDisplay().work_area(); + gfx::Screen::GetScreen()->GetPrimaryDisplay().work_area(); aura::test::TestWindowDelegate delegate; scoped_ptr<aura::Window> window(CreateTestWindowInShellWithDelegate( @@ -171,7 +171,7 @@ TEST_F(WindowStateTest, TestIgnoreTooBigMinimumSize) { UpdateDisplay("0+0-1024x768"); const gfx::Size work_area_size = - ash::Shell::GetScreen()->GetPrimaryDisplay().work_area().size(); + gfx::Screen::GetScreen()->GetPrimaryDisplay().work_area().size(); const gfx::Size illegal_size(1280, 960); const gfx::Rect illegal_bounds(gfx::Point(0, 0), illegal_size); @@ -202,7 +202,7 @@ TEST_F(WindowStateTest, SnapWindowSetBounds) { UpdateDisplay("0+0-900x600"); const gfx::Rect kWorkAreaBounds = - ash::Shell::GetScreen()->GetPrimaryDisplay().work_area(); + gfx::Screen::GetScreen()->GetPrimaryDisplay().work_area(); scoped_ptr<aura::Window> window( CreateTestWindowInShellWithBounds(gfx::Rect(100, 100, 100, 100))); @@ -278,7 +278,7 @@ TEST_F(WindowStateTest, AutoManaged) { window_state->OnWMEvent(&snap_right); const gfx::Rect kWorkAreaBounds = - ash::Shell::GetScreen()->GetPrimaryDisplay().work_area(); + gfx::Screen::GetScreen()->GetPrimaryDisplay().work_area(); gfx::Rect expected_snapped_bounds( kWorkAreaBounds.x() + kWorkAreaBounds.width() / 2, kWorkAreaBounds.y(), @@ -323,7 +323,7 @@ TEST_F(WindowStateTest, RestoredWindowBoundsShrink) { WindowState* window_state = GetWindowState(window.get()); EXPECT_FALSE(window_state->IsMaximized()); gfx::Rect work_area = - ash::Shell::GetScreen()->GetPrimaryDisplay().work_area(); + gfx::Screen::GetScreen()->GetPrimaryDisplay().work_area(); window->SetBounds(work_area); window_state->Maximize(); diff --git a/ash/wm/workspace/multi_window_resize_controller.cc b/ash/wm/workspace/multi_window_resize_controller.cc index d0099b4..64da854 100644 --- a/ash/wm/workspace/multi_window_resize_controller.cc +++ b/ash/wm/workspace/multi_window_resize_controller.cc @@ -473,7 +473,7 @@ void MultiWindowResizeController::CompleteResize() { window_resizer_.reset(); // Mouse may still be over resizer, if not hide. - gfx::Point screen_loc = Shell::GetScreen()->GetCursorScreenPoint(); + gfx::Point screen_loc = gfx::Screen::GetScreen()->GetCursorScreenPoint(); if (!resize_widget_->GetWindowBoundsInScreen().Contains(screen_loc)) { Hide(); } else { diff --git a/ash/wm/workspace/workspace_event_handler_unittest.cc b/ash/wm/workspace/workspace_event_handler_unittest.cc index 5f1e48f..2d9ecc3 100644 --- a/ash/wm/workspace/workspace_event_handler_unittest.cc +++ b/ash/wm/workspace/workspace_event_handler_unittest.cc @@ -106,8 +106,9 @@ TEST_F(WorkspaceEventHandlerTest, DoubleClickSingleAxisResizeEdge) { wm::ActivateWindow(window.get()); - gfx::Rect work_area = Shell::GetScreen()->GetDisplayNearestWindow( - window.get()).work_area(); + gfx::Rect work_area = gfx::Screen::GetScreen() + ->GetDisplayNearestWindow(window.get()) + .work_area(); ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), window.get()); @@ -212,8 +213,9 @@ TEST_F(WorkspaceEventHandlerTest, DoubleClickSingleAxisWhenSideSnapped) { aura::test::TestWindowDelegate delegate; scoped_ptr<aura::Window> window(CreateTestWindow(&delegate, restored_bounds)); - gfx::Rect work_area_in_screen = Shell::GetScreen()->GetDisplayNearestWindow( - window.get()).work_area(); + gfx::Rect work_area_in_screen = gfx::Screen::GetScreen() + ->GetDisplayNearestWindow(window.get()) + .work_area(); wm::WindowState* window_state = wm::GetWindowState(window.get()); const wm::WMEvent snap_event(wm::WM_EVENT_SNAP_LEFT); @@ -253,8 +255,9 @@ TEST_F(WorkspaceEventHandlerTest, wm::ActivateWindow(window.get()); - gfx::Rect work_area = Shell::GetScreen()->GetDisplayNearestWindow( - window.get()).work_area(); + gfx::Rect work_area = gfx::Screen::GetScreen() + ->GetDisplayNearestWindow(window.get()) + .work_area(); delegate.set_maximum_size(gfx::Size(0, 100)); @@ -277,8 +280,9 @@ TEST_F(WorkspaceEventHandlerTest, wm::ActivateWindow(window.get()); - gfx::Rect work_area = Shell::GetScreen()->GetDisplayNearestWindow( - window.get()).work_area(); + gfx::Rect work_area = gfx::Screen::GetScreen() + ->GetDisplayNearestWindow(window.get()) + .work_area(); delegate.set_maximum_size(gfx::Size(100, 0)); diff --git a/ash/wm/workspace/workspace_layout_manager.cc b/ash/wm/workspace/workspace_layout_manager.cc index 6c8a8ee..4433853 100644 --- a/ash/wm/workspace/workspace_layout_manager.cc +++ b/ash/wm/workspace/workspace_layout_manager.cc @@ -40,9 +40,11 @@ WorkspaceLayoutManager::WorkspaceLayoutManager(aura::Window* window) root_window_(window->GetRootWindow()), work_area_in_parent_(ScreenUtil::ConvertRectFromScreen( window_, - Shell::GetScreen()->GetDisplayNearestWindow(window_).work_area())), - is_fullscreen_(GetRootWindowController( - window->GetRootWindow())->GetWindowForFullscreenMode() != NULL) { + gfx::Screen::GetScreen() + ->GetDisplayNearestWindow(window_) + .work_area())), + is_fullscreen_(GetRootWindowController(window->GetRootWindow()) + ->GetWindowForFullscreenMode() != NULL) { Shell::GetInstance()->activation_client()->AddObserver(this); Shell::GetInstance()->AddShellObserver(this); root_window_->AddObserver(this); @@ -167,7 +169,7 @@ void WorkspaceLayoutManager::OnKeyboardBoundsChanging( void WorkspaceLayoutManager::OnDisplayWorkAreaInsetsChanged() { const gfx::Rect work_area(ScreenUtil::ConvertRectFromScreen( window_, - Shell::GetScreen()->GetDisplayNearestWindow(window_).work_area())); + gfx::Screen::GetScreen()->GetDisplayNearestWindow(window_).work_area())); if (work_area != work_area_in_parent_) { const wm::WMEvent event(wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED); AdjustAllWindowsBoundsForWorkAreaChange(&event); @@ -305,7 +307,7 @@ void WorkspaceLayoutManager::AdjustAllWindowsBoundsForWorkAreaChange( work_area_in_parent_ = ScreenUtil::ConvertRectFromScreen( window_, - Shell::GetScreen()->GetDisplayNearestWindow(window_).work_area()); + gfx::Screen::GetScreen()->GetDisplayNearestWindow(window_).work_area()); // Don't do any adjustments of the insets while we are in screen locked mode. // This would happen if the launcher was auto hidden before the login screen diff --git a/ash/wm/workspace/workspace_layout_manager_unittest.cc b/ash/wm/workspace/workspace_layout_manager_unittest.cc index 1ac8b69..d62837b 100644 --- a/ash/wm/workspace/workspace_layout_manager_unittest.cc +++ b/ash/wm/workspace/workspace_layout_manager_unittest.cc @@ -389,7 +389,7 @@ TEST_F(WorkspaceLayoutManagerTest, MaximizeWithEmptySize) { default_container->AddChild(window.get()); window->Show(); gfx::Rect work_area( - Shell::GetScreen()->GetPrimaryDisplay().work_area()); + gfx::Screen::GetScreen()->GetPrimaryDisplay().work_area()); EXPECT_EQ(work_area.ToString(), window->GetBoundsInScreen().ToString()); } @@ -464,7 +464,7 @@ TEST_F(WorkspaceLayoutManagerTest, WindowShouldBeOnScreenWhenAdded) { TEST_F(WorkspaceLayoutManagerTest, SizeToWorkArea) { // Normal window bounds shouldn't be changed. gfx::Size work_area( - Shell::GetScreen()->GetPrimaryDisplay().work_area().size()); + gfx::Screen::GetScreen()->GetPrimaryDisplay().work_area().size()); const gfx::Rect window_bounds( 100, 101, work_area.width() + 1, work_area.height() + 2); scoped_ptr<aura::Window> window( @@ -636,8 +636,10 @@ TEST_F(WorkspaceLayoutManagerSoloTest, Fullscreen) { scoped_ptr<aura::Window> window(CreateTestWindow(bounds)); window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); // Fullscreen window fills the whole display. - EXPECT_EQ(Shell::GetScreen()->GetDisplayNearestWindow( - window.get()).bounds().ToString(), + EXPECT_EQ(gfx::Screen::GetScreen() + ->GetDisplayNearestWindow(window.get()) + .bounds() + .ToString(), window->bounds().ToString()); window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); EXPECT_EQ(bounds.ToString(), window->bounds().ToString()); @@ -677,13 +679,17 @@ TEST_F(WorkspaceLayoutManagerSoloTest, FullscreenRootWindowResize) { scoped_ptr<aura::Window> window(CreateTestWindow(bounds)); // Fullscreen window fills the whole display. window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); - EXPECT_EQ(Shell::GetScreen()->GetDisplayNearestWindow( - window.get()).bounds().ToString(), + EXPECT_EQ(gfx::Screen::GetScreen() + ->GetDisplayNearestWindow(window.get()) + .bounds() + .ToString(), window->bounds().ToString()); // Enlarge the root window. We should still match the display size. UpdateDisplay("800x600"); - EXPECT_EQ(Shell::GetScreen()->GetDisplayNearestWindow( - window.get()).bounds().ToString(), + EXPECT_EQ(gfx::Screen::GetScreen() + ->GetDisplayNearestWindow(window.get()) + .bounds() + .ToString(), window->bounds().ToString()); } @@ -692,23 +698,26 @@ TEST_F(WorkspaceLayoutManagerSoloTest, FullscreenRootWindowResize) { TEST_F(WorkspaceLayoutManagerSoloTest, RootWindowResizeShrinksWindows) { scoped_ptr<aura::Window> window( CreateTestWindow(gfx::Rect(10, 20, 500, 400))); - gfx::Rect work_area = Shell::GetScreen()->GetDisplayNearestWindow( - window.get()).work_area(); + gfx::Rect work_area = gfx::Screen::GetScreen() + ->GetDisplayNearestWindow(window.get()) + .work_area(); // Invariant: Window is smaller than work area. EXPECT_LE(window->bounds().width(), work_area.width()); EXPECT_LE(window->bounds().height(), work_area.height()); // Make the root window narrower than our window. UpdateDisplay("300x400"); - work_area = Shell::GetScreen()->GetDisplayNearestWindow( - window.get()).work_area(); + work_area = gfx::Screen::GetScreen() + ->GetDisplayNearestWindow(window.get()) + .work_area(); EXPECT_LE(window->bounds().width(), work_area.width()); EXPECT_LE(window->bounds().height(), work_area.height()); // Make the root window shorter than our window. UpdateDisplay("300x200"); - work_area = Shell::GetScreen()->GetDisplayNearestWindow( - window.get()).work_area(); + work_area = gfx::Screen::GetScreen() + ->GetDisplayNearestWindow(window.get()) + .work_area(); EXPECT_LE(window->bounds().width(), work_area.width()); EXPECT_LE(window->bounds().height(), work_area.height()); @@ -1019,8 +1028,8 @@ class WorkspaceLayoutManagerKeyboardTest : public test::AshTestBase { void ShowKeyboard() { layout_manager_->OnKeyboardBoundsChanging(keyboard_bounds_); - restore_work_area_insets_ = Shell::GetScreen()->GetPrimaryDisplay(). - GetWorkAreaInsets(); + restore_work_area_insets_ = + gfx::Screen::GetScreen()->GetPrimaryDisplay().GetWorkAreaInsets(); Shell::GetInstance()->SetDisplayWorkAreaInsets( Shell::GetPrimaryRootWindow(), gfx::Insets(0, 0, keyboard_bounds_.height(), 0)); @@ -1049,7 +1058,7 @@ class WorkspaceLayoutManagerKeyboardTest : public test::AshTestBase { // is resized to fit the remaining workspace area. TEST_F(WorkspaceLayoutManagerKeyboardTest, ChildWindowFocused) { gfx::Rect work_area( - Shell::GetScreen()->GetPrimaryDisplay().work_area()); + gfx::Screen::GetScreen()->GetPrimaryDisplay().work_area()); gfx::Rect keyboard_bounds(work_area.x(), work_area.y() + work_area.height() / 2, work_area.width(), @@ -1068,7 +1077,7 @@ TEST_F(WorkspaceLayoutManagerKeyboardTest, ChildWindowFocused) { wm::ActivateWindow(window.get()); int available_height = - Shell::GetScreen()->GetPrimaryDisplay().bounds().height() - + gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds().height() - keyboard_bounds.height(); gfx::Rect initial_window_bounds(50, 50, 100, 500); @@ -1085,7 +1094,7 @@ TEST_F(WorkspaceLayoutManagerKeyboardTest, ChildWindowFocused) { TEST_F(WorkspaceLayoutManagerKeyboardTest, AdjustWindowForA11yKeyboard) { gfx::Rect work_area( - Shell::GetScreen()->GetPrimaryDisplay().work_area()); + gfx::Screen::GetScreen()->GetPrimaryDisplay().work_area()); gfx::Rect keyboard_bounds(work_area.x(), work_area.y() + work_area.height() / 2, work_area.width(), @@ -1098,7 +1107,7 @@ TEST_F(WorkspaceLayoutManagerKeyboardTest, AdjustWindowForA11yKeyboard) { &delegate, -1, work_area)); int available_height = - Shell::GetScreen()->GetPrimaryDisplay().bounds().height() - + gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds().height() - keyboard_bounds.height(); wm::ActivateWindow(window.get()); diff --git a/ash/wm/workspace/workspace_window_resizer.cc b/ash/wm/workspace/workspace_window_resizer.cc index a4adbf7..edfddb2 100644 --- a/ash/wm/workspace/workspace_window_resizer.cc +++ b/ash/wm/workspace/workspace_window_resizer.cc @@ -786,7 +786,7 @@ void WorkspaceWindowResizer::AdjustBoundsForMainWindow( gfx::Point last_mouse_location_in_screen = last_mouse_location_; ::wm::ConvertPointToScreen(GetTarget()->parent(), &last_mouse_location_in_screen); - gfx::Display display = Shell::GetScreen()->GetDisplayNearestPoint( + gfx::Display display = gfx::Screen::GetScreen()->GetDisplayNearestPoint( last_mouse_location_in_screen); gfx::Rect work_area = ScreenUtil::ConvertRectFromScreen(GetTarget()->parent(), diff --git a/ash/wm/workspace/workspace_window_resizer_unittest.cc b/ash/wm/workspace/workspace_window_resizer_unittest.cc index 0d8efc3..f43aebc 100644 --- a/ash/wm/workspace/workspace_window_resizer_unittest.cc +++ b/ash/wm/workspace/workspace_window_resizer_unittest.cc @@ -650,7 +650,7 @@ TEST_F(WorkspaceWindowResizerTest, CancelSnapPhantom) { ASSERT_EQ(2U, root_windows.size()); window_->SetBoundsInScreen(gfx::Rect(0, 0, 50, 60), - Shell::GetScreen()->GetPrimaryDisplay()); + gfx::Screen::GetScreen()->GetPrimaryDisplay()); EXPECT_EQ(root_windows[0], window_->GetRootWindow()); EXPECT_FLOAT_EQ(1.0f, window_->layer()->opacity()); { @@ -795,7 +795,7 @@ TEST_F(WorkspaceWindowResizerTest, DontDragOffBottom) { Shell::GetInstance()->SetDisplayWorkAreaInsets( Shell::GetPrimaryRootWindow(), gfx::Insets(0, 0, 10, 0)); - ASSERT_EQ(1, Shell::GetScreen()->GetNumDisplays()); + ASSERT_EQ(1, gfx::Screen::GetScreen()->GetNumDisplays()); window_->SetBounds(gfx::Rect(100, 200, 300, 400)); scoped_ptr<WindowResizer> resizer(CreateResizerForTest( @@ -814,7 +814,7 @@ TEST_F(WorkspaceWindowResizerTest, DontDragOffBottomWithMultiDisplay) { return; UpdateDisplay("800x600,800x600"); - ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays()); + ASSERT_EQ(2, gfx::Screen::GetScreen()->GetNumDisplays()); Shell::GetInstance()->SetDisplayWorkAreaInsets( Shell::GetPrimaryRootWindow(), gfx::Insets(0, 0, 10, 0)); diff --git a/ash/wm/workspace_controller_unittest.cc b/ash/wm/workspace_controller_unittest.cc index 3739158..2b884eb 100644 --- a/ash/wm/workspace_controller_unittest.cc +++ b/ash/wm/workspace_controller_unittest.cc @@ -139,7 +139,7 @@ class WorkspaceControllerTest : public test::AshTestBase { } gfx::Rect GetFullscreenBounds(aura::Window* window) { - return Shell::GetScreen()->GetDisplayNearestWindow(window).bounds(); + return gfx::Screen::GetScreen()->GetDisplayNearestWindow(window).bounds(); } ShelfWidget* shelf_widget() { @@ -626,7 +626,7 @@ TEST_F(WorkspaceControllerTest, MoveOnSwitch) { // Increase the size of the WorkAreaInsets. This would make |w1| fall // completely out of the display work area. gfx::Insets insets = - Shell::GetScreen()->GetPrimaryDisplay().GetWorkAreaInsets(); + gfx::Screen::GetScreen()->GetPrimaryDisplay().GetWorkAreaInsets(); insets.Set(0, 0, insets.bottom() + 30, 0); Shell::GetInstance()->SetDisplayWorkAreaInsets(w1.get(), insets); diff --git a/chrome/browser/chromeos/accessibility/chromevox_panel.cc b/chrome/browser/chromeos/accessibility/chromevox_panel.cc index 3710d53..740972d 100644 --- a/chrome/browser/chromeos/accessibility/chromevox_panel.cc +++ b/chrome/browser/chromeos/accessibility/chromevox_panel.cc @@ -88,11 +88,11 @@ ChromeVoxPanel::ChromeVoxPanel(content::BrowserContext* browser_context) widget_->Init(params); SetShadowType(widget_->GetNativeWindow(), wm::SHADOW_TYPE_RECTANGULAR); - ash::Shell::GetScreen()->AddObserver(this); + gfx::Screen::GetScreen()->AddObserver(this); } ChromeVoxPanel::~ChromeVoxPanel() { - ash::Shell::GetScreen()->RemoveObserver(this); + gfx::Screen::GetScreen()->RemoveObserver(this); } aura::Window* ChromeVoxPanel::GetRootWindow() { diff --git a/chrome/browser/chromeos/app_mode/kiosk_mode_idle_app_name_notification.cc b/chrome/browser/chromeos/app_mode/kiosk_mode_idle_app_name_notification.cc index e016bb5..ca93ce7 100644 --- a/chrome/browser/chromeos/app_mode/kiosk_mode_idle_app_name_notification.cc +++ b/chrome/browser/chromeos/app_mode/kiosk_mode_idle_app_name_notification.cc @@ -4,7 +4,6 @@ #include "chrome/browser/chromeos/app_mode/kiosk_mode_idle_app_name_notification.h" -#include "ash/shell.h" #include "base/bind.h" #include "base/command_line.h" #include "base/logging.h" @@ -77,7 +76,7 @@ void KioskModeIdleAppNameNotification::Setup() { void KioskModeIdleAppNameNotification::OnUserActivity(const ui::Event* event) { if (show_notification_upon_next_user_activity_) { - gfx::Display display = ash::Shell::GetScreen()->GetPrimaryDisplay(); + gfx::Display display = gfx::Screen::GetScreen()->GetPrimaryDisplay(); // Display the notification only on internal display. if (display.IsInternal()) { base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); diff --git a/chrome/browser/chromeos/display/display_preferences_unittest.cc b/chrome/browser/chromeos/display/display_preferences_unittest.cc index 3557ceb..c593aa2 100644 --- a/chrome/browser/chromeos/display/display_preferences_unittest.cc +++ b/chrome/browser/chromeos/display/display_preferences_unittest.cc @@ -269,7 +269,7 @@ TEST_F(DisplayPreferencesTest, BasicStores) { id1, dummy_id, ash::DisplayLayout(ash::DisplayLayout::LEFT, 20)); // Can't switch to a display that does not exist. window_tree_host_manager->SetPrimaryDisplayId(dummy_id); - EXPECT_NE(dummy_id, ash::Shell::GetScreen()->GetPrimaryDisplay().id()); + EXPECT_NE(dummy_id, gfx::Screen::GetScreen()->GetPrimaryDisplay().id()); window_tree_host_manager->SetOverscanInsets(id1, gfx::Insets(10, 11, 12, 13)); display_manager->SetDisplayRotation(id1, gfx::Display::ROTATE_90, @@ -474,7 +474,7 @@ TEST_F(DisplayPreferencesTest, PreventStore) { ResolutionNotificationController::SuppressTimerForTest(); LoggedInAsUser(); UpdateDisplay("400x300#500x400|400x300|300x200"); - int64_t id = ash::Shell::GetScreen()->GetPrimaryDisplay().id(); + int64_t id = gfx::Screen::GetScreen()->GetPrimaryDisplay().id(); // Set display's resolution in single display. It creates the notification and // display preferences should not stored meanwhile. ash::Shell* shell = ash::Shell::GetInstance(); @@ -590,7 +590,7 @@ TEST_F(DisplayPreferencesTest, DontStoreInGuestMode) { UpdateDisplay("200x200*2,200x200"); LoggedInAsGuest(); - int64_t id1 = ash::Shell::GetScreen()->GetPrimaryDisplay().id(); + int64_t id1 = gfx::Screen::GetScreen()->GetPrimaryDisplay().id(); ash::test::ScopedSetInternalDisplayId set_internal(id1); int64_t id2 = ash::ScreenUtil::GetSecondaryDisplay().id(); ash::DisplayManager* display_manager = @@ -599,7 +599,7 @@ TEST_F(DisplayPreferencesTest, DontStoreInGuestMode) { display_manager->SetLayoutForCurrentDisplays(layout); ash::SetDisplayUIScale(id1, 1.25f); window_tree_host_manager->SetPrimaryDisplayId(id2); - int64_t new_primary = ash::Shell::GetScreen()->GetPrimaryDisplay().id(); + int64_t new_primary = gfx::Screen::GetScreen()->GetPrimaryDisplay().id(); window_tree_host_manager->SetOverscanInsets(new_primary, gfx::Insets(10, 11, 12, 13)); display_manager->SetDisplayRotation(new_primary, gfx::Display::ROTATE_90, diff --git a/chrome/browser/chromeos/input_method/mode_indicator_browsertest.cc b/chrome/browser/chromeos/input_method/mode_indicator_browsertest.cc index 79c78ea..37b9069 100644 --- a/chrome/browser/chromeos/input_method/mode_indicator_browsertest.cc +++ b/chrome/browser/chromeos/input_method/mode_indicator_browsertest.cc @@ -172,7 +172,7 @@ IN_PROC_BROWSER_TEST_F(ModeIndicatorBrowserTest, Bounds) { EXPECT_EQ(mi1_bounds.height(), mi2_bounds.height()); const gfx::Rect screen_bounds = - ash::Shell::GetScreen()->GetDisplayMatching(cursor1_bounds).work_area(); + gfx::Screen::GetScreen()->GetDisplayMatching(cursor1_bounds).work_area(); // Check if the location of the mode indicator is concidered with // the screen size. diff --git a/chrome/browser/chromeos/login/lock/webui_screen_locker.cc b/chrome/browser/chromeos/login/lock/webui_screen_locker.cc index 48acb30..7d7d60a 100644 --- a/chrome/browser/chromeos/login/lock/webui_screen_locker.cc +++ b/chrome/browser/chromeos/login/lock/webui_screen_locker.cc @@ -70,7 +70,7 @@ WebUIScreenLocker::WebUIScreenLocker(ScreenLocker* screen_locker) set_should_emit_login_prompt_visible(false); ash::Shell::GetInstance()->lock_state_controller()->AddObserver(this); ash::Shell::GetInstance()->delegate()->AddVirtualKeyboardStateObserver(this); - ash::Shell::GetScreen()->AddObserver(this); + gfx::Screen::GetScreen()->AddObserver(this); DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this); if (keyboard::KeyboardController::GetInstance()) { @@ -164,7 +164,7 @@ void WebUIScreenLocker::ResetAndFocusUserPod() { WebUIScreenLocker::~WebUIScreenLocker() { DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this); - ash::Shell::GetScreen()->RemoveObserver(this); + gfx::Screen::GetScreen()->RemoveObserver(this); ash::Shell::GetInstance()-> lock_state_controller()->RemoveObserver(this); diff --git a/chrome/browser/chromeos/login/ui/login_display_host_impl.cc b/chrome/browser/chromeos/login/ui/login_display_host_impl.cc index a545b28..477dd21 100644 --- a/chrome/browser/chromeos/login/ui/login_display_host_impl.cc +++ b/chrome/browser/chromeos/login/ui/login_display_host_impl.cc @@ -281,7 +281,7 @@ LoginDisplayHostImpl::LoginDisplayHostImpl(const gfx::Rect& background_bounds) } ash::Shell::GetInstance()->delegate()->AddVirtualKeyboardStateObserver(this); - ash::Shell::GetScreen()->AddObserver(this); + gfx::Screen::GetScreen()->AddObserver(this); // We need to listen to CLOSE_ALL_BROWSERS_REQUEST but not APP_TERMINATING // because/ APP_TERMINATING will never be fired as long as this keeps @@ -386,7 +386,7 @@ LoginDisplayHostImpl::~LoginDisplayHostImpl() { ash::Shell::GetInstance()->delegate()-> RemoveVirtualKeyboardStateObserver(this); - ash::Shell::GetScreen()->RemoveObserver(this); + gfx::Screen::GetScreen()->RemoveObserver(this); if (login_view_ && login_window_) login_window_->RemoveRemovalsObserver(this); diff --git a/chrome/browser/chromeos/net/network_portal_web_dialog.cc b/chrome/browser/chromeos/net/network_portal_web_dialog.cc index 3b6db22..364fbb7 100644 --- a/chrome/browser/chromeos/net/network_portal_web_dialog.cc +++ b/chrome/browser/chromeos/net/network_portal_web_dialog.cc @@ -4,13 +4,13 @@ #include "chrome/browser/chromeos/net/network_portal_web_dialog.h" -#include "ash/shell.h" #include "chrome/grit/generated_resources.h" #include "components/captive_portal/captive_portal_detector.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/ui_base_types.h" #include "ui/gfx/display.h" #include "ui/gfx/geometry/size.h" +#include "ui/gfx/screen.h" #include "ui/views/widget/widget.h" #include "url/gurl.h" @@ -20,7 +20,7 @@ const float kNetworkPortalWebDialogWidthFraction = .8; const float kNetworkPortalWebDialogHeightFraction = .8; gfx::Size GetPortalDialogSize() { - const gfx::Display display = ash::Shell::GetScreen()->GetPrimaryDisplay(); + const gfx::Display display = gfx::Screen::GetScreen()->GetPrimaryDisplay(); gfx::Size display_size = display.size(); diff --git a/chrome/browser/extensions/display_info_provider_aura.cc b/chrome/browser/extensions/display_info_provider_aura.cc index a880d89..0bbd77a 100644 --- a/chrome/browser/extensions/display_info_provider_aura.cc +++ b/chrome/browser/extensions/display_info_provider_aura.cc @@ -32,10 +32,6 @@ void DisplayInfoProviderAura::UpdateDisplayUnitInfoForPlatform( } } -gfx::Screen* DisplayInfoProviderAura::GetActiveScreen() { - return gfx::Screen::GetScreen(); -} - // static DisplayInfoProvider* DisplayInfoProvider::Create() { return new DisplayInfoProviderAura(); diff --git a/chrome/browser/extensions/display_info_provider_aura.h b/chrome/browser/extensions/display_info_provider_aura.h index a87af49..e2314ce 100644 --- a/chrome/browser/extensions/display_info_provider_aura.h +++ b/chrome/browser/extensions/display_info_provider_aura.h @@ -22,7 +22,6 @@ class DisplayInfoProviderAura : public DisplayInfoProvider { void UpdateDisplayUnitInfoForPlatform( const gfx::Display& display, api::system_display::DisplayUnitInfo* unit) override; - gfx::Screen* GetActiveScreen() override; private: DISALLOW_COPY_AND_ASSIGN(DisplayInfoProviderAura); diff --git a/chrome/browser/extensions/display_info_provider_chromeos.cc b/chrome/browser/extensions/display_info_provider_chromeos.cc index 3327b38..48cdbdf 100644 --- a/chrome/browser/extensions/display_info_provider_chromeos.cc +++ b/chrome/browser/extensions/display_info_provider_chromeos.cc @@ -383,10 +383,6 @@ void DisplayInfoProviderChromeOS::UpdateDisplayUnitInfoForPlatform( unit->overscan.bottom = overscan_insets.bottom(); } -gfx::Screen* DisplayInfoProviderChromeOS::GetActiveScreen() { - return ash::Shell::GetScreen(); -} - void DisplayInfoProviderChromeOS::EnableUnifiedDesktop(bool enable) { ash::Shell::GetInstance()->display_manager()->SetUnifiedDesktopEnabled( enable); diff --git a/chrome/browser/extensions/display_info_provider_chromeos.h b/chrome/browser/extensions/display_info_provider_chromeos.h index 81a776d..b8f8967 100644 --- a/chrome/browser/extensions/display_info_provider_chromeos.h +++ b/chrome/browser/extensions/display_info_provider_chromeos.h @@ -22,7 +22,6 @@ class DisplayInfoProviderChromeOS : public DisplayInfoProvider { void UpdateDisplayUnitInfoForPlatform( const gfx::Display& display, api::system_display::DisplayUnitInfo* unit) override; - gfx::Screen* GetActiveScreen() override; void EnableUnifiedDesktop(bool enable) override; DisplayInfo GetAllDisplaysInfo() override; diff --git a/chrome/browser/extensions/display_info_provider_chromeos_unittest.cc b/chrome/browser/extensions/display_info_provider_chromeos_unittest.cc index c621bdf..7724167 100644 --- a/chrome/browser/extensions/display_info_provider_chromeos_unittest.cc +++ b/chrome/browser/extensions/display_info_provider_chromeos_unittest.cc @@ -770,14 +770,14 @@ TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginOnPrimary) { EXPECT_EQ("1200,0 300x500", secondary.bounds().ToString()); // The operation failed because the primary property would be set before // setting bounds. The primary display shouldn't have been changed, though. - EXPECT_NE(ash::Shell::GetScreen()->GetPrimaryDisplay().id(), secondary.id()); + EXPECT_NE(gfx::Screen::GetScreen()->GetPrimaryDisplay().id(), secondary.id()); } TEST_F(DisplayInfoProviderChromeosTest, SetBoundsOriginWithMirroring) { UpdateDisplay("1200x600,600x1000*2"); const gfx::Display& secondary = ash::ScreenUtil::GetSecondaryDisplay(); - const gfx::Display& primary = ash::Shell::GetScreen()->GetPrimaryDisplay(); + const gfx::Display& primary = gfx::Screen::GetScreen()->GetPrimaryDisplay(); api::system_display::DisplayProperties info; info.bounds_origin_x.reset(new int(300)); @@ -833,7 +833,7 @@ TEST_F(DisplayInfoProviderChromeosTest, SetRotation) { EXPECT_EQ("0,0 300x500", secondary.bounds().ToString()); EXPECT_EQ(gfx::Display::ROTATE_180, secondary.rotation()); - EXPECT_EQ(ash::Shell::GetScreen()->GetPrimaryDisplay().id(), secondary.id()); + EXPECT_EQ(gfx::Screen::GetScreen()->GetPrimaryDisplay().id(), secondary.id()); info.rotation.reset(new int(0)); CallSetDisplayUnitInfo( @@ -844,7 +844,7 @@ TEST_F(DisplayInfoProviderChromeosTest, SetRotation) { EXPECT_EQ("0,0 300x500", secondary.bounds().ToString()); EXPECT_EQ(gfx::Display::ROTATE_0, secondary.rotation()); - EXPECT_EQ(ash::Shell::GetScreen()->GetPrimaryDisplay().id(), secondary.id()); + EXPECT_EQ(gfx::Screen::GetScreen()->GetPrimaryDisplay().id(), secondary.id()); } // Tests that rotation changes made before entering maximize mode are restored diff --git a/chrome/browser/extensions/display_info_provider_mac.cc b/chrome/browser/extensions/display_info_provider_mac.cc index c0bc440..370ed20 100644 --- a/chrome/browser/extensions/display_info_provider_mac.cc +++ b/chrome/browser/extensions/display_info_provider_mac.cc @@ -4,8 +4,6 @@ #include "chrome/browser/extensions/display_info_provider_mac.h" -#include "ui/gfx/screen.h" - namespace extensions { DisplayInfoProviderMac::DisplayInfoProviderMac() { @@ -32,10 +30,6 @@ void DisplayInfoProviderMac::UpdateDisplayUnitInfoForPlatform( } } -gfx::Screen* DisplayInfoProviderMac::GetActiveScreen() { - return gfx::Screen::GetScreen(); -} - // static DisplayInfoProvider* DisplayInfoProvider::Create() { return new DisplayInfoProviderMac(); diff --git a/chrome/browser/extensions/display_info_provider_mac.h b/chrome/browser/extensions/display_info_provider_mac.h index eb3189b..edae287 100644 --- a/chrome/browser/extensions/display_info_provider_mac.h +++ b/chrome/browser/extensions/display_info_provider_mac.h @@ -22,7 +22,6 @@ class DisplayInfoProviderMac : public DisplayInfoProvider { void UpdateDisplayUnitInfoForPlatform( const gfx::Display& display, api::system_display::DisplayUnitInfo* unit) override; - gfx::Screen* GetActiveScreen() override; private: DISALLOW_COPY_AND_ASSIGN(DisplayInfoProviderMac); diff --git a/chrome/browser/extensions/display_info_provider_win.cc b/chrome/browser/extensions/display_info_provider_win.cc index 041bee85..83d9b87 100644 --- a/chrome/browser/extensions/display_info_provider_win.cc +++ b/chrome/browser/extensions/display_info_provider_win.cc @@ -13,7 +13,6 @@ #include "base/win/win_util.h" #include "extensions/common/api/system_display.h" #include "ui/gfx/geometry/size.h" -#include "ui/gfx/screen.h" #include "ui/gfx/win/dpi.h" namespace extensions { @@ -82,10 +81,6 @@ void DisplayInfoProviderWin::UpdateDisplayUnitInfoForPlatform( } } -gfx::Screen* DisplayInfoProviderWin::GetActiveScreen() { - return gfx::Screen::GetScreen(); -} - // static DisplayInfoProvider* DisplayInfoProvider::Create() { return new DisplayInfoProviderWin(); diff --git a/chrome/browser/extensions/display_info_provider_win.h b/chrome/browser/extensions/display_info_provider_win.h index 20d33b8..41abed3 100644 --- a/chrome/browser/extensions/display_info_provider_win.h +++ b/chrome/browser/extensions/display_info_provider_win.h @@ -22,7 +22,6 @@ class DisplayInfoProviderWin : public DisplayInfoProvider { void UpdateDisplayUnitInfoForPlatform( const gfx::Display& display, api::system_display::DisplayUnitInfo* unit) override; - gfx::Screen* GetActiveScreen() override; private: DISALLOW_COPY_AND_ASSIGN(DisplayInfoProviderWin); diff --git a/chrome/browser/ui/ash/launcher/browser_status_monitor.cc b/chrome/browser/ui/ash/launcher/browser_status_monitor.cc index 55e4006..efbe50e 100644 --- a/chrome/browser/ui/ash/launcher/browser_status_monitor.cc +++ b/chrome/browser/ui/ash/launcher/browser_status_monitor.cc @@ -128,7 +128,7 @@ BrowserStatusMonitor::BrowserStatusMonitor( aura::client::GetActivationClient(*iter)); observed_root_windows_.Add(static_cast<aura::Window*>(*iter)); } - ash::Shell::GetInstance()->GetScreen()->AddObserver(this); + gfx::Screen::GetScreen()->AddObserver(this); } browser_tab_strip_tracker_.Init( @@ -139,7 +139,7 @@ BrowserStatusMonitor::~BrowserStatusMonitor() { // This check needs for win7_aura. Without this, all tests in // ChromeLauncherController will fail in win7_aura. if (ash::Shell::HasInstance()) - ash::Shell::GetInstance()->GetScreen()->RemoveObserver(this); + gfx::Screen::GetScreen()->RemoveObserver(this); chrome::SettingsWindowManager::GetInstance()->RemoveObserver( settings_window_observer_.get()); diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc index a61718e..ea38e38 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc @@ -1822,7 +1822,7 @@ IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTestWithMultiMonitor, gfx::Rect app_list_bounds = test.shelf_view()->GetAppListButtonView()->GetBoundsInScreen(); gfx::Display display = - ash::Shell::GetScreen()->GetDisplayNearestWindow(secondary_root_window); + gfx::Screen::GetScreen()->GetDisplayNearestWindow(secondary_root_window); const gfx::Point& origin = display.bounds().origin(); app_list_bounds.Offset(-origin.x(), -origin.y()); diff --git a/chrome/browser/ui/ash/window_positioner_unittest.cc b/chrome/browser/ui/ash/window_positioner_unittest.cc index b36dd53..0ec615f 100644 --- a/chrome/browser/ui/ash/window_positioner_unittest.cc +++ b/chrome/browser/ui/ash/window_positioner_unittest.cc @@ -6,7 +6,6 @@ #include <utility> -#include "ash/shell.h" #include "ash/test/ash_test_base.h" #include "ash/test/test_shell_delegate.h" #include "ash/wm/window_resizer.h" @@ -104,7 +103,7 @@ int AlignToGridRoundDown(int location, int grid_size) { TEST_F(WindowPositionerTest, cascading) { const gfx::Rect work_area = - Shell::GetScreen()->GetPrimaryDisplay().work_area(); + gfx::Screen::GetScreen()->GetPrimaryDisplay().work_area(); // First see that the window will cascade down when there is no space. window()->SetBounds(work_area); @@ -165,7 +164,7 @@ TEST_F(WindowPositionerTest, cascading) { TEST_F(WindowPositionerTest, filling) { const gfx::Rect work_area = - Shell::GetScreen()->GetPrimaryDisplay().work_area(); + gfx::Screen::GetScreen()->GetPrimaryDisplay().work_area(); gfx::Rect popup_position(0, 0, 256, 128); // Leave space on the left and the right and see if we fill top to bottom. window()->SetBounds(gfx::Rect(work_area.x() + popup_position.width(), @@ -220,7 +219,7 @@ TEST_F(WindowPositionerTest, filling) { TEST_F(WindowPositionerTest, biggerThenBorder) { const gfx::Rect work_area = - Shell::GetScreen()->GetPrimaryDisplay().work_area(); + gfx::Screen::GetScreen()->GetPrimaryDisplay().work_area(); gfx::Rect pop_position(0, 0, work_area.width(), work_area.height()); diff --git a/chrome/browser/ui/webui/options/chromeos/display_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/display_options_handler.cc index 6b08ae3..98b3903 100644 --- a/chrome/browser/ui/webui/options/chromeos/display_options_handler.cc +++ b/chrome/browser/ui/webui/options/chromeos/display_options_handler.cc @@ -289,7 +289,7 @@ void DisplayOptionsHandler::SendDisplayInfo( else display_mode = ash::DisplayManager::EXTENDED; base::FundamentalValue mode(static_cast<int>(display_mode)); - int64_t primary_id = ash::Shell::GetScreen()->GetPrimaryDisplay().id(); + int64_t primary_id = gfx::Screen::GetScreen()->GetPrimaryDisplay().id(); base::ListValue js_displays; for (const gfx::Display& display : displays) { const ash::DisplayInfo& display_info = diff --git a/chrome/browser/ui/webui/options/chromeos/display_overscan_handler.cc b/chrome/browser/ui/webui/options/chromeos/display_overscan_handler.cc index 57e12a7..dfc6781 100644 --- a/chrome/browser/ui/webui/options/chromeos/display_overscan_handler.cc +++ b/chrome/browser/ui/webui/options/chromeos/display_overscan_handler.cc @@ -31,11 +31,11 @@ const char kOrientationVertical[] = "vertical"; } DisplayOverscanHandler::DisplayOverscanHandler() { - ash::Shell::GetScreen()->AddObserver(this); + gfx::Screen::GetScreen()->AddObserver(this); } DisplayOverscanHandler::~DisplayOverscanHandler() { - ash::Shell::GetScreen()->RemoveObserver(this); + gfx::Screen::GetScreen()->RemoveObserver(this); } void DisplayOverscanHandler::GetLocalizedValues( diff --git a/chrome/browser/ui/window_sizer/window_sizer_ash_uitest.cc b/chrome/browser/ui/window_sizer/window_sizer_ash_uitest.cc index 75c0b40..43366bd 100644 --- a/chrome/browser/ui/window_sizer/window_sizer_ash_uitest.cc +++ b/chrome/browser/ui/window_sizer/window_sizer_ash_uitest.cc @@ -61,7 +61,7 @@ void OpenBrowserUsingShelfOnRootWindow(aura::Window* root_window) { gfx::Point center = GetChromeIconBoundsForRootWindow(root_window).CenterPoint(); gfx::Display display = - ash::Shell::GetScreen()->GetDisplayNearestWindow(root_window); + gfx::Screen::GetScreen()->GetDisplayNearestWindow(root_window); const gfx::Point& origin = display.bounds().origin(); center.Offset(- origin.x(), - origin.y()); generator.MoveMouseTo(center); @@ -71,11 +71,15 @@ void OpenBrowserUsingShelfOnRootWindow(aura::Window* root_window) { } // namespace #if !defined(OS_CHROMEOS) -#define MAYBE_OpenBrowserUsingShelfOnOtherDisplay DISABLED_OpenBrowserUsingShelfOnOtherDisplay -#define MAYBE_OpenBrowserUsingContextMenuOnOtherDisplay DISABLED_OpenBrowserUsingContextMenuOnOtherDisplay +#define MAYBE_OpenBrowserUsingShelfOnOtherDisplay \ + DISABLED_OpenBrowserUsingShelfOnOtherDisplay +#define MAYBE_OpenBrowserUsingContextMenuOnOtherDisplay \ + DISABLED_OpenBrowserUsingContextMenuOnOtherDisplay #else -#define MAYBE_OpenBrowserUsingShelfOnOtherDisplay OpenBrowserUsingShelfOnOtherDisplay -#define MAYBE_OpenBrowserUsingContextMenuOnOtherDisplay OpenBrowserUsingContextMenuOnOtherDisplay +#define MAYBE_OpenBrowserUsingShelfOnOtherDisplay \ + OpenBrowserUsingShelfOnOtherDisplay +#define MAYBE_OpenBrowserUsingContextMenuOnOtherDisplay \ + OpenBrowserUsingContextMenuOnOtherDisplay #endif IN_PROC_BROWSER_TEST_F(WindowSizerTest, diff --git a/chrome/browser/ui/window_sizer/window_sizer_ash_unittest.cc b/chrome/browser/ui/window_sizer/window_sizer_ash_unittest.cc index 3e03d81..2657841 100644 --- a/chrome/browser/ui/window_sizer/window_sizer_ash_unittest.cc +++ b/chrome/browser/ui/window_sizer/window_sizer_ash_unittest.cc @@ -584,8 +584,8 @@ TEST_F(WindowSizerAshTest, MAYBE_PlaceNewBrowserWindowOnEmptyDesktop) { // Test the placement of newly created windows on multiple dislays. TEST_F(WindowSizerAshTest, MAYBE_PlaceNewWindowsOnMultipleDisplays) { UpdateDisplay("1600x1200,1600x1200"); - gfx::Rect primary_bounds = ash::Shell::GetInstance()->GetScreen()-> - GetPrimaryDisplay().bounds(); + gfx::Rect primary_bounds = + gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds(); gfx::Rect secondary_bounds = ash::ScreenUtil::GetSecondaryDisplay().bounds(); ash::Shell::GetInstance()->set_target_root_window( @@ -637,8 +637,9 @@ TEST_F(WindowSizerAshTest, MAYBE_PlaceNewWindowsOnMultipleDisplays) { // Move the window to the right side of the secondary display and create a new // window. It should be opened then on the secondary display. { - gfx::Display second_display = ash::Shell::GetScreen()-> - GetDisplayNearestPoint(gfx::Point(1600 + 100,10)); + gfx::Display second_display = + gfx::Screen::GetScreen()->GetDisplayNearestPoint( + gfx::Point(1600 + 100, 10)); browser_window->GetNativeWindow()->SetBoundsInScreen( gfx::Rect(secondary_bounds.CenterPoint().x() - 100, 10, 200, 200), second_display); @@ -828,8 +829,8 @@ TEST_F(WindowSizerAshTest, DefaultStateBecomesMaximized) { scoped_ptr<Browser> browser( chrome::CreateBrowserWithTestWindowForParams(&native_params)); - gfx::Rect display_bounds = ash::Shell::GetInstance()->GetScreen()-> - GetPrimaryDisplay().bounds(); + gfx::Rect display_bounds = + gfx::Screen::GetScreen()->GetPrimaryDisplay().bounds(); gfx::Rect specified_bounds = display_bounds; // Make a window bigger than the display work area. diff --git a/extensions/browser/api/system_display/display_info_provider.h b/extensions/browser/api/system_display/display_info_provider.h index e2fee24..1501e37 100644 --- a/extensions/browser/api/system_display/display_info_provider.h +++ b/extensions/browser/api/system_display/display_info_provider.h @@ -15,7 +15,6 @@ namespace gfx { class Display; -class Screen; } namespace extensions { @@ -49,10 +48,6 @@ class DisplayInfoProvider { const api::system_display::DisplayProperties& info, std::string* error) = 0; - // Get the screen that is always active, which will be used for monitoring - // display changes events. - virtual gfx::Screen* GetActiveScreen() = 0; - // Enable the unified desktop feature. virtual void EnableUnifiedDesktop(bool enable); diff --git a/extensions/browser/api/system_display/system_display_apitest.cc b/extensions/browser/api/system_display/system_display_apitest.cc index cdcb519..2c0548e 100644 --- a/extensions/browser/api/system_display/system_display_apitest.cc +++ b/extensions/browser/api/system_display/system_display_apitest.cc @@ -88,8 +88,6 @@ class MockDisplayInfoProvider : public DisplayInfoProvider { return true; } - gfx::Screen* GetActiveScreen() override { return NULL; } - void EnableUnifiedDesktop(bool enable) override { unified_desktop_enabled_ = enable; } diff --git a/extensions/browser/api/system_info/system_info_api.cc b/extensions/browser/api/system_info/system_info_api.cc index 74181ca..42679d6 100644 --- a/extensions/browser/api/system_info/system_info_api.cc +++ b/extensions/browser/api/system_info/system_info_api.cc @@ -20,7 +20,6 @@ #include "components/storage_monitor/storage_info.h" #include "components/storage_monitor/storage_monitor.h" #include "content/public/browser/browser_thread.h" -#include "extensions/browser/api/system_display/display_info_provider.h" #include "extensions/browser/api/system_storage/storage_info_provider.h" #include "extensions/browser/extensions_browser_client.h" #include "extensions/common/api/system_display.h" @@ -120,7 +119,7 @@ void SystemInfoEventRouter::AddEventListener(const std::string& event_name) { return; if (IsDisplayChangedEvent(event_name)) { - gfx::Screen* screen = DisplayInfoProvider::Get()->GetActiveScreen(); + gfx::Screen* screen = gfx::Screen::GetScreen(); if (screen) screen->AddObserver(this); } @@ -146,7 +145,7 @@ void SystemInfoEventRouter::RemoveEventListener(const std::string& event_name) { } if (IsDisplayChangedEvent(event_name)) { - gfx::Screen* screen = DisplayInfoProvider::Get()->GetActiveScreen(); + gfx::Screen* screen = gfx::Screen::GetScreen(); if (screen) screen->RemoveObserver(this); } diff --git a/extensions/shell/browser/shell_display_info_provider.cc b/extensions/shell/browser/shell_display_info_provider.cc index 32239ab..18ee967 100644 --- a/extensions/shell/browser/shell_display_info_provider.cc +++ b/extensions/shell/browser/shell_display_info_provider.cc @@ -30,10 +30,6 @@ void ShellDisplayInfoProvider::UpdateDisplayUnitInfoForPlatform( } } -gfx::Screen* ShellDisplayInfoProvider::GetActiveScreen() { - return NULL; -} - // static DisplayInfoProvider* DisplayInfoProvider::Create() { return new ShellDisplayInfoProvider(); diff --git a/extensions/shell/browser/shell_display_info_provider.h b/extensions/shell/browser/shell_display_info_provider.h index ceb30fb..65137f8 100644 --- a/extensions/shell/browser/shell_display_info_provider.h +++ b/extensions/shell/browser/shell_display_info_provider.h @@ -22,7 +22,6 @@ class ShellDisplayInfoProvider : public DisplayInfoProvider { void UpdateDisplayUnitInfoForPlatform( const gfx::Display& display, extensions::api::system_display::DisplayUnitInfo* unit) override; - gfx::Screen* GetActiveScreen() override; private: DISALLOW_COPY_AND_ASSIGN(ShellDisplayInfoProvider); |