diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-17 03:50:33 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-17 03:50:33 +0000 |
commit | 42c0a0c6d7f217aa7b52a4f3452f74857d894229 (patch) | |
tree | ac51dd0c4ee2e4cf8b3425ede7a78cb5a8da257c | |
parent | 0e62ba1500c67c29943d8ff3ea48d07599396e92 (diff) | |
download | chromium_src-42c0a0c6d7f217aa7b52a4f3452f74857d894229.zip chromium_src-42c0a0c6d7f217aa7b52a4f3452f74857d894229.tar.gz chromium_src-42c0a0c6d7f217aa7b52a4f3452f74857d894229.tar.bz2 |
Rename gfx::Screen::GetMonitorXXXX to gfx::Screen::GetDisplayXXX.
BUG=130828
R=oshima@chromium.org
TBR=sky@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10540123
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@142631 0039d316-1c4b-4281-b951-d872f2087c98
89 files changed, 280 insertions, 279 deletions
diff --git a/ash/dip_unittest.cc b/ash/dip_unittest.cc index 118350d..a6ebe14 100644 --- a/ash/dip_unittest.cc +++ b/ash/dip_unittest.cc @@ -39,7 +39,7 @@ TEST_F(DIPTest, MAYBE_WorkArea) { ChangeMonitorConfig(1.0f, gfx::Rect(0, 0, 1000, 900)); aura::RootWindow* root = Shell::GetPrimaryRootWindow(); - const gfx::Display display = gfx::Screen::GetMonitorNearestWindow(root); + const gfx::Display display = gfx::Screen::GetDisplayNearestWindow(root); EXPECT_EQ("0,0 1000x900", display.bounds().ToString()); gfx::Rect work_area = display.work_area(); @@ -48,7 +48,7 @@ TEST_F(DIPTest, MAYBE_WorkArea) { ChangeMonitorConfig(2.0f, gfx::Rect(0, 0, 2000, 1800)); - const gfx::Display display_2x = gfx::Screen::GetMonitorNearestWindow(root); + const gfx::Display display_2x = gfx::Screen::GetDisplayNearestWindow(root); // The |bounds_in_pixel()| should report bounds in pixel coordinate. EXPECT_EQ("0,0 2000x1800", display_2x.bounds_in_pixel().ToString()); diff --git a/ash/monitor/monitor_controller.cc b/ash/monitor/monitor_controller.cc index d224b94..0cdb550 100644 --- a/ash/monitor/monitor_controller.cc +++ b/ash/monitor/monitor_controller.cc @@ -46,7 +46,7 @@ MonitorController::~MonitorController() { void MonitorController::InitPrimaryDisplay() { aura::MonitorManager* monitor_manager = aura::Env::GetInstance()->monitor_manager(); - const gfx::Display& display = monitor_manager->GetMonitorAt(0); + const gfx::Display& display = monitor_manager->GetDisplayAt(0); DCHECK_EQ(0, display.id()); aura::RootWindow* root = monitor_manager->CreateRootWindowForMonitor(display); @@ -61,8 +61,8 @@ void MonitorController::InitPrimaryDisplay() { void MonitorController::InitSecondaryDisplays() { aura::MonitorManager* monitor_manager = aura::Env::GetInstance()->monitor_manager(); - for (size_t i = 1; i < monitor_manager->GetNumMonitors(); ++i) { - const gfx::Display& display = monitor_manager->GetMonitorAt(i); + for (size_t i = 1; i < monitor_manager->GetNumDisplays(); ++i) { + const gfx::Display& display = monitor_manager->GetDisplayAt(i); aura::RootWindow* root = monitor_manager->CreateRootWindowForMonitor(display); root_windows_[display.id()] = root; diff --git a/ash/monitor/multi_monitor_manager.cc b/ash/monitor/multi_monitor_manager.cc index e36cf01..25ff1f7 100644 --- a/ash/monitor/multi_monitor_manager.cc +++ b/ash/monitor/multi_monitor_manager.cc @@ -124,19 +124,19 @@ RootWindow* MultiMonitorManager::CreateRootWindowForMonitor( return root_window; } -const gfx::Display& MultiMonitorManager::GetMonitorAt(size_t index) { +const gfx::Display& MultiMonitorManager::GetDisplayAt(size_t index) { return index < displays_.size() ? displays_[index] : GetInvalidDisplay(); } -size_t MultiMonitorManager::GetNumMonitors() const { +size_t MultiMonitorManager::GetNumDisplays() const { return displays_.size(); } -const gfx::Display& MultiMonitorManager::GetMonitorNearestWindow( +const gfx::Display& MultiMonitorManager::GetDisplayNearestWindow( const Window* window) const { if (!window) { MultiMonitorManager* manager = const_cast<MultiMonitorManager*>(this); - return manager->GetMonitorAt(0); + return manager->GetDisplayAt(0); } const RootWindow* root = window->GetRootWindow(); MultiMonitorManager* that = const_cast<MultiMonitorManager*>(this); @@ -145,12 +145,12 @@ const gfx::Display& MultiMonitorManager::GetMonitorNearestWindow( GetInvalidDisplay(); } -const gfx::Display& MultiMonitorManager::GetMonitorNearestPoint( +const gfx::Display& MultiMonitorManager::GetDisplayNearestPoint( const gfx::Point& point) const { // TODO(oshima): For m19, mouse is constrained within // the primary window. MultiMonitorManager* manager = const_cast<MultiMonitorManager*>(this); - return manager->GetMonitorAt(0); + return manager->GetDisplayAt(0); } void MultiMonitorManager::OnRootWindowResized(const aura::RootWindow* root, diff --git a/ash/monitor/multi_monitor_manager.h b/ash/monitor/multi_monitor_manager.h index 381bba8..0faf39d 100644 --- a/ash/monitor/multi_monitor_manager.h +++ b/ash/monitor/multi_monitor_manager.h @@ -48,12 +48,12 @@ class ASH_EXPORT MultiMonitorManager : public aura::MonitorManager, const std::vector<gfx::Display>& displays) OVERRIDE; virtual aura::RootWindow* CreateRootWindowForMonitor( const gfx::Display& display) OVERRIDE; - virtual const gfx::Display& GetMonitorAt(size_t index) OVERRIDE; + virtual const gfx::Display& GetDisplayAt(size_t index) OVERRIDE; - virtual size_t GetNumMonitors() const OVERRIDE; - virtual const gfx::Display& GetMonitorNearestPoint( + virtual size_t GetNumDisplays() const OVERRIDE; + virtual const gfx::Display& GetDisplayNearestPoint( const gfx::Point& point) const OVERRIDE; - virtual const gfx::Display& GetMonitorNearestWindow( + virtual const gfx::Display& GetDisplayNearestWindow( const aura::Window* window) const OVERRIDE; // RootWindowObserver overrides: diff --git a/ash/monitor/multi_monitor_manager_unittest.cc b/ash/monitor/multi_monitor_manager_unittest.cc index 3a31fd3..94a28cd 100644 --- a/ash/monitor/multi_monitor_manager_unittest.cc +++ b/ash/monitor/multi_monitor_manager_unittest.cc @@ -92,14 +92,14 @@ class MultiMonitorManagerTest : public test::AshTestBase, TEST_F(MultiMonitorManagerTest, NativeMonitorTest) { aura::MonitorManager::set_use_fullscreen_host_window(true); - EXPECT_EQ(1U, monitor_manager()->GetNumMonitors()); + EXPECT_EQ(1U, monitor_manager()->GetNumDisplays()); // Update primary and add seconary. UpdateMonitor("0+0-500x500,0+501-400x400"); - EXPECT_EQ(2U, monitor_manager()->GetNumMonitors()); + EXPECT_EQ(2U, monitor_manager()->GetNumDisplays()); EXPECT_EQ("1 1 0", GetCountSummary()); - EXPECT_EQ(monitor_manager()->GetMonitorAt(0).id(), changed()[0].id()); - EXPECT_EQ(monitor_manager()->GetMonitorAt(1).id(), added()[0].id()); + EXPECT_EQ(monitor_manager()->GetDisplayAt(0).id(), changed()[0].id()); + EXPECT_EQ(monitor_manager()->GetDisplayAt(1).id(), added()[0].id()); EXPECT_EQ("0,0 500x500", changed()[0].bounds().ToString()); EXPECT_EQ("0,0 400x400", added()[0].bounds().ToString()); EXPECT_EQ("0,501 400x400", added()[0].bounds_in_pixel().ToString()); @@ -113,41 +113,41 @@ TEST_F(MultiMonitorManagerTest, NativeMonitorTest) { // Change primary. UpdateMonitor("0+0-1000x600"); EXPECT_EQ("1 0 0", GetCountSummary()); - EXPECT_EQ(monitor_manager()->GetMonitorAt(0).id(), changed()[0].id()); + EXPECT_EQ(monitor_manager()->GetDisplayAt(0).id(), changed()[0].id()); EXPECT_EQ("0,0 1000x600", changed()[0].bounds().ToString()); reset(); // Add secondary. UpdateMonitor("0+0-1000x600,1001+0-600x400"); - EXPECT_EQ(2U, monitor_manager()->GetNumMonitors()); + EXPECT_EQ(2U, monitor_manager()->GetNumDisplays()); EXPECT_EQ("0 1 0", GetCountSummary()); - EXPECT_EQ(monitor_manager()->GetMonitorAt(1).id(), added()[0].id()); + EXPECT_EQ(monitor_manager()->GetDisplayAt(1).id(), added()[0].id()); EXPECT_EQ("0,0 600x400", added()[0].bounds().ToString()); EXPECT_EQ("1001,0 600x400", added()[0].bounds_in_pixel().ToString()); reset(); // Secondary removed, primary changed. UpdateMonitor("0+0-800x300"); - EXPECT_EQ(1U, monitor_manager()->GetNumMonitors()); + EXPECT_EQ(1U, monitor_manager()->GetNumDisplays()); EXPECT_EQ("1 0 1", GetCountSummary()); - EXPECT_EQ(monitor_manager()->GetMonitorAt(0).id(), changed()[0].id()); + EXPECT_EQ(monitor_manager()->GetDisplayAt(0).id(), changed()[0].id()); EXPECT_EQ("0,0 800x300", changed()[0].bounds().ToString()); reset(); // # of display can go to zero when screen is off. const vector<gfx::Display> empty; monitor_manager()->OnNativeMonitorsChanged(empty); - EXPECT_EQ(1U, monitor_manager()->GetNumMonitors()); + EXPECT_EQ(1U, monitor_manager()->GetNumDisplays()); EXPECT_EQ("0 0 0", GetCountSummary()); EXPECT_FALSE(root_window_destroyed()); // Monitor configuration stays the same EXPECT_EQ("0,0 800x300", - monitor_manager()->GetMonitorAt(0).bounds().ToString()); + monitor_manager()->GetDisplayAt(0).bounds().ToString()); reset(); // Connect to monitor again UpdateMonitor("100+100-500x400"); - EXPECT_EQ(1U, monitor_manager()->GetNumMonitors()); + EXPECT_EQ(1U, monitor_manager()->GetNumDisplays()); EXPECT_EQ("1 0 0", GetCountSummary()); EXPECT_FALSE(root_window_destroyed()); EXPECT_EQ("0,0 500x400", changed()[0].bounds().ToString()); @@ -156,19 +156,19 @@ TEST_F(MultiMonitorManagerTest, NativeMonitorTest) { // Go back to zero and wake up with multiple monitors. monitor_manager()->OnNativeMonitorsChanged(empty); - EXPECT_EQ(1U, monitor_manager()->GetNumMonitors()); + EXPECT_EQ(1U, monitor_manager()->GetNumDisplays()); EXPECT_FALSE(root_window_destroyed()); reset(); // Add secondary. UpdateMonitor("0+0-1000x600,1000+0-600x400"); - EXPECT_EQ(2U, monitor_manager()->GetNumMonitors()); + EXPECT_EQ(2U, monitor_manager()->GetNumDisplays()); EXPECT_EQ("0,0 1000x600", - monitor_manager()->GetMonitorAt(0).bounds().ToString()); + monitor_manager()->GetDisplayAt(0).bounds().ToString()); EXPECT_EQ("0,0 600x400", - monitor_manager()->GetMonitorAt(1).bounds().ToString()); + monitor_manager()->GetDisplayAt(1).bounds().ToString()); EXPECT_EQ("1000,0 600x400", - monitor_manager()->GetMonitorAt(1).bounds_in_pixel().ToString()); + monitor_manager()->GetDisplayAt(1).bounds_in_pixel().ToString()); reset(); aura::MonitorManager::set_use_fullscreen_host_window(false); @@ -176,11 +176,11 @@ TEST_F(MultiMonitorManagerTest, NativeMonitorTest) { // Test in emulation mode (use_fullscreen_host_window=false) TEST_F(MultiMonitorManagerTest, EmulatorTest) { - EXPECT_EQ(1U, monitor_manager()->GetNumMonitors()); + EXPECT_EQ(1U, monitor_manager()->GetNumDisplays()); internal::MultiMonitorManager::AddRemoveMonitor(); // Update primary and add seconary. - EXPECT_EQ(2U, monitor_manager()->GetNumMonitors()); + EXPECT_EQ(2U, monitor_manager()->GetNumDisplays()); #if defined(OS_WIN) // TODO(oshima): Windows receives resize event for some reason. EXPECT_EQ("1 1 0", GetCountSummary()); @@ -190,7 +190,7 @@ TEST_F(MultiMonitorManagerTest, EmulatorTest) { reset(); internal::MultiMonitorManager::CycleMonitor(); - EXPECT_EQ(2U, monitor_manager()->GetNumMonitors()); + EXPECT_EQ(2U, monitor_manager()->GetNumDisplays()); // Observer gets called twice in this mode because // it gets notified both from |OnNativeMonitorChagned| // and from |RootWindowObserver|, which is the consequence of @@ -199,12 +199,12 @@ TEST_F(MultiMonitorManagerTest, EmulatorTest) { reset(); internal::MultiMonitorManager::AddRemoveMonitor(); - EXPECT_EQ(1U, monitor_manager()->GetNumMonitors()); + EXPECT_EQ(1U, monitor_manager()->GetNumDisplays()); EXPECT_EQ("0 0 1", GetCountSummary()); reset(); internal::MultiMonitorManager::CycleMonitor(); - EXPECT_EQ(1U, monitor_manager()->GetNumMonitors()); + EXPECT_EQ(1U, monitor_manager()->GetNumDisplays()); EXPECT_EQ("0 0 0", GetCountSummary()); reset(); } diff --git a/ash/screen_ash.cc b/ash/screen_ash.cc index 71df546..e444ebf 100644 --- a/ash/screen_ash.cc +++ b/ash/screen_ash.cc @@ -32,7 +32,7 @@ gfx::Rect ScreenAsh::GetMaximizedWindowBounds(aura::Window* window) { if (window->GetRootWindow() == Shell::GetPrimaryRootWindow()) return Shell::GetInstance()->shelf()->GetMaximizedWindowBounds(window); else - return gfx::Screen::GetMonitorNearestWindow(window).bounds(); + return gfx::Screen::GetDisplayNearestWindow(window).bounds(); } // static @@ -40,7 +40,7 @@ gfx::Rect ScreenAsh::GetUnmaximizedWorkAreaBounds(aura::Window* window) { if (window->GetRootWindow() == Shell::GetPrimaryRootWindow()) return Shell::GetInstance()->shelf()->GetUnmaximizedWorkAreaBounds(window); else - return gfx::Screen::GetMonitorNearestWindow(window).work_area(); + return gfx::Screen::GetDisplayNearestWindow(window).work_area(); } gfx::Point ScreenAsh::GetCursorScreenPoint() { @@ -54,20 +54,20 @@ gfx::NativeWindow ScreenAsh::GetWindowAtCursorScreenPoint() { return Shell::GetRootWindowAt(point)->GetTopWindowContainingPoint(point); } -int ScreenAsh::GetNumMonitors() { - return GetMonitorManager()->GetNumMonitors(); +int ScreenAsh::GetNumDisplays() { + return GetMonitorManager()->GetNumDisplays(); } -gfx::Display ScreenAsh::GetMonitorNearestWindow(gfx::NativeView window) const { - return GetMonitorManager()->GetMonitorNearestWindow(window); +gfx::Display ScreenAsh::GetDisplayNearestWindow(gfx::NativeView window) const { + return GetMonitorManager()->GetDisplayNearestWindow(window); } -gfx::Display ScreenAsh::GetMonitorNearestPoint(const gfx::Point& point) const { - return GetMonitorManager()->GetMonitorNearestPoint(point); +gfx::Display ScreenAsh::GetDisplayNearestPoint(const gfx::Point& point) const { + return GetMonitorManager()->GetDisplayNearestPoint(point); } -gfx::Display ScreenAsh::GetPrimaryMonitor() const { - return GetMonitorManager()->GetMonitorAt(0); +gfx::Display ScreenAsh::GetPrimaryDisplay() const { + return GetMonitorManager()->GetDisplayAt(0); } } // namespace ash diff --git a/ash/screen_ash.h b/ash/screen_ash.h index bfe29b3..bd987d3 100644 --- a/ash/screen_ash.h +++ b/ash/screen_ash.h @@ -32,12 +32,12 @@ class ASH_EXPORT ScreenAsh : public gfx::ScreenImpl { virtual gfx::Point GetCursorScreenPoint() OVERRIDE; virtual gfx::NativeWindow GetWindowAtCursorScreenPoint() OVERRIDE; - virtual int GetNumMonitors() OVERRIDE; - virtual gfx::Display GetMonitorNearestWindow( + virtual int GetNumDisplays() OVERRIDE; + virtual gfx::Display GetDisplayNearestWindow( gfx::NativeView view) const OVERRIDE; - virtual gfx::Display GetMonitorNearestPoint( + virtual gfx::Display GetDisplayNearestPoint( const gfx::Point& point) const OVERRIDE; - virtual gfx::Display GetPrimaryMonitor() const OVERRIDE; + virtual gfx::Display GetPrimaryDisplay() const OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(ScreenAsh); diff --git a/ash/screensaver/screensaver_view.cc b/ash/screensaver/screensaver_view.cc index 39eb8fb..013024a 100644 --- a/ash/screensaver/screensaver_view.cc +++ b/ash/screensaver/screensaver_view.cc @@ -10,10 +10,10 @@ #include "base/logging.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/browser_thread.h" -#include "ui/gfx/screen.h" #include "ui/aura/root_window.h" -#include "ui/views/layout/fill_layout.h" +#include "ui/gfx/screen.h" #include "ui/views/controls/webview/webview.h" +#include "ui/views/layout/fill_layout.h" #include "ui/views/widget/widget.h" using content::BrowserThread; @@ -129,7 +129,7 @@ void ScreensaverView::LoadScreensaver() { void ScreensaverView::ShowWindow() { aura::RootWindow* root_window = ash::Shell::GetPrimaryRootWindow(); gfx::Rect screen_rect = - gfx::Screen::GetMonitorNearestWindow(root_window).bounds(); + gfx::Screen::GetDisplayNearestWindow(root_window).bounds(); // We want to be the fullscreen topmost child of the root window. // There should be nothing ever really that should show up on top of us. diff --git a/ash/system/tray/tray_bubble_view.cc b/ash/system/tray/tray_bubble_view.cc index 250cb0c..da998a1d 100644 --- a/ash/system/tray/tray_bubble_view.cc +++ b/ash/system/tray/tray_bubble_view.cc @@ -269,7 +269,7 @@ gfx::Rect TrayBubbleView::GetAnchorRect() { rect = host_->GetAnchorRect(); // TODO(jennyz): May need to add left/right alignment in the following code. if (rect.IsEmpty()) { - rect = gfx::Screen::GetPrimaryMonitor().bounds(); + rect = gfx::Screen::GetPrimaryDisplay().bounds(); rect = gfx::Rect( base::i18n::IsRTL() ? kPaddingFromRightEdgeOfScreenBottomAlignment : rect.width() - kPaddingFromRightEdgeOfScreenBottomAlignment, diff --git a/ash/test/ash_test_base.cc b/ash/test/ash_test_base.cc index 323790c..5b92cd8 100644 --- a/ash/test/ash_test_base.cc +++ b/ash/test/ash_test_base.cc @@ -74,7 +74,7 @@ void AshTestBase::TearDown() { void AshTestBase::ChangeMonitorConfig(float scale, const gfx::Rect& bounds_in_pixel) { - gfx::Display display = gfx::Display(gfx::Screen::GetPrimaryMonitor().id()); + gfx::Display display = gfx::Display(gfx::Screen::GetPrimaryDisplay().id()); display.SetScaleAndBounds(scale, bounds_in_pixel); std::vector<gfx::Display> displays; displays.push_back(display); diff --git a/ash/tooltips/tooltip_controller.cc b/ash/tooltips/tooltip_controller.cc index 23b30a5..64ca6f0 100644 --- a/ash/tooltips/tooltip_controller.cc +++ b/ash/tooltips/tooltip_controller.cc @@ -67,7 +67,7 @@ int GetMaxWidth(int x, int y) { // TODO(varunjain): implementation duplicated in tooltip_manager_aura. Figure // out a way to merge. gfx::Rect monitor_bounds = - gfx::Screen::GetMonitorNearestPoint(gfx::Point(x, y)).bounds(); + gfx::Screen::GetDisplayNearestPoint(gfx::Point(x, y)).bounds(); return (monitor_bounds.width() + 1) / 2; } @@ -156,7 +156,7 @@ class TooltipController::Tooltip { tooltip_rect.Offset(kCursorOffsetX, kCursorOffsetY); gfx::Rect monitor_bounds = - gfx::Screen::GetMonitorNearestPoint(tooltip_rect.origin()).bounds(); + gfx::Screen::GetDisplayNearestPoint(tooltip_rect.origin()).bounds(); // If tooltip is out of bounds on the x axis, we simply shift it // horizontally by the offset. diff --git a/ash/touch/touch_observer_hud.cc b/ash/touch/touch_observer_hud.cc index c9372aa..82ac305 100644 --- a/ash/touch/touch_observer_hud.cc +++ b/ash/touch/touch_observer_hud.cc @@ -42,7 +42,7 @@ class TouchHudCanvas : public views::View { : owner_(owner), path_index_(0), color_index_(0) { - gfx::Display display = gfx::Screen::GetPrimaryMonitor(); + gfx::Display display = gfx::Screen::GetPrimaryDisplay(); gfx::Rect bounds = display.bounds(); size_.set_width(bounds.width() / kScale); size_.set_height(bounds.height() / kScale); diff --git a/ash/wm/base_layout_manager.cc b/ash/wm/base_layout_manager.cc index d9f90a6..4e39fff 100644 --- a/ash/wm/base_layout_manager.cc +++ b/ash/wm/base_layout_manager.cc @@ -105,7 +105,7 @@ void BaseLayoutManager::SetChildBounds(aura::Window* child, if (wm::IsWindowMaximized(child)) child_bounds = ScreenAsh::GetMaximizedWindowBounds(child); else if (wm::IsWindowFullscreen(child)) - child_bounds = gfx::Screen::GetMonitorNearestWindow(child).bounds(); + child_bounds = gfx::Screen::GetDisplayNearestWindow(child).bounds(); SetChildBoundsDirect(child, child_bounds); } @@ -198,7 +198,7 @@ void BaseLayoutManager::UpdateBoundsFromShowState(aura::Window* window, // Don't animate the full-screen window transition. // TODO(jamescook): Use animation here. Be sure the lock screen works. SetChildBoundsDirect( - window, gfx::Screen::GetMonitorNearestWindow(window).bounds()); + window, gfx::Screen::GetDisplayNearestWindow(window).bounds()); break; default: @@ -235,11 +235,11 @@ void BaseLayoutManager::AdjustWindowSizesForScreenChange() { SetChildBoundsDirect(window, ScreenAsh::GetMaximizedWindowBounds(window)); } else if (wm::IsWindowFullscreen(window)) { SetChildBoundsDirect( - window, gfx::Screen::GetMonitorNearestWindow(window).bounds()); + window, gfx::Screen::GetDisplayNearestWindow(window).bounds()); } else { // The work area may be smaller than the full screen. gfx::Rect monitor_rect = - gfx::Screen::GetMonitorNearestWindow(window).work_area(); + gfx::Screen::GetDisplayNearestWindow(window).work_area(); // Put as much of the window as possible within the monitor area. window->SetBounds(window->bounds().AdjustToFit(monitor_rect)); } diff --git a/ash/wm/base_layout_manager_unittest.cc b/ash/wm/base_layout_manager_unittest.cc index 7420d23..626aa66 100644 --- a/ash/wm/base_layout_manager_unittest.cc +++ b/ash/wm/base_layout_manager_unittest.cc @@ -95,7 +95,7 @@ TEST_F(BaseLayoutManagerTest, Fullscreen) { window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); // Fullscreen window fills the whole monitor. EXPECT_EQ( - gfx::Screen::GetMonitorNearestWindow(window.get()).bounds().ToString(), + gfx::Screen::GetDisplayNearestWindow(window.get()).bounds().ToString(), window->bounds().ToString()); window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); EXPECT_EQ(bounds.ToString(), window->bounds().ToString()); @@ -108,12 +108,12 @@ TEST_F(BaseLayoutManagerTest, FullscreenRootWindowResize) { // Fullscreen window fills the whole monitor. window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); EXPECT_EQ( - gfx::Screen::GetMonitorNearestWindow(window.get()).bounds().ToString(), + gfx::Screen::GetDisplayNearestWindow(window.get()).bounds().ToString(), window->bounds().ToString()); // Enlarge the root window. We should still match the monitor size. Shell::GetPrimaryRootWindow()->SetHostSize(gfx::Size(800, 600)); EXPECT_EQ( - gfx::Screen::GetMonitorNearestWindow(window.get()).bounds().ToString(), + gfx::Screen::GetDisplayNearestWindow(window.get()).bounds().ToString(), window->bounds().ToString()); } @@ -130,20 +130,20 @@ TEST_F(BaseLayoutManagerTest, MAYBE_RootWindowResizeShrinksWindows) { scoped_ptr<aura::Window> window( CreateTestWindow(gfx::Rect(10, 20, 500, 400))); gfx::Rect work_area = - gfx::Screen::GetMonitorNearestWindow(window.get()).work_area(); + gfx::Screen::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. Shell::GetPrimaryRootWindow()->SetHostSize(gfx::Size(300, 400)); - work_area = gfx::Screen::GetMonitorNearestWindow(window.get()).work_area(); + work_area = gfx::Screen::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. Shell::GetPrimaryRootWindow()->SetHostSize(gfx::Size(300, 200)); - work_area = gfx::Screen::GetMonitorNearestWindow(window.get()).work_area(); + work_area = gfx::Screen::GetDisplayNearestWindow(window.get()).work_area(); EXPECT_LE(window->bounds().width(), work_area.width()); EXPECT_LE(window->bounds().height(), work_area.height()); @@ -158,7 +158,7 @@ TEST_F(BaseLayoutManagerTest, MAYBE_RootWindowResizeShrinksWindows) { // to smaller than the full work area. TEST_F(BaseLayoutManagerTest, BoundsWithScreenEdgeVisible) { // Create a window with bounds that fill the screen. - gfx::Rect bounds = gfx::Screen::GetPrimaryMonitor().bounds(); + gfx::Rect bounds = gfx::Screen::GetPrimaryDisplay().bounds(); scoped_ptr<aura::Window> window(CreateTestWindow(bounds)); // Maximize it, which writes the old bounds to restore bounds. window->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MAXIMIZED); diff --git a/ash/wm/shelf_layout_manager.cc b/ash/wm/shelf_layout_manager.cc index e6c674a..3c3246f 100644 --- a/ash/wm/shelf_layout_manager.cc +++ b/ash/wm/shelf_layout_manager.cc @@ -156,7 +156,7 @@ bool ShelfLayoutManager::IsVisible() const { gfx::Rect ShelfLayoutManager::GetMaximizedWindowBounds( aura::Window* window) { // TODO: needs to be multi-mon aware. - gfx::Rect bounds(gfx::Screen::GetMonitorNearestWindow(window).bounds()); + gfx::Rect bounds(gfx::Screen::GetDisplayNearestWindow(window).bounds()); if (auto_hide_behavior_ == SHELF_AUTO_HIDE_BEHAVIOR_DEFAULT || auto_hide_behavior_ == SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS) { AdjustBoundsBasedOnAlignment(kAutoHideSize, &bounds); @@ -169,7 +169,7 @@ gfx::Rect ShelfLayoutManager::GetMaximizedWindowBounds( gfx::Rect ShelfLayoutManager::GetUnmaximizedWorkAreaBounds( aura::Window* window) { // TODO: needs to be multi-mon aware. - gfx::Rect bounds(gfx::Screen::GetMonitorNearestWindow(window).bounds()); + gfx::Rect bounds(gfx::Screen::GetDisplayNearestWindow(window).bounds()); int size; if (auto_hide_behavior_ == SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS) { size = kAutoHideSize; @@ -209,7 +209,7 @@ gfx::Rect ShelfLayoutManager::GetIdealBounds() { // TODO: this is wrong. Figure out what monitor shelf is on and everything // should be based on it. gfx::Rect bounds( - gfx::Screen::GetMonitorNearestWindow(status_->GetNativeView()).bounds()); + gfx::Screen::GetDisplayNearestWindow(status_->GetNativeView()).bounds()); int width = 0, height = 0; GetShelfSize(&width, &height); switch (alignment_) { diff --git a/ash/wm/shelf_layout_manager_unittest.cc b/ash/wm/shelf_layout_manager_unittest.cc index cd88130..7bade22 100644 --- a/ash/wm/shelf_layout_manager_unittest.cc +++ b/ash/wm/shelf_layout_manager_unittest.cc @@ -95,7 +95,7 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetVisible) { const aura::MonitorManager* manager = aura::Env::GetInstance()->monitor_manager(); const gfx::Display& display = - manager->GetMonitorNearestWindow(Shell::GetPrimaryRootWindow()); + manager->GetDisplayNearestWindow(Shell::GetPrimaryRootWindow()); ASSERT_NE(-1, display.id()); // Bottom inset should be the max of widget heights. EXPECT_EQ(shelf_height, @@ -112,9 +112,9 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetVisible) { // Make sure the bounds of the two widgets changed. EXPECT_GE(shelf->launcher_widget()->GetNativeView()->bounds().y(), - gfx::Screen::GetPrimaryMonitor().bounds().bottom()); + gfx::Screen::GetPrimaryDisplay().bounds().bottom()); EXPECT_GE(shelf->status()->GetNativeView()->bounds().y(), - gfx::Screen::GetPrimaryMonitor().bounds().bottom()); + gfx::Screen::GetPrimaryDisplay().bounds().bottom()); // And show it again. SetState(shelf, ShelfLayoutManager::VISIBLE); @@ -127,7 +127,7 @@ TEST_F(ShelfLayoutManagerTest, MAYBE_SetVisible) { // Make sure the bounds of the two widgets changed. launcher_bounds = shelf->launcher_widget()->GetNativeView()->bounds(); - int bottom = gfx::Screen::GetPrimaryMonitor().bounds().bottom() - + int bottom = gfx::Screen::GetPrimaryDisplay().bounds().bottom() - shelf_height; EXPECT_EQ(launcher_bounds.y(), bottom + (shelf->GetIdealBounds().height() - @@ -147,7 +147,7 @@ TEST_F(ShelfLayoutManagerTest, LayoutShelfWhileAnimating) { const aura::MonitorManager* manager = aura::Env::GetInstance()->monitor_manager(); const gfx::Display& display = - manager->GetMonitorNearestWindow(Shell::GetPrimaryRootWindow()); + manager->GetDisplayNearestWindow(Shell::GetPrimaryRootWindow()); // Hide the shelf. SetState(shelf, ShelfLayoutManager::HIDDEN); @@ -157,9 +157,9 @@ TEST_F(ShelfLayoutManagerTest, LayoutShelfWhileAnimating) { // Make sure the bounds of the two widgets changed. EXPECT_GE(shelf->launcher_widget()->GetNativeView()->bounds().y(), - gfx::Screen::GetPrimaryMonitor().bounds().bottom()); + gfx::Screen::GetPrimaryDisplay().bounds().bottom()); EXPECT_GE(shelf->status()->GetNativeView()->bounds().y(), - gfx::Screen::GetPrimaryMonitor().bounds().bottom()); + gfx::Screen::GetPrimaryDisplay().bounds().bottom()); } // Makes sure the launcher is initially sized correctly. @@ -221,7 +221,7 @@ TEST_F(ShelfLayoutManagerTest, AutoHide) { EXPECT_EQ(root->bounds().bottom() - ShelfLayoutManager::kAutoHideSize, shelf->launcher_widget()->GetWindowScreenBounds().y()); EXPECT_EQ(root->bounds().bottom() - ShelfLayoutManager::kAutoHideSize, - gfx::Screen::GetMonitorNearestWindow(root).work_area().bottom()); + gfx::Screen::GetDisplayNearestWindow(root).work_area().bottom()); // Move the mouse to the bottom of the screen. generator.MoveMouseTo(0, root->bounds().bottom() - 1); @@ -233,7 +233,7 @@ TEST_F(ShelfLayoutManagerTest, AutoHide) { EXPECT_EQ(root->bounds().bottom() - shelf->GetIdealBounds().height(), shelf->launcher_widget()->GetWindowScreenBounds().y()); EXPECT_EQ(root->bounds().bottom() - ShelfLayoutManager::kAutoHideSize, - gfx::Screen::GetMonitorNearestWindow(root).work_area().bottom()); + gfx::Screen::GetDisplayNearestWindow(root).work_area().bottom()); // Move mouse back up. generator.MoveMouseTo(0, 0); @@ -327,7 +327,7 @@ TEST_F(ShelfLayoutManagerTest, SetAutoHideBehavior) { widget->Show(); aura::Window* window = widget->GetNativeWindow(); gfx::Rect monitor_bounds( - gfx::Screen::GetMonitorNearestWindow(window).bounds()); + gfx::Screen::GetDisplayNearestWindow(window).bounds()); EXPECT_EQ(monitor_bounds.bottom() - ShelfLayoutManager::kAutoHideSize, shelf->GetMaximizedWindowBounds(window).bottom()); EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); @@ -349,17 +349,17 @@ TEST_F(ShelfLayoutManagerTest, SetAutoHideBehavior) { widget->Maximize(); EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); - EXPECT_EQ(gfx::Screen::GetMonitorNearestWindow(window).work_area().bottom(), + EXPECT_EQ(gfx::Screen::GetDisplayNearestWindow(window).work_area().bottom(), widget->GetWorkAreaBoundsInScreen().bottom()); shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); EXPECT_EQ(ShelfLayoutManager::AUTO_HIDE, shelf->visibility_state()); - EXPECT_EQ(gfx::Screen::GetMonitorNearestWindow(window).work_area().bottom(), + EXPECT_EQ(gfx::Screen::GetDisplayNearestWindow(window).work_area().bottom(), widget->GetWorkAreaBoundsInScreen().bottom()); shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); EXPECT_EQ(ShelfLayoutManager::VISIBLE, shelf->visibility_state()); - EXPECT_EQ(gfx::Screen::GetMonitorNearestWindow(window).work_area().bottom(), + EXPECT_EQ(gfx::Screen::GetDisplayNearestWindow(window).work_area().bottom(), widget->GetWorkAreaBoundsInScreen().bottom()); } @@ -504,7 +504,7 @@ TEST_F(ShelfLayoutManagerTest, SetAlignment) { const aura::MonitorManager* manager = aura::Env::GetInstance()->monitor_manager(); gfx::Display display = - manager->GetMonitorNearestWindow(Shell::GetPrimaryRootWindow()); + manager->GetDisplayNearestWindow(Shell::GetPrimaryRootWindow()); ASSERT_NE(-1, display.id()); EXPECT_EQ(shelf->GetIdealBounds().width(), display.GetWorkAreaInsets().left()); @@ -527,7 +527,7 @@ TEST_F(ShelfLayoutManagerTest, SetAlignment) { shelf->SetAlignment(SHELF_ALIGNMENT_RIGHT); launcher_bounds = shelf->launcher_widget()->GetWindowScreenBounds(); - display = manager->GetMonitorNearestWindow(Shell::GetPrimaryRootWindow()); + display = manager->GetDisplayNearestWindow(Shell::GetPrimaryRootWindow()); ASSERT_NE(-1, display.id()); EXPECT_EQ(shelf->GetIdealBounds().width(), display.GetWorkAreaInsets().right()); diff --git a/ash/wm/system_gesture_event_filter.cc b/ash/wm/system_gesture_event_filter.cc index ecde085..8e12bb8 100644 --- a/ash/wm/system_gesture_event_filter.cc +++ b/ash/wm/system_gesture_event_filter.cc @@ -25,11 +25,11 @@ #include "third_party/skia/include/core/SkRect.h" #include "ui/aura/event.h" #include "ui/aura/root_window.h" -#include "ui/compositor/scoped_layer_animation_settings.h" #include "ui/base/animation/animation.h" #include "ui/base/animation/animation_delegate.h" #include "ui/base/animation/linear_animation.h" #include "ui/base/gestures/gesture_configuration.h" +#include "ui/compositor/scoped_layer_animation_settings.h" #include "ui/gfx/canvas.h" #include "ui/gfx/point.h" #include "ui/gfx/rect.h" @@ -477,7 +477,7 @@ ui::GestureStatus SystemGestureEventFilter::PreHandleGestureEvent( switch (event->type()) { case ui::ET_GESTURE_SCROLL_BEGIN: { gfx::Rect screen = - gfx::Screen::GetMonitorNearestWindow(target).bounds(); + gfx::Screen::GetDisplayNearestWindow(target).bounds(); int overlap_area = screen.width() * overlap_percent_ / 100; orientation_ = SCROLL_ORIENTATION_UNSET; @@ -578,7 +578,7 @@ void SystemGestureEventFilter::ClearGestureHandlerForWindow( bool SystemGestureEventFilter::HandleDeviceControl(aura::Window* target, aura::GestureEvent* event) { - gfx::Rect screen = gfx::Screen::GetMonitorNearestWindow(target).bounds(); + gfx::Rect screen = gfx::Screen::GetDisplayNearestWindow(target).bounds(); double percent = 100.0 * (event->y() - screen.y()) / screen.height(); if (percent > 100.0) percent = 100.0; diff --git a/ash/wm/system_gesture_event_filter_unittest.cc b/ash/wm/system_gesture_event_filter_unittest.cc index 5070b14..2ca46bf 100644 --- a/ash/wm/system_gesture_event_filter_unittest.cc +++ b/ash/wm/system_gesture_event_filter_unittest.cc @@ -14,10 +14,10 @@ #include "ash/volume_control_delegate.h" #include "ash/wm/window_util.h" #include "base/time.h" -#include "ui/gfx/screen.h" #include "ui/aura/event.h" #include "ui/aura/root_window.h" #include "ui/aura/test/test_windows.h" +#include "ui/gfx/screen.h" namespace ash { namespace test { @@ -134,7 +134,7 @@ TEST_F(SystemGestureEventFilterTest, TapOutsideRootWindow) { TEST_F(SystemGestureEventFilterTest, DeviceControl) { aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); - gfx::Rect screen = gfx::Screen::GetPrimaryMonitor().bounds(); + gfx::Rect screen = gfx::Screen::GetPrimaryDisplay().bounds(); int ypos_half = screen.height() / 2; ash::AcceleratorController* accelerator = @@ -244,7 +244,7 @@ TEST_F(SystemGestureEventFilterTest, DeviceControl) { TEST_F(SystemGestureEventFilterTest, ApplicationControl) { aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); - gfx::Rect screen = gfx::Screen::GetPrimaryMonitor().bounds(); + gfx::Rect screen = gfx::Screen::GetPrimaryDisplay().bounds(); int ypos_half = screen.height() / 2; aura::test::TestWindowDelegate delegate; diff --git a/ash/wm/toplevel_window_event_filter_unittest.cc b/ash/wm/toplevel_window_event_filter_unittest.cc index f66cec3..fc8984b 100644 --- a/ash/wm/toplevel_window_event_filter_unittest.cc +++ b/ash/wm/toplevel_window_event_filter_unittest.cc @@ -350,7 +350,7 @@ TEST_F(ToplevelWindowEventFilterTest, DoubleClickCaptionTogglesMaximize) { TEST_F(ToplevelWindowEventFilterTest, BottomRightWorkArea) { scoped_ptr<aura::Window> target(CreateWindow(HTBOTTOMRIGHT)); gfx::Rect work_area = - gfx::Screen::GetMonitorNearestWindow(target.get()).work_area(); + gfx::Screen::GetDisplayNearestWindow(target.get()).work_area(); gfx::Point position = target->bounds().origin(); // Drag further than work_area bottom. DragFromCenterBy(target.get(), 100, work_area.height()); @@ -364,7 +364,7 @@ TEST_F(ToplevelWindowEventFilterTest, BottomRightWorkArea) { TEST_F(ToplevelWindowEventFilterTest, BottomLeftWorkArea) { scoped_ptr<aura::Window> target(CreateWindow(HTBOTTOMLEFT)); gfx::Rect work_area = - gfx::Screen::GetMonitorNearestWindow(target.get()).work_area(); + gfx::Screen::GetDisplayNearestWindow(target.get()).work_area(); gfx::Point position = target->bounds().origin(); // Drag further than work_area bottom. DragFromCenterBy(target.get(), -30, work_area.height()); @@ -379,7 +379,7 @@ TEST_F(ToplevelWindowEventFilterTest, BottomLeftWorkArea) { TEST_F(ToplevelWindowEventFilterTest, BottomWorkArea) { scoped_ptr<aura::Window> target(CreateWindow(HTBOTTOM)); gfx::Rect work_area = - gfx::Screen::GetMonitorNearestWindow(target.get()).work_area(); + gfx::Screen::GetDisplayNearestWindow(target.get()).work_area(); gfx::Point position = target->bounds().origin(); // Drag further than work_area bottom. DragFromCenterBy(target.get(), 0, work_area.height()); @@ -406,7 +406,7 @@ TEST_F(ToplevelWindowEventFilterTest, DontDragToNegativeY) { TEST_F(ToplevelWindowEventFilterTest, DontGotWiderThanScreen) { scoped_ptr<aura::Window> target(CreateWindow(HTRIGHT)); gfx::Rect work_area = - gfx::Screen::GetMonitorNearestWindow(target.get()).bounds(); + gfx::Screen::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 913b694..d5d11e5 100644 --- a/ash/wm/window_animations.cc +++ b/ash/wm/window_animations.cc @@ -382,7 +382,7 @@ gfx::Rect GetMinimizeRectForWindow(aura::Window* window) { // Assume the launcher is overflowed, zoom off to the bottom right of the // work area. gfx::Rect work_area = - gfx::Screen::GetMonitorNearestWindow(window).work_area(); + gfx::Screen::GetDisplayNearestWindow(window).work_area(); target_bounds.SetRect(work_area.right(), work_area.bottom(), 0, 0); } return target_bounds; diff --git a/ash/wm/window_manager_unittest.cc b/ash/wm/window_manager_unittest.cc index 60a9617..4217e64 100644 --- a/ash/wm/window_manager_unittest.cc +++ b/ash/wm/window_manager_unittest.cc @@ -449,7 +449,7 @@ TEST_F(WindowManagerTest, MAYBE_TransformActivate) { gfx::Size size = root_window->bounds().size(); EXPECT_EQ( gfx::Rect(size).ToString(), - gfx::Screen::GetMonitorNearestPoint(gfx::Point()).bounds().ToString()); + gfx::Screen::GetDisplayNearestPoint(gfx::Point()).bounds().ToString()); // Rotate it clock-wise 90 degrees. ui::Transform transform; diff --git a/ash/wm/window_resizer.cc b/ash/wm/window_resizer.cc index 2d43e8b..7e62d23 100644 --- a/ash/wm/window_resizer.cc +++ b/ash/wm/window_resizer.cc @@ -202,7 +202,7 @@ gfx::Rect WindowResizer::CalculateBoundsForDrag( if (details.window_component == HTBOTTOM || details.window_component == HTBOTTOMRIGHT || details.window_component == HTBOTTOMLEFT) { - gfx::Rect work_area = gfx::Screen::GetMonitorNearestWindow( + gfx::Rect work_area = gfx::Screen::GetDisplayNearestWindow( details.window).work_area(); if (new_bounds.bottom() > work_area.bottom()) new_bounds.Inset(0, 0, 0, @@ -294,7 +294,7 @@ int WindowResizer::GetWidthForDrag(const Details& details, // And don't let the window go bigger than the monitor. int max_width = - gfx::Screen::GetMonitorNearestWindow(details.window).bounds().width(); + gfx::Screen::GetDisplayNearestWindow(details.window).bounds().width(); if (width > max_width) { width = max_width; *delta_x = -x_multiplier * (details.initial_bounds.width() - max_width); @@ -328,7 +328,7 @@ int WindowResizer::GetHeightForDrag(const Details& details, // And don't let the window go bigger than the monitor. int max_height = - gfx::Screen::GetMonitorNearestWindow(details.window).bounds().height(); + gfx::Screen::GetDisplayNearestWindow(details.window).bounds().height(); if (height > max_height) { height = max_height; *delta_y = -y_multiplier * (details.initial_bounds.height() - max_height); diff --git a/ash/wm/window_util.cc b/ash/wm/window_util.cc index 833e02c..17f6034 100644 --- a/ash/wm/window_util.cc +++ b/ash/wm/window_util.cc @@ -94,7 +94,7 @@ void RestoreWindow(aura::Window* window) { } void CenterWindow(aura::Window* window) { - const gfx::Display display = gfx::Screen::GetMonitorNearestWindow(window); + const gfx::Display display = gfx::Screen::GetDisplayNearestWindow(window); gfx::Rect center = display.work_area().Center(window->bounds().size()); window->SetBounds(center); } diff --git a/ash/wm/workspace/maximized_workspace.cc b/ash/wm/workspace/maximized_workspace.cc index 329c48c..f7e1b7a 100644 --- a/ash/wm/workspace/maximized_workspace.cc +++ b/ash/wm/workspace/maximized_workspace.cc @@ -41,7 +41,7 @@ void MaximizedWorkspace::OnWindowRemoved(aura::Window* window) { void MaximizedWorkspace::ResetWindowBounds(aura::Window* window) { if (wm::IsWindowFullscreen(window)) { SetWindowBounds(window, - gfx::Screen::GetMonitorNearestWindow(window).bounds()); + gfx::Screen::GetDisplayNearestWindow(window).bounds()); } else { SetWindowBounds(window, ScreenAsh::GetMaximizedWindowBounds(window)); } diff --git a/ash/wm/workspace/snap_sizer.cc b/ash/wm/workspace/snap_sizer.cc index 0816ff0..092ba697 100644 --- a/ash/wm/workspace/snap_sizer.cc +++ b/ash/wm/workspace/snap_sizer.cc @@ -130,7 +130,7 @@ gfx::Rect SnapSizer::GetTargetBoundsForPercent(int percent_index) const { bool SnapSizer::AlongEdge(int x) const { // TODO: need to support multi-monitor. - gfx::Rect area(gfx::Screen::GetMonitorNearestWindow(window_).bounds()); + gfx::Rect area(gfx::Screen::GetDisplayNearestWindow(window_).bounds()); return (x <= area.x()) || (x >= area.right() - 1); } diff --git a/ash/wm/workspace/workspace_event_filter.cc b/ash/wm/workspace/workspace_event_filter.cc index 91c5c7c..863b418 100644 --- a/ash/wm/workspace/workspace_event_filter.cc +++ b/ash/wm/workspace/workspace_event_filter.cc @@ -128,7 +128,7 @@ void WorkspaceEventFilter::HandleVerticalResizeDoubleClick( int component = target->delegate()->GetNonClientComponent(event->location()); gfx::Rect work_area = - gfx::Screen::GetMonitorNearestWindow(target).work_area(); + gfx::Screen::GetDisplayNearestWindow(target).work_area(); const gfx::Rect* restore_bounds = target->GetProperty(aura::client::kRestoreBoundsKey); if (component == HTBOTTOM || component == HTTOP) { diff --git a/ash/wm/workspace/workspace_event_filter_unittest.cc b/ash/wm/workspace/workspace_event_filter_unittest.cc index 65c69b4..00c2b44 100644 --- a/ash/wm/workspace/workspace_event_filter_unittest.cc +++ b/ash/wm/workspace/workspace_event_filter_unittest.cc @@ -7,8 +7,8 @@ #include "ash/shell.h" #include "ash/test/ash_test_base.h" #include "ash/wm/window_util.h" -#include "ash/wm/workspace_controller.h" #include "ash/wm/workspace/workspace_manager.h" +#include "ash/wm/workspace_controller.h" #include "ui/aura/test/event_generator.h" #include "ui/aura/test/test_window_delegate.h" #include "ui/aura/window.h" @@ -52,7 +52,7 @@ TEST_F(WorkspaceEventFilterTest, DoubleClickSingleAxisResizeEdge) { scoped_ptr<aura::Window> window(CreateTestWindow(&wd, restored_bounds)); gfx::Rect work_area = - gfx::Screen::GetMonitorNearestWindow(window.get()).work_area(); + gfx::Screen::GetDisplayNearestWindow(window.get()).work_area(); aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), window.get()); diff --git a/ash/wm/workspace/workspace_manager_unittest.cc b/ash/wm/workspace/workspace_manager_unittest.cc index 22e20f2..0377b7d 100644 --- a/ash/wm/workspace/workspace_manager_unittest.cc +++ b/ash/wm/workspace/workspace_manager_unittest.cc @@ -61,7 +61,7 @@ class WorkspaceManagerTest : public test::AshTestBase { } gfx::Rect GetFullscreenBounds(aura::Window* window) { - return gfx::Screen::GetMonitorNearestWindow(window).bounds(); + return gfx::Screen::GetDisplayNearestWindow(window).bounds(); } Workspace* active_workspace() { diff --git a/ash/wm/workspace/workspace_window_resizer.cc b/ash/wm/workspace/workspace_window_resizer.cc index 9065d8d..9b52030 100644 --- a/ash/wm/workspace/workspace_window_resizer.cc +++ b/ash/wm/workspace/workspace_window_resizer.cc @@ -210,7 +210,7 @@ void WorkspaceWindowResizer::LayoutAttachedWindows( const gfx::Rect& bounds, int grid_size) { gfx::Rect work_area( - gfx::Screen::GetMonitorNearestWindow(window()).work_area()); + gfx::Screen::GetDisplayNearestWindow(window()).work_area()); std::vector<int> sizes; CalculateAttachedSizes( PrimaryAxisSize(details_.initial_bounds.size()), @@ -280,7 +280,7 @@ void WorkspaceWindowResizer::AdjustBoundsForMainWindow( gfx::Rect* bounds, int grid_size) const { // Always keep kMinOnscreenHeight on the bottom. gfx::Rect work_area( - gfx::Screen::GetMonitorNearestWindow(window()).work_area()); + gfx::Screen::GetDisplayNearestWindow(window()).work_area()); int max_y = AlignToGridRoundUp(work_area.bottom() - kMinOnscreenHeight, grid_size); if (bounds->y() > max_y) @@ -334,7 +334,7 @@ void WorkspaceWindowResizer::SnapToWorkAreaEdges( bool WorkspaceWindowResizer::TouchesBottomOfScreen() const { gfx::Rect work_area( - gfx::Screen::GetMonitorNearestWindow(details_.window).work_area()); + gfx::Screen::GetDisplayNearestWindow(details_.window).work_area()); return (attached_windows_.empty() && details_.window->bounds().bottom() == work_area.bottom()) || (!attached_windows_.empty() && @@ -422,7 +422,7 @@ WorkspaceWindowResizer::SnapType WorkspaceWindowResizer::GetSnapType( // TODO: this likely only wants total monitor area, not the area of a single // monitor. gfx::Rect area( - gfx::Screen::GetMonitorNearestWindow(details_.window).bounds()); + gfx::Screen::GetDisplayNearestWindow(details_.window).bounds()); if (location.x() <= area.x()) return SNAP_LEFT_EDGE; if (location.x() >= area.right() - 1) diff --git a/chrome/browser/chromeos/input_method/candidate_window.cc b/chrome/browser/chromeos/input_method/candidate_window.cc index 08ed884..ce67738 100644 --- a/chrome/browser/chromeos/input_method/candidate_window.cc +++ b/chrome/browser/chromeos/input_method/candidate_window.cc @@ -1215,7 +1215,7 @@ void CandidateWindowView::ResizeAndMoveParentFrame() { const int horizontal_offset = GetHorizontalOffset(); gfx::Rect old_bounds = parent_frame_->GetClientAreaScreenBounds(); - gfx::Rect screen_bounds = gfx::Screen::GetMonitorNearestWindow( + gfx::Rect screen_bounds = gfx::Screen::GetDisplayNearestWindow( parent_frame_->GetNativeView()).work_area(); // The size. gfx::Rect frame_bounds = old_bounds; @@ -1510,7 +1510,7 @@ void InfolistWindowView::UpdateCandidates( void InfolistWindowView::ResizeAndMoveParentFrame() { int x, y; gfx::Rect old_bounds = parent_frame_->GetClientAreaScreenBounds(); - gfx::Rect screen_bounds = gfx::Screen::GetMonitorNearestWindow( + gfx::Rect screen_bounds = gfx::Screen::GetDisplayNearestWindow( parent_frame_->GetNativeView()).work_area(); // The size. gfx::Rect frame_bounds = old_bounds; diff --git a/chrome/browser/chromeos/login/helper.cc b/chrome/browser/chromeos/login/helper.cc index 4e5ca77..d8daa2e 100644 --- a/chrome/browser/chromeos/login/helper.cc +++ b/chrome/browser/chromeos/login/helper.cc @@ -54,7 +54,7 @@ views::Throbber* CreateDefaultThrobber() { } gfx::Rect CalculateScreenBounds(const gfx::Size& size) { - gfx::Rect bounds(gfx::Screen::GetPrimaryMonitor().bounds()); + gfx::Rect bounds(gfx::Screen::GetPrimaryDisplay().bounds()); if (!size.IsEmpty()) { int horizontal_diff = bounds.width() - size.width(); int vertical_diff = bounds.height() - size.height(); diff --git a/chrome/browser/chromeos/login/webui_screen_locker.cc b/chrome/browser/chromeos/login/webui_screen_locker.cc index 3bbc46a..2d8949c 100644 --- a/chrome/browser/chromeos/login/webui_screen_locker.cc +++ b/chrome/browser/chromeos/login/webui_screen_locker.cc @@ -44,7 +44,7 @@ WebUIScreenLocker::WebUIScreenLocker(ScreenLocker* screen_locker) } void WebUIScreenLocker::LockScreen(bool unlock_on_input) { - gfx::Rect bounds(gfx::Screen::GetPrimaryMonitor().bounds()); + gfx::Rect bounds(gfx::Screen::GetPrimaryDisplay().bounds()); LockWindow* lock_window = LockWindow::Create(); lock_window->set_observer(this); diff --git a/chrome/browser/chromeos/media/media_player.cc b/chrome/browser/chromeos/media/media_player.cc index 49447d0..bbdfbbf 100644 --- a/chrome/browser/chromeos/media/media_player.cc +++ b/chrome/browser/chromeos/media/media_player.cc @@ -124,7 +124,7 @@ void MediaPlayer::PopupMediaPlayer() { return; } - const gfx::Size screen = gfx::Screen::GetPrimaryMonitor().size(); + const gfx::Size screen = gfx::Screen::GetPrimaryDisplay().size(); const gfx::Rect bounds(screen.width() - kPopupRight - kPopupWidth, screen.height() - kPopupBottom - kPopupHeight, kPopupWidth, diff --git a/chrome/browser/metrics/metrics_log.cc b/chrome/browser/metrics/metrics_log.cc index 4f4f614..42ff2af 100644 --- a/chrome/browser/metrics/metrics_log.cc +++ b/chrome/browser/metrics/metrics_log.cc @@ -335,11 +335,11 @@ PrefService* MetricsLog::GetPrefService() { } gfx::Size MetricsLog::GetScreenSize() const { - return gfx::Screen::GetPrimaryMonitor().GetSizeInPixel(); + return gfx::Screen::GetPrimaryDisplay().GetSizeInPixel(); } int MetricsLog::GetScreenCount() const { - return gfx::Screen::GetNumMonitors(); + return gfx::Screen::GetNumDisplays(); } void MetricsLog::GetFieldTrialIds( diff --git a/chrome/browser/notifications/balloon_collection_impl.cc b/chrome/browser/notifications/balloon_collection_impl.cc index e684925..f5e7317 100644 --- a/chrome/browser/notifications/balloon_collection_impl.cc +++ b/chrome/browser/notifications/balloon_collection_impl.cc @@ -464,7 +464,7 @@ bool BalloonCollectionImpl::Layout::RefreshSystemMetrics() { #if defined(OS_MACOSX) gfx::Rect new_work_area = GetMacWorkArea(); #else - gfx::Rect new_work_area = gfx::Screen::GetPrimaryMonitor().work_area(); + gfx::Rect new_work_area = gfx::Screen::GetPrimaryDisplay().work_area(); #endif if (!work_area_.Equals(new_work_area)) { work_area_.SetRect(new_work_area.x(), new_work_area.y(), diff --git a/chrome/browser/ui/gtk/browser_window_gtk.cc b/chrome/browser/ui/gtk/browser_window_gtk.cc index 6ea2b9c..f5493d3 100644 --- a/chrome/browser/ui/gtk/browser_window_gtk.cc +++ b/chrome/browser/ui/gtk/browser_window_gtk.cc @@ -2130,7 +2130,7 @@ void BrowserWindowGtk::SaveWindowPosition() { window_preferences->SetBoolean("maximized", IsMaximized()); gfx::Rect work_area( - gfx::Screen::GetMonitorMatching(restored_bounds_).work_area()); + gfx::Screen::GetDisplayMatching(restored_bounds_).work_area()); window_preferences->SetInteger("work_area_left", work_area.x()); window_preferences->SetInteger("work_area_top", work_area.y()); window_preferences->SetInteger("work_area_right", work_area.right()); diff --git a/chrome/browser/ui/panels/display_settings_provider.cc b/chrome/browser/ui/panels/display_settings_provider.cc index 32b3955..d27ed9d 100644 --- a/chrome/browser/ui/panels/display_settings_provider.cc +++ b/chrome/browser/ui/panels/display_settings_provider.cc @@ -69,7 +69,7 @@ gfx::Rect DisplaySettingsProvider::GetDisplayArea() { } gfx::Rect DisplaySettingsProvider::GetPrimaryScreenArea() const { - return gfx::Screen::GetPrimaryMonitor().bounds(); + return gfx::Screen::GetPrimaryDisplay().bounds(); } gfx::Rect DisplaySettingsProvider::GetWorkArea() const { @@ -78,7 +78,7 @@ gfx::Rect DisplaySettingsProvider::GetWorkArea() const { // screen (and overlap Dock). And we also want to exclude the system menu // area. Note that the rect returned from gfx::Screen util functions is in // platform-independent screen coordinates with (0, 0) as the top-left corner. - gfx::Display display = gfx::Screen::GetPrimaryMonitor(); + gfx::Display display = gfx::Screen::GetPrimaryDisplay(); gfx::Rect display_area = display.bounds(); gfx::Rect work_area = display.work_area(); int system_menu_height = work_area.y() - display_area.y(); @@ -88,7 +88,7 @@ gfx::Rect DisplaySettingsProvider::GetWorkArea() const { } return display_area; #else - gfx::Rect work_area = gfx::Screen::GetPrimaryMonitor().work_area(); + gfx::Rect work_area = gfx::Screen::GetPrimaryDisplay().work_area(); #endif return work_area; } diff --git a/chrome/browser/ui/panels/old_panel_and_desktop_notification_browsertest.cc b/chrome/browser/ui/panels/old_panel_and_desktop_notification_browsertest.cc index 0bb710a..155121d 100644 --- a/chrome/browser/ui/panels/old_panel_and_desktop_notification_browsertest.cc +++ b/chrome/browser/ui/panels/old_panel_and_desktop_notification_browsertest.cc @@ -84,7 +84,7 @@ class OldPanelAndDesktopNotificationTest : public OldBasePanelBrowserTest { // The position returned by the notification balloon is based on Mac's // vertically inverted orientation. We need to flip it so that it can // be compared against the position returned by the panel. - gfx::Size screen_size = gfx::Screen::GetPrimaryMonitor().size(); + gfx::Size screen_size = gfx::Screen::GetPrimaryDisplay().size(); return screen_size.height() - balloon->GetPosition().y(); #else return balloon->GetPosition().y() + balloon->GetViewSize().height(); diff --git a/chrome/browser/ui/panels/panel_and_desktop_notification_browsertest.cc b/chrome/browser/ui/panels/panel_and_desktop_notification_browsertest.cc index 1e9f54a..ae2f83e 100644 --- a/chrome/browser/ui/panels/panel_and_desktop_notification_browsertest.cc +++ b/chrome/browser/ui/panels/panel_and_desktop_notification_browsertest.cc @@ -88,7 +88,7 @@ class PanelAndDesktopNotificationTest : public BasePanelBrowserTest { // The position returned by the notification balloon is based on Mac's // vertically inverted orientation. We need to flip it so that it can // be compared against the position returned by the panel. - gfx::Size screen_size = gfx::Screen::GetPrimaryMonitor().size(); + gfx::Size screen_size = gfx::Screen::GetPrimaryDisplay().size(); return screen_size.height() - balloon->GetPosition().y(); #else return balloon->GetPosition().y() + balloon->GetViewSize().height(); diff --git a/chrome/browser/ui/pdf/pdf_browsertest.cc b/chrome/browser/ui/pdf/pdf_browsertest.cc index bcc5c95..5a4b3d9 100644 --- a/chrome/browser/ui/pdf/pdf_browsertest.cc +++ b/chrome/browser/ui/pdf/pdf_browsertest.cc @@ -69,7 +69,7 @@ class PDFBrowserTest : public InProcessBrowserTest, // to a smaller window and then expanding leads to slight anti-aliasing // differences of the text and the pixel comparison fails. gfx::Rect bounds(gfx::Rect(0, 0, kBrowserWidth, kBrowserHeight)); - gfx::Rect screen_bounds = gfx::Screen::GetPrimaryMonitor().bounds(); + gfx::Rect screen_bounds = gfx::Screen::GetPrimaryDisplay().bounds(); ASSERT_GT(screen_bounds.width(), kBrowserWidth); ASSERT_GT(screen_bounds.height(), kBrowserHeight); browser()->window()->SetBounds(bounds); diff --git a/chrome/browser/ui/views/ash/window_positioner.cc b/chrome/browser/ui/views/ash/window_positioner.cc index f84dfe3..3e73c6d 100644 --- a/chrome/browser/ui/views/ash/window_positioner.cc +++ b/chrome/browser/ui/views/ash/window_positioner.cc @@ -48,8 +48,8 @@ gfx::Rect WindowPositioner::GetPopupPosition(const gfx::Rect& old_pos) { // work area. aura::Window* window = ash::wm::GetActiveWindow(); const gfx::Rect work_area = window && window->IsVisible() ? - gfx::Screen::GetMonitorNearestWindow(window).work_area() : - gfx::Screen::GetPrimaryMonitor().work_area(); + gfx::Screen::GetDisplayNearestWindow(window).work_area() : + gfx::Screen::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/chrome/browser/ui/views/ash/window_positioner_unittest.cc b/chrome/browser/ui/views/ash/window_positioner_unittest.cc index 65ad94e..737c3db 100644 --- a/chrome/browser/ui/views/ash/window_positioner_unittest.cc +++ b/chrome/browser/ui/views/ash/window_positioner_unittest.cc @@ -12,8 +12,8 @@ #include "base/compiler_specific.h" #include "base/logging.h" #include "chrome/browser/ui/browser.h" -#include "chrome/test/base/testing_profile.h" #include "chrome/test/base/test_browser_window.h" +#include "chrome/test/base/testing_profile.h" #include "content/public/browser/browser_thread.h" #include "content/public/test/render_view_test.h" #include "content/public/test/test_browser_thread.h" @@ -194,7 +194,7 @@ void WindowPositionerTest::TearDown() { } // namespace TEST_F(WindowPositionerTest, cascading) { - const gfx::Rect work_area = gfx::Screen::GetPrimaryMonitor().work_area(); + const gfx::Rect work_area = gfx::Screen::GetPrimaryDisplay().work_area(); // First see that the window will cascade down when there is no space. window()->SetBounds(work_area); @@ -254,7 +254,7 @@ TEST_F(WindowPositionerTest, cascading) { } TEST_F(WindowPositionerTest, filling) { - const gfx::Rect work_area = gfx::Screen::GetPrimaryMonitor().work_area(); + const gfx::Rect work_area = gfx::Screen::GetPrimaryDisplay().work_area(); int grid = ash::Shell::GetInstance()->GetGridSize(); gfx::Rect popup_position(0, 0, 256, 128); // Leave space on the left and the right and see if we fill top to bottom. @@ -309,7 +309,7 @@ TEST_F(WindowPositionerTest, filling) { } TEST_F(WindowPositionerTest, blockedByPanel) { - const gfx::Rect work_area = gfx::Screen::GetPrimaryMonitor().work_area(); + const gfx::Rect work_area = gfx::Screen::GetPrimaryDisplay().work_area(); gfx::Rect pop_position(0, 0, 200, 200); // Let the panel cover everything. @@ -324,7 +324,7 @@ TEST_F(WindowPositionerTest, blockedByPanel) { } TEST_F(WindowPositionerTest, biggerThenBorder) { - const gfx::Rect work_area = gfx::Screen::GetPrimaryMonitor().work_area(); + const gfx::Rect work_area = gfx::Screen::GetPrimaryDisplay().work_area(); gfx::Rect pop_position(0, 0, work_area.width(), work_area.height()); diff --git a/chrome/browser/ui/views/chrome_views_delegate.cc b/chrome/browser/ui/views/chrome_views_delegate.cc index 001c203..ba23179 100644 --- a/chrome/browser/ui/views/chrome_views_delegate.cc +++ b/chrome/browser/ui/views/chrome_views_delegate.cc @@ -75,7 +75,7 @@ void ChromeViewsDelegate::SaveWindowPlacement(const views::Widget* window, window_preferences->SetBoolean("maximized", show_state == ui::SHOW_STATE_MAXIMIZED); gfx::Rect work_area( - gfx::Screen::GetMonitorMatching(bounds).work_area()); + gfx::Screen::GetDisplayMatching(bounds).work_area()); window_preferences->SetInteger("work_area_left", work_area.x()); window_preferences->SetInteger("work_area_top", work_area.y()); window_preferences->SetInteger("work_area_right", work_area.right()); diff --git a/chrome/browser/ui/views/extensions/extension_dialog.cc b/chrome/browser/ui/views/extensions/extension_dialog.cc index d9a531d..e9f9f03 100644 --- a/chrome/browser/ui/views/extensions/extension_dialog.cc +++ b/chrome/browser/ui/views/extensions/extension_dialog.cc @@ -132,7 +132,7 @@ ExtensionHost* ExtensionDialog::CreateExtensionHost(const GURL& url, void ExtensionDialog::InitWindowFullscreen() { aura::RootWindow* root_window = ash::Shell::GetPrimaryRootWindow(); gfx::Rect screen_rect = - gfx::Screen::GetMonitorNearestWindow(root_window).bounds(); + gfx::Screen::GetDisplayNearestWindow(root_window).bounds(); // We want to be the fullscreen topmost child of the root window. window_ = new views::Widget; diff --git a/chrome/browser/ui/views/fullscreen_exit_bubble_views.cc b/chrome/browser/ui/views/fullscreen_exit_bubble_views.cc index 8d34e70..45ce385 100644 --- a/chrome/browser/ui/views/fullscreen_exit_bubble_views.cc +++ b/chrome/browser/ui/views/fullscreen_exit_bubble_views.cc @@ -340,7 +340,7 @@ gfx::Rect FullscreenExitBubbleViews::GetPopupRect( gfx::Size size(view_->GetPreferredSize()); // NOTE: don't use the bounds of the root_view_. On linux changing window // size is async. Instead we use the size of the screen. - gfx::Rect screen_bounds = gfx::Screen::GetMonitorNearestWindow( + gfx::Rect screen_bounds = gfx::Screen::GetDisplayNearestWindow( root_view_->GetWidget()->GetNativeView()).bounds(); gfx::Point origin(screen_bounds.x() + (screen_bounds.width() - size.width()) / 2, diff --git a/chrome/browser/ui/views/keyboard_overlay_delegate.cc b/chrome/browser/ui/views/keyboard_overlay_delegate.cc index 7844537..55b7dc5 100644 --- a/chrome/browser/ui/views/keyboard_overlay_delegate.cc +++ b/chrome/browser/ui/views/keyboard_overlay_delegate.cc @@ -81,7 +81,7 @@ void KeyboardOverlayDelegate::Show(WebDialogView* view) { // Show the widget at the bottom of the work area. gfx::Size size; GetDialogSize(&size); - const gfx::Rect& rect = gfx::Screen::GetMonitorNearestWindow( + const gfx::Rect& rect = gfx::Screen::GetDisplayNearestWindow( widget->GetNativeView()).work_area(); gfx::Rect bounds((rect.width() - size.width()) / 2, rect.height() - size.height(), @@ -114,7 +114,7 @@ void KeyboardOverlayDelegate::GetDialogSize( gfx::Size* size) const { using std::min; DCHECK(view_); - gfx::Rect rect = gfx::Screen::GetMonitorNearestWindow( + gfx::Rect rect = gfx::Screen::GetDisplayNearestWindow( view_->GetWidget()->GetNativeView()).bounds(); const int width = min(kBaseWidth, rect.width() - kHorizontalMargin); const int height = width * kBaseHeight / kBaseWidth; diff --git a/chrome/browser/ui/views/status_bubble_views.cc b/chrome/browser/ui/views/status_bubble_views.cc index 9d23448..85167cf 100644 --- a/chrome/browser/ui/views/status_bubble_views.cc +++ b/chrome/browser/ui/views/status_bubble_views.cc @@ -766,7 +766,7 @@ void StatusBubbleViews::AvoidMouse(const gfx::Point& location) { // download shelf. gfx::NativeView widget = base_view_->GetWidget()->GetNativeView(); gfx::Rect monitor_rect = - gfx::Screen::GetMonitorNearestWindow(widget).work_area(); + gfx::Screen::GetDisplayNearestWindow(widget).work_area(); const int bubble_bottom_y = top_left.y() + position_.y() + size_.height(); if (bubble_bottom_y + offset > monitor_rect.height() || diff --git a/chrome/browser/ui/views/tabs/dock_info_win.cc b/chrome/browser/ui/views/tabs/dock_info_win.cc index f5fa245..c4f23ef 100644 --- a/chrome/browser/ui/views/tabs/dock_info_win.cc +++ b/chrome/browser/ui/views/tabs/dock_info_win.cc @@ -242,7 +242,7 @@ class DockToWindowFinder : public BaseWindowFinder { const std::set<HWND>& ignore) : BaseWindowFinder(ignore), screen_loc_(screen_loc) { - gfx::Rect work_area = gfx::Screen::GetMonitorNearestPoint( + gfx::Rect work_area = gfx::Screen::GetDisplayNearestPoint( screen_loc).bounds(); if (!work_area.IsEmpty()) { result_.set_monitor_bounds(work_area); diff --git a/chrome/browser/ui/views/tabs/tab_drag_controller.cc b/chrome/browser/ui/views/tabs/tab_drag_controller.cc index dc91d4d..5b2763e 100644 --- a/chrome/browser/ui/views/tabs/tab_drag_controller.cc +++ b/chrome/browser/ui/views/tabs/tab_drag_controller.cc @@ -632,7 +632,7 @@ gfx::Point TabDragController::GetWindowCreatePoint( // If the cursor is outside the monitor area, move it inside. For example, // dropping a tab onto the task bar on Windows produces this situation. - gfx::Rect work_area = gfx::Screen::GetMonitorNearestPoint(origin).work_area(); + gfx::Rect work_area = gfx::Screen::GetDisplayNearestPoint(origin).work_area(); gfx::Point create_point(origin); if (!work_area.IsEmpty()) { if (create_point.x() < work_area.x()) diff --git a/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc b/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc index 69e3a2f..4e7a4cf 100644 --- a/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc +++ b/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc @@ -137,7 +137,7 @@ Browser* TabDragControllerTest::CreateAnotherWindowBrowserAndRelayout() { ResetIDs(browser2->tab_strip_model(), 100); // Resize the two windows so they're right next to each other. - gfx::Rect work_area = gfx::Screen::GetMonitorNearestWindow( + gfx::Rect work_area = gfx::Screen::GetDisplayNearestWindow( browser()->window()->GetNativeWindow()).work_area(); gfx::Size half_size = gfx::Size(work_area.width() / 3 - 10, work_area.height() / 2 - 10); diff --git a/chrome/browser/ui/window_sizer.cc b/chrome/browser/ui/window_sizer.cc index 0dffea6..13a1505 100644 --- a/chrome/browser/ui/window_sizer.cc +++ b/chrome/browser/ui/window_sizer.cc @@ -22,15 +22,15 @@ const int kMinVisibleWidth = 30; class DefaultMonitorInfoProvider : public MonitorInfoProvider { public: // Overridden from MonitorInfoProvider: - virtual gfx::Rect GetPrimaryMonitorWorkArea() const OVERRIDE { - return gfx::Screen::GetPrimaryMonitor().work_area(); + virtual gfx::Rect GetPrimaryDisplayWorkArea() const OVERRIDE { + return gfx::Screen::GetPrimaryDisplay().work_area(); } - virtual gfx::Rect GetPrimaryMonitorBounds() const OVERRIDE { - return gfx::Screen::GetPrimaryMonitor().bounds(); + virtual gfx::Rect GetPrimaryDisplayBounds() const OVERRIDE { + return gfx::Screen::GetPrimaryDisplay().bounds(); } virtual gfx::Rect GetMonitorWorkAreaMatching( const gfx::Rect& match_rect) const OVERRIDE { - return gfx::Screen::GetMonitorMatching(match_rect).work_area(); + return gfx::Screen::GetDisplayMatching(match_rect).work_area(); } }; @@ -213,7 +213,7 @@ void WindowSizer::GetDefaultWindowBounds(gfx::Rect* default_bounds) const { DCHECK(default_bounds); DCHECK(monitor_info_provider_.get()); - gfx::Rect work_area = monitor_info_provider_->GetPrimaryMonitorWorkArea(); + gfx::Rect work_area = monitor_info_provider_->GetPrimaryDisplayWorkArea(); // The default size is either some reasonably wide width, or if the work // area is narrower, then the work area width less some aesthetic padding. @@ -222,7 +222,7 @@ void WindowSizer::GetDefaultWindowBounds(gfx::Rect* default_bounds) const { // For wider aspect ratio displays at higher resolutions, we might size the // window narrower to allow two windows to easily be placed side-by-side. - gfx::Rect screen_size = monitor_info_provider_->GetPrimaryMonitorBounds(); + gfx::Rect screen_size = monitor_info_provider_->GetPrimaryDisplayBounds(); double width_to_height = static_cast<double>(screen_size.width()) / screen_size.height(); diff --git a/chrome/browser/ui/window_sizer.h b/chrome/browser/ui/window_sizer.h index 9a3553c..cdf765b 100644 --- a/chrome/browser/ui/window_sizer.h +++ b/chrome/browser/ui/window_sizer.h @@ -19,10 +19,10 @@ class MonitorInfoProvider { virtual ~MonitorInfoProvider() {} // Returns the bounds of the work area of the primary monitor. - virtual gfx::Rect GetPrimaryMonitorWorkArea() const = 0; + virtual gfx::Rect GetPrimaryDisplayWorkArea() const = 0; // Returns the bounds of the primary monitor. - virtual gfx::Rect GetPrimaryMonitorBounds() const = 0; + virtual gfx::Rect GetPrimaryDisplayBounds() const = 0; // Returns the bounds of the work area of the monitor that most closely // intersects the provided bounds. diff --git a/chrome/browser/ui/window_sizer_ash.cc b/chrome/browser/ui/window_sizer_ash.cc index c941c90..e1eb836 100644 --- a/chrome/browser/ui/window_sizer_ash.cc +++ b/chrome/browser/ui/window_sizer_ash.cc @@ -100,7 +100,7 @@ void WindowSizer::GetDefaultWindowBounds(gfx::Rect* default_bounds) const { DCHECK(default_bounds); DCHECK(monitor_info_provider_.get()); - gfx::Rect work_area = monitor_info_provider_->GetPrimaryMonitorWorkArea(); + gfx::Rect work_area = monitor_info_provider_->GetPrimaryDisplayWorkArea(); DCHECK_EQ(kDesktopBorderSize, ash::Shell::GetInstance()->GetGridSize()); diff --git a/chrome/browser/ui/window_sizer_common_unittest.h b/chrome/browser/ui/window_sizer_common_unittest.h index 38323d1..2345d29 100644 --- a/chrome/browser/ui/window_sizer_common_unittest.h +++ b/chrome/browser/ui/window_sizer_common_unittest.h @@ -47,9 +47,9 @@ class TestMonitorInfoProvider : public MonitorInfoProvider { void AddMonitor(const gfx::Rect& bounds, const gfx::Rect& work_area); // Overridden from WindowSizer::MonitorInfoProvider: - virtual gfx::Rect GetPrimaryMonitorWorkArea() const OVERRIDE; + virtual gfx::Rect GetPrimaryDisplayWorkArea() const OVERRIDE; - virtual gfx::Rect GetPrimaryMonitorBounds() const OVERRIDE; + virtual gfx::Rect GetPrimaryDisplayBounds() const OVERRIDE; virtual gfx::Rect GetMonitorWorkAreaMatching( const gfx::Rect& match_rect) const OVERRIDE; @@ -74,11 +74,11 @@ void TestMonitorInfoProvider::AddMonitor(const gfx::Rect& bounds, } // Overridden from WindowSizer::MonitorInfoProvider: -gfx::Rect TestMonitorInfoProvider::GetPrimaryMonitorWorkArea() const { +gfx::Rect TestMonitorInfoProvider::GetPrimaryDisplayWorkArea() const { return work_areas_[0]; } -gfx::Rect TestMonitorInfoProvider::GetPrimaryMonitorBounds() const { +gfx::Rect TestMonitorInfoProvider::GetPrimaryDisplayBounds() const { return monitor_bounds_[0]; } diff --git a/chrome/browser/ui/window_sizer_gtk.cc b/chrome/browser/ui/window_sizer_gtk.cc index 3598361..6c00319 100644 --- a/chrome/browser/ui/window_sizer_gtk.cc +++ b/chrome/browser/ui/window_sizer_gtk.cc @@ -20,7 +20,7 @@ const int WindowSizer::kWindowTilePixels = 10; // static gfx::Point WindowSizer::GetDefaultPopupOrigin(const gfx::Size& size) { - gfx::Rect monitor_bounds = gfx::Screen::GetPrimaryMonitor().work_area(); + gfx::Rect monitor_bounds = gfx::Screen::GetPrimaryDisplay().work_area(); gfx::Point corner(monitor_bounds.x(), monitor_bounds.y()); if (Browser* browser = BrowserList::GetLastActive()) { GtkWindow* window = diff --git a/content/browser/renderer_host/dip_util.cc b/content/browser/renderer_host/dip_util.cc index 4d6fd244..36ee094 100644 --- a/content/browser/renderer_host/dip_util.cc +++ b/content/browser/renderer_host/dip_util.cc @@ -15,7 +15,7 @@ namespace content { float GetDIPScaleFactor(const RenderWidgetHostView* view) { if (gfx::Screen::IsDIPEnabled()) { - gfx::Display display = gfx::Screen::GetMonitorNearestWindow( + gfx::Display display = gfx::Screen::GetDisplayNearestWindow( view ? view->GetNativeView() : NULL); return display.device_scale_factor(); } diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc index db1f6fa..8fdfab0 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc @@ -113,8 +113,8 @@ bool CanRendererHandleEvent(const aura::MouseEvent* event) { void GetScreenInfoForWindow(WebKit::WebScreenInfo* results, aura::Window* window) { const gfx::Display display = window ? - gfx::Screen::GetMonitorNearestWindow(window) : - gfx::Screen::GetPrimaryMonitor(); + gfx::Screen::GetDisplayNearestWindow(window) : + gfx::Screen::GetPrimaryDisplay(); const gfx::Size size = display.size(); results->rect = WebKit::WebRect(0, 0, size.width(), size.height()); results->availableRect = results->rect; diff --git a/content/browser/renderer_host/render_widget_host_view_base.cc b/content/browser/renderer_host/render_widget_host_view_base.cc index 56e70dd..8fee3f1 100644 --- a/content/browser/renderer_host/render_widget_host_view_base.cc +++ b/content/browser/renderer_host/render_widget_host_view_base.cc @@ -98,13 +98,13 @@ void RenderWidgetHostViewBase::SetBrowserAccessibilityManager( } void RenderWidgetHostViewBase::UpdateScreenInfo() { - gfx::Display monitor = gfx::Screen::GetMonitorNearestPoint( + gfx::Display display = gfx::Screen::GetDisplayNearestPoint( GetViewBounds().origin()); - if (current_display_area_ == monitor.bounds() && - current_device_scale_factor_ == monitor.device_scale_factor()) + if (current_display_area_ == display.bounds() && + current_device_scale_factor_ == display.device_scale_factor()) return; - current_display_area_ = monitor.bounds(); - current_device_scale_factor_ = monitor.device_scale_factor(); + current_display_area_ = display.bounds(); + current_device_scale_factor_ = display.device_scale_factor(); if (GetRenderWidgetHost()) { RenderWidgetHostImpl* impl = RenderWidgetHostImpl::From(GetRenderWidgetHost()); diff --git a/content/browser/renderer_host/render_widget_host_view_win.cc b/content/browser/renderer_host/render_widget_host_view_win.cc index c9df5a6..1818f58 100644 --- a/content/browser/renderer_host/render_widget_host_view_win.cc +++ b/content/browser/renderer_host/render_widget_host_view_win.cc @@ -635,7 +635,7 @@ void RenderWidgetHostViewWin::InitAsPopup( void RenderWidgetHostViewWin::InitAsFullscreen( RenderWidgetHostView* reference_host_view) { - gfx::Rect pos = gfx::Screen::GetMonitorNearestWindow( + gfx::Rect pos = gfx::Screen::GetDisplayNearestWindow( reference_host_view->GetNativeView()).bounds(); is_fullscreen_ = true; DoPopupOrFullscreenInit(ui::GetWindowToParentTo(true), pos, 0); diff --git a/ui/app_list/app_list_view.cc b/ui/app_list/app_list_view.cc index 1ec1458..210a0a8 100644 --- a/ui/app_list/app_list_view.cc +++ b/ui/app_list/app_list_view.cc @@ -160,7 +160,7 @@ gfx::Rect AppListView::GetBubbleBounds() { GetPreferredSize(), false /* try_mirroring_arrow */); - gfx::Rect monitor_rect = gfx::Screen::GetMonitorNearestPoint( + gfx::Rect monitor_rect = gfx::Screen::GetDisplayNearestPoint( anchor_rect.CenterPoint()).work_area(); if (monitor_rect.IsEmpty() || monitor_rect.Contains(bubble_rect)) return bubble_rect; diff --git a/ui/aura/desktop/desktop_screen_win.cc b/ui/aura/desktop/desktop_screen_win.cc index 1eebb68..5738d9b 100644 --- a/ui/aura/desktop/desktop_screen_win.cc +++ b/ui/aura/desktop/desktop_screen_win.cc @@ -58,11 +58,11 @@ gfx::NativeWindow DesktopScreenWin::GetWindowAtCursorScreenPoint() { return host ? host->GetRootWindow() : NULL; } -int DesktopScreenWin::GetNumMonitors() { +int DesktopScreenWin::GetNumDisplays() { return GetSystemMetrics(SM_CMONITORS); } -gfx::Display DesktopScreenWin::GetMonitorNearestWindow( +gfx::Display DesktopScreenWin::GetDisplayNearestWindow( gfx::NativeView window) const { gfx::AcceleratedWidget accelerated_window = window->GetRootWindow()->GetAcceleratedWidget(); @@ -74,7 +74,7 @@ gfx::Display DesktopScreenWin::GetMonitorNearestWindow( return GetDisplay(monitor_info); } -gfx::Display DesktopScreenWin::GetMonitorNearestPoint( +gfx::Display DesktopScreenWin::GetDisplayNearestPoint( const gfx::Point& point) const { POINT initial_loc = { point.x(), point.y() }; HMONITOR monitor = MonitorFromPoint(initial_loc, MONITOR_DEFAULTTONEAREST); @@ -85,7 +85,7 @@ gfx::Display DesktopScreenWin::GetMonitorNearestPoint( return gfx::Display(); } -gfx::Display DesktopScreenWin::GetPrimaryMonitor() const { +gfx::Display DesktopScreenWin::GetPrimaryDisplay() const { MONITORINFO mi = GetMonitorInfoForMonitor( MonitorFromWindow(NULL, MONITOR_DEFAULTTOPRIMARY)); gfx::Display display = GetDisplay(mi); diff --git a/ui/aura/desktop/desktop_screen_win.h b/ui/aura/desktop/desktop_screen_win.h index 02c2af1..97eddb0 100644 --- a/ui/aura/desktop/desktop_screen_win.h +++ b/ui/aura/desktop/desktop_screen_win.h @@ -19,12 +19,12 @@ public: // Overridden from gfx::ScreenImpl: virtual gfx::Point GetCursorScreenPoint() OVERRIDE; virtual gfx::NativeWindow GetWindowAtCursorScreenPoint() OVERRIDE; - virtual int GetNumMonitors() OVERRIDE; - virtual gfx::Display GetMonitorNearestWindow( + virtual int GetNumDisplays() OVERRIDE; + virtual gfx::Display GetDisplayNearestWindow( gfx::NativeView window) const OVERRIDE; - virtual gfx::Display GetMonitorNearestPoint( + virtual gfx::Display GetDisplayNearestPoint( const gfx::Point& point) const OVERRIDE; - virtual gfx::Display GetPrimaryMonitor() const OVERRIDE; + virtual gfx::Display GetPrimaryDisplay() const OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(DesktopScreenWin); diff --git a/ui/aura/desktop/desktop_screen_x11.cc b/ui/aura/desktop/desktop_screen_x11.cc index 97faee8..e8f2e66 100644 --- a/ui/aura/desktop/desktop_screen_x11.cc +++ b/ui/aura/desktop/desktop_screen_x11.cc @@ -21,7 +21,7 @@ namespace { // TODO(erg): This method is a temporary hack, until we can reliably extract // location data out of XRandR. -gfx::Size GetPrimaryMonitorSize() { +gfx::Size GetPrimaryDisplaySize() { ::Display* display = ui::GetXDisplay(); ::Screen* screen = DefaultScreenOfDisplay(display); int width = WidthOfScreen(screen); @@ -38,12 +38,12 @@ class DesktopScreenX11 : public gfx::ScreenImpl { // Overridden from gfx::ScreenImpl: virtual gfx::Point GetCursorScreenPoint() OVERRIDE; virtual gfx::NativeWindow GetWindowAtCursorScreenPoint() OVERRIDE; - virtual int GetNumMonitors() OVERRIDE; - virtual gfx::Display GetMonitorNearestWindow( + virtual int GetNumDisplays() OVERRIDE; + virtual gfx::Display GetDisplayNearestWindow( gfx::NativeView window) const OVERRIDE; - virtual gfx::Display GetMonitorNearestPoint( + virtual gfx::Display GetDisplayNearestPoint( const gfx::Point& point) const OVERRIDE; - virtual gfx::Display GetPrimaryMonitor() const OVERRIDE; + virtual gfx::Display GetPrimaryDisplay() const OVERRIDE; private: DISALLOW_COPY_AND_ASSIGN(DesktopScreenX11); @@ -86,27 +86,27 @@ gfx::NativeWindow DesktopScreenX11::GetWindowAtCursorScreenPoint() { return NULL; } -int DesktopScreenX11::GetNumMonitors() { +int DesktopScreenX11::GetNumDisplays() { // TODO(erg): Figure this out with oshima or piman because I have no clue // about the XRandR implications here. return 1; } -gfx::Display DesktopScreenX11::GetMonitorNearestWindow( +gfx::Display DesktopScreenX11::GetDisplayNearestWindow( gfx::NativeView window) const { // TODO(erg): Do the right thing once we know what that is. - return gfx::Display(0, gfx::Rect(GetPrimaryMonitorSize())); + return gfx::Display(0, gfx::Rect(GetPrimaryDisplaySize())); } -gfx::Display DesktopScreenX11::GetMonitorNearestPoint( +gfx::Display DesktopScreenX11::GetDisplayNearestPoint( const gfx::Point& point) const { // TODO(erg): Do the right thing once we know what that is. - return gfx::Display(0, gfx::Rect(GetPrimaryMonitorSize())); + return gfx::Display(0, gfx::Rect(GetPrimaryDisplaySize())); } -gfx::Display DesktopScreenX11::GetPrimaryMonitor() const { +gfx::Display DesktopScreenX11::GetPrimaryDisplay() const { // TODO(erg): Do the right thing once we know what that is. - return gfx::Display(0, gfx::Rect(GetPrimaryMonitorSize())); + return gfx::Display(0, gfx::Rect(GetPrimaryDisplaySize())); } } // namespace diff --git a/ui/aura/monitor_manager.cc b/ui/aura/monitor_manager.cc index 9d12e80..aba7bcc 100644 --- a/ui/aura/monitor_manager.cc +++ b/ui/aura/monitor_manager.cc @@ -51,7 +51,7 @@ gfx::Display MonitorManager::CreateMonitorFromSpec(const std::string& spec) { RootWindow* MonitorManager::CreateRootWindowForPrimaryMonitor() { MonitorManager* manager = aura::Env::GetInstance()->monitor_manager(); RootWindow* root = - manager->CreateRootWindowForMonitor(manager->GetMonitorAt(0)); + manager->CreateRootWindowForMonitor(manager->GetDisplayAt(0)); if (use_fullscreen_host_window_) root->ConfineCursorToWindow(); return root; diff --git a/ui/aura/monitor_manager.h b/ui/aura/monitor_manager.h index 257d3aa..40e6bbf 100644 --- a/ui/aura/monitor_manager.h +++ b/ui/aura/monitor_manager.h @@ -68,16 +68,16 @@ class AURA_EXPORT MonitorManager { const gfx::Display& display) = 0; // Returns the display at |index|. The display at 0 is considered "primary". - virtual const gfx::Display& GetMonitorAt(size_t index) = 0; + virtual const gfx::Display& GetDisplayAt(size_t index) = 0; - virtual size_t GetNumMonitors() const = 0; + virtual size_t GetNumDisplays() const = 0; // Returns the display object nearest given |window|. - virtual const gfx::Display& GetMonitorNearestWindow( + virtual const gfx::Display& GetDisplayNearestWindow( const Window* window) const = 0; // Returns the monitor object nearest given |pint|. - virtual const gfx::Display& GetMonitorNearestPoint( + virtual const gfx::Display& GetDisplayNearestPoint( const gfx::Point& point) const = 0; protected: diff --git a/ui/aura/root_window.cc b/ui/aura/root_window.cc index d3c99d7..864f735 100644 --- a/ui/aura/root_window.cc +++ b/ui/aura/root_window.cc @@ -79,7 +79,7 @@ void GetEventFiltersToNotify(Window* target, EventFilters* filters) { float GetDeviceScaleFactorFromMonitor(const aura::Window* window) { MonitorManager* monitor_manager = Env::GetInstance()->monitor_manager(); - return monitor_manager->GetMonitorNearestWindow(window).device_scale_factor(); + return monitor_manager->GetDisplayNearestWindow(window).device_scale_factor(); } Window* ConsumerToWindow(ui::GestureConsumer* consumer) { diff --git a/ui/aura/root_window_host_linux.cc b/ui/aura/root_window_host_linux.cc index 419cbb81..fe64054 100644 --- a/ui/aura/root_window_host_linux.cc +++ b/ui/aura/root_window_host_linux.cc @@ -816,7 +816,7 @@ void RootWindowHostLinux::SetBounds(const gfx::Rect& bounds) { // size, which is in DIP, changes when the scale changes. float current_scale = root_window_->compositor()->device_scale_factor(); float new_scale = - gfx::Screen::GetMonitorNearestWindow(root_window_).device_scale_factor(); + gfx::Screen::GetDisplayNearestWindow(root_window_).device_scale_factor(); bool size_changed = bounds_.size() != bounds.size() || current_scale != new_scale; diff --git a/ui/aura/single_monitor_manager.cc b/ui/aura/single_monitor_manager.cc index 12c484f..e099341 100644 --- a/ui/aura/single_monitor_manager.cc +++ b/ui/aura/single_monitor_manager.cc @@ -54,20 +54,20 @@ RootWindow* SingleMonitorManager::CreateRootWindowForMonitor( return root_window_; } -const gfx::Display& SingleMonitorManager::GetMonitorAt(size_t index) { +const gfx::Display& SingleMonitorManager::GetDisplayAt(size_t index) { return display_; } -size_t SingleMonitorManager::GetNumMonitors() const { +size_t SingleMonitorManager::GetNumDisplays() const { return 1; } -const gfx::Display& SingleMonitorManager::GetMonitorNearestWindow( +const gfx::Display& SingleMonitorManager::GetDisplayNearestWindow( const Window* window) const { return display_; } -const gfx::Display& SingleMonitorManager::GetMonitorNearestPoint( +const gfx::Display& SingleMonitorManager::GetDisplayNearestPoint( const gfx::Point& point) const { return display_; } diff --git a/ui/aura/single_monitor_manager.h b/ui/aura/single_monitor_manager.h index fb92140..46ef34c 100644 --- a/ui/aura/single_monitor_manager.h +++ b/ui/aura/single_monitor_manager.h @@ -30,13 +30,13 @@ class AURA_EXPORT SingleMonitorManager : public MonitorManager, const std::vector<gfx::Display>& display) OVERRIDE; virtual RootWindow* CreateRootWindowForMonitor( const gfx::Display& display) OVERRIDE; - virtual const gfx::Display& GetMonitorAt(size_t index) OVERRIDE; + virtual const gfx::Display& GetDisplayAt(size_t index) OVERRIDE; - virtual size_t GetNumMonitors() const OVERRIDE; + virtual size_t GetNumDisplays() const OVERRIDE; - virtual const gfx::Display& GetMonitorNearestWindow( + virtual const gfx::Display& GetDisplayNearestWindow( const Window* window) const OVERRIDE; - virtual const gfx::Display& GetMonitorNearestPoint( + virtual const gfx::Display& GetDisplayNearestPoint( const gfx::Point& point) const OVERRIDE; // WindowObserver overrides: diff --git a/ui/aura/test/test_screen.cc b/ui/aura/test/test_screen.cc index 7968e52..95019a4 100644 --- a/ui/aura/test/test_screen.cc +++ b/ui/aura/test/test_screen.cc @@ -28,20 +28,20 @@ gfx::NativeWindow TestScreen::GetWindowAtCursorScreenPoint() { return root_window_->GetTopWindowContainingPoint(point); } -int TestScreen::GetNumMonitors() { +int TestScreen::GetNumDisplays() { return 1; } -gfx::Display TestScreen::GetMonitorNearestWindow( +gfx::Display TestScreen::GetDisplayNearestWindow( gfx::NativeWindow window) const { return GetMonitor(); } -gfx::Display TestScreen::GetMonitorNearestPoint(const gfx::Point& point) const { +gfx::Display TestScreen::GetDisplayNearestPoint(const gfx::Point& point) const { return GetMonitor(); } -gfx::Display TestScreen::GetPrimaryMonitor() const { +gfx::Display TestScreen::GetPrimaryDisplay() const { return GetMonitor(); } diff --git a/ui/aura/test/test_screen.h b/ui/aura/test/test_screen.h index 13b29b3..399b486 100644 --- a/ui/aura/test/test_screen.h +++ b/ui/aura/test/test_screen.h @@ -22,12 +22,12 @@ class TestScreen : public gfx::ScreenImpl { // gfx::ScreenImpl overrides: virtual gfx::Point GetCursorScreenPoint() OVERRIDE; virtual gfx::NativeWindow GetWindowAtCursorScreenPoint() OVERRIDE; - virtual int GetNumMonitors() OVERRIDE; - virtual gfx::Display GetMonitorNearestWindow( + virtual int GetNumDisplays() OVERRIDE; + virtual gfx::Display GetDisplayNearestWindow( gfx::NativeView view) const OVERRIDE; - virtual gfx::Display GetMonitorNearestPoint( + virtual gfx::Display GetDisplayNearestPoint( const gfx::Point& point) const OVERRIDE; - virtual gfx::Display GetPrimaryMonitor() const OVERRIDE; + virtual gfx::Display GetPrimaryDisplay() const OVERRIDE; private: gfx::Display GetMonitor() const; diff --git a/ui/aura/window_unittest.cc b/ui/aura/window_unittest.cc index f0da477..51a41f3 100644 --- a/ui/aura/window_unittest.cc +++ b/ui/aura/window_unittest.cc @@ -1165,7 +1165,7 @@ TEST_F(WindowTest, IgnoreEventsTest) { TEST_F(WindowTest, Transform) { gfx::Size size = root_window()->GetHostSize(); EXPECT_EQ(gfx::Rect(size), - gfx::Screen::GetMonitorNearestPoint(gfx::Point()).bounds()); + gfx::Screen::GetDisplayNearestPoint(gfx::Point()).bounds()); // Rotate it clock-wise 90 degrees. ui::Transform transform; @@ -1179,7 +1179,7 @@ TEST_F(WindowTest, Transform) { root_window()->bounds().size().ToString()); EXPECT_EQ( gfx::Rect(transformed_size).ToString(), - gfx::Screen::GetMonitorNearestPoint(gfx::Point()).bounds().ToString()); + gfx::Screen::GetDisplayNearestPoint(gfx::Point()).bounds().ToString()); // Host size shouldn't change. EXPECT_EQ(size.ToString(), diff --git a/ui/base/x/events_x.cc b/ui/base/x/events_x.cc index 936947a..3ecba7e5 100644 --- a/ui/base/x/events_x.cc +++ b/ui/base/x/events_x.cc @@ -581,7 +581,7 @@ gfx::Point CalibrateTouchCoordinates( // testing with. I have the feeling that the DPI resolution of the bezel is // less then the dpi resolution over the visible part - which would explain // why the small value (50) is so wide compared to the entire area. - gfx::Rect bounds = gfx::Screen::GetPrimaryMonitor().bounds_in_pixel(); + gfx::Rect bounds = gfx::Screen::GetPrimaryDisplay().bounds_in_pixel(); const int kLeftBorder = 50; const int kRightBorder = 50; const int kBottomBorder = 50; diff --git a/ui/gfx/screen.h b/ui/gfx/screen.h index 12ecb6c..69a6726 100644 --- a/ui/gfx/screen.h +++ b/ui/gfx/screen.h @@ -6,6 +6,7 @@ #define UI_GFX_SCREEN_H_ #pragma once +#include "base/basictypes.h" #include "ui/base/ui_export.h" #include "ui/gfx/display.h" #include "ui/gfx/native_widget_types.h" @@ -15,12 +16,10 @@ namespace gfx { class Rect; class ScreenImpl; -// A utility class for getting various info about screen size, monitors, +// A utility class for getting various info about screen size, displays, // cursor position, etc. class UI_EXPORT Screen { public: - virtual ~Screen() {} - #if defined(USE_AURA) // Sets the instance to use. This takes owernship of |screen|, deleting the // old instance. This is used on aura to avoid circular dependencies between @@ -37,24 +36,27 @@ class UI_EXPORT Screen { // Returns the window under the cursor. static gfx::NativeWindow GetWindowAtCursorScreenPoint(); - // Returns the number of monitors. + // Returns the number of displays. // Mirrored displays are excluded; this method is intended to return the // number of distinct, usable displays. - static int GetNumMonitors(); + static int GetNumDisplays(); // Returns the display nearest the specified window. - static gfx::Display GetMonitorNearestWindow(gfx::NativeView view); + static gfx::Display GetDisplayNearestWindow(gfx::NativeView view); // Returns the the display nearest the specified point. - static gfx::Display GetMonitorNearestPoint(const gfx::Point& point); + static gfx::Display GetDisplayNearestPoint(const gfx::Point& point); - // Returns the bounds of the work area of the primary monitor. - static gfx::Display GetPrimaryMonitor(); + // Returns the bounds of the work area of the primary display. + static gfx::Display GetPrimaryDisplay(); // Returns the display that most closely intersects the provided bounds. - static gfx::Display GetMonitorMatching(const gfx::Rect& match_rect); + static gfx::Display GetDisplayMatching(const gfx::Rect& match_rect); + + private: + DISALLOW_IMPLICIT_CONSTRUCTORS(Screen); }; } // namespace gfx -#endif // VIEWS_SCREEN_H_ +#endif // UI_GFX_SCREEN_H_ diff --git a/ui/gfx/screen_android.cc b/ui/gfx/screen_android.cc index 576afab..a2e5a5d 100644 --- a/ui/gfx/screen_android.cc +++ b/ui/gfx/screen_android.cc @@ -15,23 +15,22 @@ bool Screen::IsDIPEnabled() { } // static -gfx::Display Screen::GetPrimaryMonitor() { +gfx::Display Screen::GetPrimaryDisplay() { NOTIMPLEMENTED() << "crbug.com/117839 tracks implementation"; return gfx::Display(0, gfx::Rect(0, 0, 1, 1)); } // static -gfx::Display Screen::GetMonitorNearestWindow(gfx::NativeView view) { - return GetPrimaryMonitor(); +gfx::Display Screen::GetDisplayNearestWindow(gfx::NativeView view) { + return GetPrimaryDisplay(); } // static -gfx::Display Screen::GetMonitorNearestPoint(const gfx::Point& point) { - return GetPrimaryMonitor(); +gfx::Display Screen::GetDisplayNearestPoint(const gfx::Point& point) { + return GetPrimaryDisplay(); } -// static -int Screen::GetNumMonitors() { +int Screen::GetNumDisplays() { return 1; } diff --git a/ui/gfx/screen_aura.cc b/ui/gfx/screen_aura.cc index 3298ba1..851b976 100644 --- a/ui/gfx/screen_aura.cc +++ b/ui/gfx/screen_aura.cc @@ -42,28 +42,28 @@ NativeWindow Screen::GetWindowAtCursorScreenPoint() { } // static -int Screen::GetNumMonitors() { - return g_instance_->GetNumMonitors(); +int Screen::GetNumDisplays() { + return g_instance_->GetNumDisplays(); } // static -Display Screen::GetMonitorNearestWindow(NativeView window) { - return g_instance_->GetMonitorNearestWindow(window); +Display Screen::GetDisplayNearestWindow(NativeView window) { + return g_instance_->GetDisplayNearestWindow(window); } // static -Display Screen::GetMonitorNearestPoint(const Point& point) { - return g_instance_->GetMonitorNearestPoint(point); +Display Screen::GetDisplayNearestPoint(const Point& point) { + return g_instance_->GetDisplayNearestPoint(point); } // static -Display Screen::GetPrimaryMonitor() { - return g_instance_->GetPrimaryMonitor(); +Display Screen::GetPrimaryDisplay() { + return g_instance_->GetPrimaryDisplay(); } // static -Display Screen::GetMonitorMatching(const gfx::Rect& match_rect) { - return g_instance_->GetMonitorNearestPoint(match_rect.CenterPoint()); +Display Screen::GetDisplayMatching(const gfx::Rect& match_rect) { + return g_instance_->GetDisplayNearestPoint(match_rect.CenterPoint()); } } // namespace gfx diff --git a/ui/gfx/screen_gtk.cc b/ui/gfx/screen_gtk.cc index 1bc577f..3cae772 100644 --- a/ui/gfx/screen_gtk.cc +++ b/ui/gfx/screen_gtk.cc @@ -103,7 +103,7 @@ gfx::NativeWindow Screen::GetWindowAtCursorScreenPoint() { } // static -gfx::Display Screen::GetMonitorNearestWindow(gfx::NativeView view) { +gfx::Display Screen::GetDisplayNearestWindow(gfx::NativeView view) { gfx::Rect bounds = GetMonitorAreaNearestWindow(view); // Do not use the _NET_WORKAREA here, this is supposed to be an area on a // specific monitor, and _NET_WORKAREA is a hint from the WM that generally @@ -119,7 +119,7 @@ gfx::Display Screen::GetMonitorNearestWindow(gfx::NativeView view) { } // static -gfx::Display Screen::GetMonitorNearestPoint(const gfx::Point& point) { +gfx::Display Screen::GetDisplayNearestPoint(const gfx::Point& point) { GdkScreen* screen = gdk_screen_get_default(); gint monitor = gdk_screen_get_monitor_at_point(screen, point.x(), point.y()); GdkRectangle bounds; @@ -129,7 +129,7 @@ gfx::Display Screen::GetMonitorNearestPoint(const gfx::Point& point) { } // static -gfx::Display Screen::GetPrimaryMonitor() { +gfx::Display Screen::GetPrimaryDisplay() { gfx::Rect bounds = NativePrimaryMonitorBounds(); // TODO(oshima): Implement ID and Observer. gfx::Display display(0, bounds); @@ -144,13 +144,13 @@ gfx::Display Screen::GetPrimaryMonitor() { } // static -gfx::Display Screen::GetMonitorMatching(const gfx::Rect& match_rect) { +gfx::Display Screen::GetDisplayMatching(const gfx::Rect& match_rect) { // TODO(thestig) Implement multi-monitor support. - return GetPrimaryMonitor(); + return GetPrimaryDisplay(); } // static -int Screen::GetNumMonitors() { +int Screen::GetNumDisplays() { // This query is kinda bogus for Linux -- do we want number of X screens? // The number of monitors Xinerama has? We'll just use whatever GDK uses. GdkScreen* screen = gdk_screen_get_default(); diff --git a/ui/gfx/screen_impl.h b/ui/gfx/screen_impl.h index 26bd02d..39e8f25 100644 --- a/ui/gfx/screen_impl.h +++ b/ui/gfx/screen_impl.h @@ -20,12 +20,12 @@ class UI_EXPORT ScreenImpl { virtual gfx::Point GetCursorScreenPoint() = 0; virtual gfx::NativeWindow GetWindowAtCursorScreenPoint() = 0; - virtual int GetNumMonitors() = 0; - virtual gfx::Display GetMonitorNearestWindow( + virtual int GetNumDisplays() = 0; + virtual gfx::Display GetDisplayNearestWindow( gfx::NativeView window) const = 0; - virtual gfx::Display GetMonitorNearestPoint( + virtual gfx::Display GetDisplayNearestPoint( const gfx::Point& point) const = 0; - virtual gfx::Display GetPrimaryMonitor() const = 0; + virtual gfx::Display GetPrimaryDisplay() const = 0; }; } // namespace gfx diff --git a/ui/gfx/screen_mac.mm b/ui/gfx/screen_mac.mm index 7960447..156e08e 100644 --- a/ui/gfx/screen_mac.mm +++ b/ui/gfx/screen_mac.mm @@ -89,16 +89,16 @@ gfx::Point Screen::GetCursorScreenPoint() { } // static -gfx::Display Screen::GetMonitorNearestWindow(gfx::NativeView view) { +gfx::Display Screen::GetDisplayNearestWindow(gfx::NativeView view) { NSWindow* window = [view window]; if (!window) - return GetPrimaryMonitor(); + return GetPrimaryDisplay(); NSScreen* match_screen = [window screen]; return GetDisplayForScreen(match_screen, false /* may not be primary */); } // static -gfx::Display Screen::GetPrimaryMonitor() { +gfx::Display Screen::GetPrimaryDisplay() { // Primary display is defined as the display with the menubar, // which is always at index 0. NSScreen* primary = [[NSScreen screens] objectAtIndex:0]; @@ -107,13 +107,13 @@ gfx::Display Screen::GetPrimaryMonitor() { } // static -gfx::Display Screen::GetMonitorMatching(const gfx::Rect& match_rect) { +gfx::Display Screen::GetDisplayMatching(const gfx::Rect& match_rect) { NSScreen* match_screen = GetMatchingScreen(match_rect); return GetDisplayForScreen(match_screen, false /* may not be primary */); } // static -int Screen::GetNumMonitors() { +int Screen::GetNumDisplays() { // Don't just return the number of online displays. It includes displays // that mirror other displays, which are not desired in the count. It's // tempting to use the count returned by CGGetActiveDisplayList, but active @@ -148,7 +148,7 @@ int Screen::GetNumMonitors() { } // static -gfx::Display Screen::GetMonitorNearestPoint(const gfx::Point& point) { +gfx::Display Screen::GetDisplayNearestPoint(const gfx::Point& point) { NSPoint ns_point = NSPointFromCGPoint(point.ToCGPoint()); NSArray* screens = [NSScreen screens]; diff --git a/ui/gfx/screen_unittest.cc b/ui/gfx/screen_unittest.cc index 5406697..fe4c6ea 100644 --- a/ui/gfx/screen_unittest.cc +++ b/ui/gfx/screen_unittest.cc @@ -10,16 +10,16 @@ namespace { typedef testing::Test ScreenTest; -TEST_F(ScreenTest, GetPrimaryMonitorSize) { +TEST_F(ScreenTest, GetPrimaryDisplaySize) { // We aren't actually testing that it's correct, just that it's sane. - const gfx::Size size = gfx::Screen::GetPrimaryMonitor().size(); + const gfx::Size size = gfx::Screen::GetPrimaryDisplay().size(); EXPECT_GE(size.width(), 1); EXPECT_GE(size.height(), 1); } -TEST_F(ScreenTest, GetNumMonitors) { +TEST_F(ScreenTest, GetNumDisplays) { // We aren't actually testing that it's correct, just that it's sane. - EXPECT_GE(gfx::Screen::GetNumMonitors(), 1); + EXPECT_GE(gfx::Screen::GetNumDisplays(), 1); } } // namespace diff --git a/ui/gfx/screen_win.cc b/ui/gfx/screen_win.cc index ee24bdd..5f1d7de 100644 --- a/ui/gfx/screen_win.cc +++ b/ui/gfx/screen_win.cc @@ -48,12 +48,12 @@ gfx::NativeWindow Screen::GetWindowAtCursorScreenPoint() { } // static -int Screen::GetNumMonitors() { +int Screen::GetNumDisplays() { return GetSystemMetrics(SM_CMONITORS); } // static -gfx::Display Screen::GetMonitorNearestWindow(gfx::NativeView window) { +gfx::Display Screen::GetDisplayNearestWindow(gfx::NativeView window) { MONITORINFO monitor_info; monitor_info.cbSize = sizeof(monitor_info); GetMonitorInfo(MonitorFromWindow(window, MONITOR_DEFAULTTONEAREST), @@ -62,7 +62,7 @@ gfx::Display Screen::GetMonitorNearestWindow(gfx::NativeView window) { } // static -gfx::Display Screen::GetMonitorNearestPoint(const gfx::Point& point) { +gfx::Display Screen::GetDisplayNearestPoint(const gfx::Point& point) { POINT initial_loc = { point.x(), point.y() }; HMONITOR monitor = MonitorFromPoint(initial_loc, MONITOR_DEFAULTTONEAREST); MONITORINFO mi = {0}; @@ -73,7 +73,7 @@ gfx::Display Screen::GetMonitorNearestPoint(const gfx::Point& point) { } // static -gfx::Display Screen::GetPrimaryMonitor() { +gfx::Display Screen::GetPrimaryDisplay() { MONITORINFO mi = GetMonitorInfoForMonitor( MonitorFromWindow(NULL, MONITOR_DEFAULTTOPRIMARY)); gfx::Display display = GetDisplay(mi); @@ -83,7 +83,7 @@ gfx::Display Screen::GetPrimaryMonitor() { } // static -gfx::Display Screen::GetMonitorMatching(const gfx::Rect& match_rect) { +gfx::Display Screen::GetDisplayMatching(const gfx::Rect& match_rect) { RECT other_bounds_rect = match_rect.ToRECT(); MONITORINFO monitor_info = GetMonitorInfoForMonitor(MonitorFromRect( &other_bounds_rect, MONITOR_DEFAULTTONEAREST)); diff --git a/ui/views/bubble/bubble_frame_view.cc b/ui/views/bubble/bubble_frame_view.cc index 660f9f1..f133174 100644 --- a/ui/views/bubble/bubble_frame_view.cc +++ b/ui/views/bubble/bubble_frame_view.cc @@ -101,7 +101,7 @@ void BubbleFrameView::SetBubbleBorder(BubbleBorder* border) { } gfx::Rect BubbleFrameView::GetMonitorBounds(const gfx::Rect& rect) { - return gfx::Screen::GetMonitorNearestPoint(rect.CenterPoint()).work_area(); + return gfx::Screen::GetDisplayNearestPoint(rect.CenterPoint()).work_area(); } void BubbleFrameView::MirrorArrowIfOffScreen( diff --git a/ui/views/controls/menu/menu_controller.cc b/ui/views/controls/menu/menu_controller.cc index 4511bef..941ed81 100644 --- a/ui/views/controls/menu/menu_controller.cc +++ b/ui/views/controls/menu/menu_controller.cc @@ -1100,14 +1100,14 @@ void MenuController::UpdateInitialLocation( // Calculate the bounds of the monitor we'll show menus on. Do this once to // avoid repeated system queries for the info. - pending_state_.monitor_bounds = gfx::Screen::GetMonitorNearestPoint( + pending_state_.monitor_bounds = gfx::Screen::GetDisplayNearestPoint( bounds.origin()).work_area(); #if defined(USE_ASH) if (!pending_state_.monitor_bounds.Contains(bounds)) { // Use the monitor area if the work area doesn't contain the bounds. This // handles showing a menu from the launcher. gfx::Rect monitor_area = - gfx::Screen::GetMonitorNearestPoint(bounds.origin()).bounds(); + gfx::Screen::GetDisplayNearestPoint(bounds.origin()).bounds(); if (monitor_area.Contains(bounds)) pending_state_.monitor_bounds = monitor_area; } diff --git a/ui/views/touchui/touch_selection_controller_impl.cc b/ui/views/touchui/touch_selection_controller_impl.cc index 93fb4bc..185fff2 100644 --- a/ui/views/touchui/touch_selection_controller_impl.cc +++ b/ui/views/touchui/touch_selection_controller_impl.cc @@ -311,7 +311,7 @@ class TouchSelectionControllerImpl::TouchContextMenuView total_width, height); gfx::Rect monitor_bounds = - gfx::Screen::GetMonitorNearestPoint(position).bounds(); + gfx::Screen::GetDisplayNearestPoint(position).bounds(); widget_->SetBounds(widget_bounds.AdjustToFit(monitor_bounds)); Layout(); } diff --git a/ui/views/widget/native_widget_aura.cc b/ui/views/widget/native_widget_aura.cc index 70e63a2..b169f74 100644 --- a/ui/views/widget/native_widget_aura.cc +++ b/ui/views/widget/native_widget_aura.cc @@ -356,7 +356,7 @@ void NativeWidgetAura::CenterWindow(const gfx::Size& size) { // the parent. We assume the root window represents the visible // rect of a single screen. gfx::Rect work_area = - gfx::Screen::GetMonitorNearestWindow(window_).work_area(); + gfx::Screen::GetDisplayNearestWindow(window_).work_area(); parent_bounds = parent_bounds.Intersect(work_area); // If |window_|'s transient parent's bounds are big enough to fit it, then we @@ -642,7 +642,7 @@ void NativeWidgetAura::FocusNativeView(gfx::NativeView native_view) { } gfx::Rect NativeWidgetAura::GetWorkAreaBoundsInScreen() const { - return gfx::Screen::GetMonitorNearestWindow(GetNativeView()).work_area(); + return gfx::Screen::GetDisplayNearestWindow(GetNativeView()).work_area(); } void NativeWidgetAura::SetInactiveRenderingDisabled(bool value) { diff --git a/ui/views/widget/native_widget_win.cc b/ui/views/widget/native_widget_win.cc index b6a5d1a..402d53f 100644 --- a/ui/views/widget/native_widget_win.cc +++ b/ui/views/widget/native_widget_win.cc @@ -1187,7 +1187,7 @@ void NativeWidgetWin::FocusNativeView(gfx::NativeView native_view) { } gfx::Rect NativeWidgetWin::GetWorkAreaBoundsInScreen() const { - return gfx::Screen::GetMonitorNearestWindow(GetNativeView()).work_area(); + return gfx::Screen::GetDisplayNearestWindow(GetNativeView()).work_area(); } void NativeWidgetWin::SetInactiveRenderingDisabled(bool value) { diff --git a/ui/views/widget/tooltip_manager_aura.cc b/ui/views/widget/tooltip_manager_aura.cc index 7a56608..296d33a 100644 --- a/ui/views/widget/tooltip_manager_aura.cc +++ b/ui/views/widget/tooltip_manager_aura.cc @@ -30,7 +30,7 @@ gfx::Font TooltipManager::GetDefaultFont() { // static int TooltipManager::GetMaxWidth(int x, int y) { gfx::Rect monitor_bounds = - gfx::Screen::GetMonitorNearestPoint(gfx::Point(x, y)).bounds(); + gfx::Screen::GetDisplayNearestPoint(gfx::Point(x, y)).bounds(); return (monitor_bounds.width() + 1) / 2; } diff --git a/ui/views/widget/tooltip_manager_win.cc b/ui/views/widget/tooltip_manager_win.cc index c804ed3..479dd11 100644 --- a/ui/views/widget/tooltip_manager_win.cc +++ b/ui/views/widget/tooltip_manager_win.cc @@ -61,7 +61,7 @@ gfx::Font TooltipManager::GetDefaultFont() { // static int TooltipManager::GetMaxWidth(int x, int y) { gfx::Rect monitor_bounds = - gfx::Screen::GetMonitorNearestPoint(gfx::Point(x, y)).bounds(); + gfx::Screen::GetDisplayNearestPoint(gfx::Point(x, y)).bounds(); // Allow the tooltip to be almost as wide as the screen. // Otherwise, we would truncate important text, since we're not word-wrapping // the text onto multiple lines. diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc index 18a05bb..0bc0906 100644 --- a/ui/views/widget/widget.cc +++ b/ui/views/widget/widget.cc @@ -443,7 +443,7 @@ void Widget::CenterWindow(const gfx::Size& size) { void Widget::SetBoundsConstrained(const gfx::Rect& bounds) { gfx::Rect work_area = - gfx::Screen::GetMonitorNearestPoint(bounds.origin()).work_area(); + gfx::Screen::GetDisplayNearestPoint(bounds.origin()).work_area(); if (work_area.IsEmpty()) { SetBounds(bounds); } else { |