diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-09 17:26:19 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-09 17:26:19 +0000 |
commit | f1ddc1da13daa47d4513ead413cd167faadd4c71 (patch) | |
tree | 15b5e919b8b43a92f38adbf6ba2bdd296327a3ef /ui/aura | |
parent | 7e2d6e1cdbc0f6c05c5db1262f9d2a8d2eec1edb (diff) | |
download | chromium_src-f1ddc1da13daa47d4513ead413cd167faadd4c71.zip chromium_src-f1ddc1da13daa47d4513ead413cd167faadd4c71.tar.gz chromium_src-f1ddc1da13daa47d4513ead413cd167faadd4c71.tar.bz2 |
Cleanup:
- added GetRootWindowForDisplay
- Hookup GetDisplayMatching to DisplayManager
- Fixed comments
- Moved the display code from Shell to MultiDisplayManager
BUG=none
TEST=none
Review URL: https://chromiumcodereview.appspot.com/10697071
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@145690 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/aura')
-rw-r--r-- | ui/aura/desktop/desktop_screen_win.cc | 5 | ||||
-rw-r--r-- | ui/aura/desktop/desktop_screen_win.h | 2 | ||||
-rw-r--r-- | ui/aura/desktop/desktop_screen_x11.cc | 8 | ||||
-rw-r--r-- | ui/aura/display_manager.h | 7 | ||||
-rw-r--r-- | ui/aura/single_display_manager.cc | 5 | ||||
-rw-r--r-- | ui/aura/single_display_manager.h | 2 | ||||
-rw-r--r-- | ui/aura/test/test_screen.cc | 4 | ||||
-rw-r--r-- | ui/aura/test/test_screen.h | 2 |
8 files changed, 34 insertions, 1 deletions
diff --git a/ui/aura/desktop/desktop_screen_win.cc b/ui/aura/desktop/desktop_screen_win.cc index 5738d9b..593f4f2 100644 --- a/ui/aura/desktop/desktop_screen_win.cc +++ b/ui/aura/desktop/desktop_screen_win.cc @@ -85,6 +85,11 @@ gfx::Display DesktopScreenWin::GetDisplayNearestPoint( return gfx::Display(); } +gfx::Display DesktopScreenWin::GetDisplayMatching( + const gfx::Rect& match_rect) const { + return GetDisplayNearestPoint(match_rect.CenterPoint()); +} + gfx::Display DesktopScreenWin::GetPrimaryDisplay() const { MONITORINFO mi = GetMonitorInfoForMonitor( MonitorFromWindow(NULL, MONITOR_DEFAULTTOPRIMARY)); diff --git a/ui/aura/desktop/desktop_screen_win.h b/ui/aura/desktop/desktop_screen_win.h index 97eddb0..51c4f81 100644 --- a/ui/aura/desktop/desktop_screen_win.h +++ b/ui/aura/desktop/desktop_screen_win.h @@ -24,6 +24,8 @@ public: gfx::NativeView window) const OVERRIDE; virtual gfx::Display GetDisplayNearestPoint( const gfx::Point& point) const OVERRIDE; + virtual gfx::Display GetDisplayMatching( + const gfx::Rect& match_rect) const OVERRIDE; virtual gfx::Display GetPrimaryDisplay() const OVERRIDE; private: diff --git a/ui/aura/desktop/desktop_screen_x11.cc b/ui/aura/desktop/desktop_screen_x11.cc index e8f2e66..9577037 100644 --- a/ui/aura/desktop/desktop_screen_x11.cc +++ b/ui/aura/desktop/desktop_screen_x11.cc @@ -43,6 +43,8 @@ class DesktopScreenX11 : public gfx::ScreenImpl { gfx::NativeView window) const OVERRIDE; virtual gfx::Display GetDisplayNearestPoint( const gfx::Point& point) const OVERRIDE; + virtual gfx::Display GetDisplayMatching( + const gfx::Rect& match_rect) const OVERRIDE; virtual gfx::Display GetPrimaryDisplay() const OVERRIDE; private: @@ -104,6 +106,12 @@ gfx::Display DesktopScreenX11::GetDisplayNearestPoint( return gfx::Display(0, gfx::Rect(GetPrimaryDisplaySize())); } +gfx::Display DesktopScreenX11::GetDisplayMatching( + const gfx::Rect& match_rect) const { + // TODO(erg): Do the right thing once we know what that is. + return gfx::Display(0, gfx::Rect(GetPrimaryDisplaySize())); +} + gfx::Display DesktopScreenX11::GetPrimaryDisplay() const { // TODO(erg): Do the right thing once we know what that is. return gfx::Display(0, gfx::Rect(GetPrimaryDisplaySize())); diff --git a/ui/aura/display_manager.h b/ui/aura/display_manager.h index 49f65c0..023d76b 100644 --- a/ui/aura/display_manager.h +++ b/ui/aura/display_manager.h @@ -16,6 +16,7 @@ namespace gfx { class Display; class Point; +class Rect; class Size; } @@ -76,10 +77,14 @@ class AURA_EXPORT DisplayManager { virtual const gfx::Display& GetDisplayNearestWindow( const Window* window) const = 0; - // Returns the display object nearest given |pint|. + // Returns the display object nearest given |point|. virtual const gfx::Display& GetDisplayNearestPoint( const gfx::Point& point) const = 0; + // Returns the display that most closely intersects |match_rect|. + virtual const gfx::Display& GetDisplayMatching( + const gfx::Rect& match_rect) const = 0; + protected: // Calls observers' OnDisplayBoundsChanged methods. void NotifyBoundsChanged(const gfx::Display& display); diff --git a/ui/aura/single_display_manager.cc b/ui/aura/single_display_manager.cc index 64b8d07..384c3c3 100644 --- a/ui/aura/single_display_manager.cc +++ b/ui/aura/single_display_manager.cc @@ -72,6 +72,11 @@ const gfx::Display& SingleDisplayManager::GetDisplayNearestPoint( return display_; } +const gfx::Display& SingleDisplayManager::GetDisplayMatching( + const gfx::Rect& match_rect) const { + return display_; +} + void SingleDisplayManager::OnWindowBoundsChanged( Window* window, const gfx::Rect& old_bounds, const gfx::Rect& new_bounds) { if (!use_fullscreen_host_window()) { diff --git a/ui/aura/single_display_manager.h b/ui/aura/single_display_manager.h index dca839a..82bfc35 100644 --- a/ui/aura/single_display_manager.h +++ b/ui/aura/single_display_manager.h @@ -38,6 +38,8 @@ class AURA_EXPORT SingleDisplayManager : public DisplayManager, const Window* window) const OVERRIDE; virtual const gfx::Display& GetDisplayNearestPoint( const gfx::Point& point) const OVERRIDE; + virtual const gfx::Display& GetDisplayMatching( + const gfx::Rect& match_rect) const OVERRIDE; // WindowObserver overrides: virtual void OnWindowBoundsChanged(Window* window, diff --git a/ui/aura/test/test_screen.cc b/ui/aura/test/test_screen.cc index 95019a4..5d0a497 100644 --- a/ui/aura/test/test_screen.cc +++ b/ui/aura/test/test_screen.cc @@ -41,6 +41,10 @@ gfx::Display TestScreen::GetDisplayNearestPoint(const gfx::Point& point) const { return GetMonitor(); } +gfx::Display TestScreen::GetDisplayMatching(const gfx::Rect& match_rect) const { + return GetMonitor(); +} + gfx::Display TestScreen::GetPrimaryDisplay() const { return GetMonitor(); } diff --git a/ui/aura/test/test_screen.h b/ui/aura/test/test_screen.h index 399b486..143a979 100644 --- a/ui/aura/test/test_screen.h +++ b/ui/aura/test/test_screen.h @@ -27,6 +27,8 @@ class TestScreen : public gfx::ScreenImpl { gfx::NativeView view) const OVERRIDE; virtual gfx::Display GetDisplayNearestPoint( const gfx::Point& point) const OVERRIDE; + virtual gfx::Display GetDisplayMatching( + const gfx::Rect& match_rect) const OVERRIDE; virtual gfx::Display GetPrimaryDisplay() const OVERRIDE; private: |