diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-14 10:10:58 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-14 10:10:58 +0000 |
commit | 6bdf795e8f7dcfe80dd33b06bab229fd8a4d49f9 (patch) | |
tree | 842af6ec5fd894feb6b1d6cad3c38c4682966c57 /ui/gfx | |
parent | 647aeccd73b8598e1373987d34e7f16a6d5b39b7 (diff) | |
download | chromium_src-6bdf795e8f7dcfe80dd33b06bab229fd8a4d49f9.zip chromium_src-6bdf795e8f7dcfe80dd33b06bab229fd8a4d49f9.tar.gz chromium_src-6bdf795e8f7dcfe80dd33b06bab229fd8a4d49f9.tar.bz2 |
- Move DisplayManager and DisplayChangeObserverX11 from aura
to ash.DisplayManager/DisplayChangeObserverX11 are in aura for
historical reason, but they no longer have to be in aura.
* Remove SingleDisplayManager as it's no longer necessary.
* Rename MultipleDisplayManager and consolidate into DisplayManager.
* Remove DisplayManager from desktop environment. Screen
information is managed by platform in desktop environment, and
should be provided via gfx::Screen implementation.
- Move DisplayObserver to ui/gfx. This should be consolicated
with other similar features such as WorkAreaWatcherObserver/
DisplaySettingsProvider. It's tracked in crbug.com/122863.
- Misc cleanups
* Test should use test_support_ash instead of including
individual files.
* Use TestScreen where appropriate.
BUG=159710, 122863
TEST=none
Review URL: https://chromiumcodereview.appspot.com/11363124
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167639 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx')
-rw-r--r-- | ui/gfx/display_observer.cc | 12 | ||||
-rw-r--r-- | ui/gfx/display_observer.h | 33 | ||||
-rw-r--r-- | ui/gfx/screen.h | 5 | ||||
-rw-r--r-- | ui/gfx/screen_android.cc | 8 | ||||
-rw-r--r-- | ui/gfx/screen_gtk.cc | 8 | ||||
-rw-r--r-- | ui/gfx/screen_ios.mm | 8 | ||||
-rw-r--r-- | ui/gfx/screen_mac.mm | 8 | ||||
-rw-r--r-- | ui/gfx/screen_win.cc | 8 | ||||
-rw-r--r-- | ui/gfx/screen_win.h | 2 |
9 files changed, 92 insertions, 0 deletions
diff --git a/ui/gfx/display_observer.cc b/ui/gfx/display_observer.cc new file mode 100644 index 0000000..f8e3c07 --- /dev/null +++ b/ui/gfx/display_observer.cc @@ -0,0 +1,12 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ui/gfx/display_observer.h" + +namespace gfx { + +DisplayObserver::~DisplayObserver() { +} + +} // namespace gfx diff --git a/ui/gfx/display_observer.h b/ui/gfx/display_observer.h new file mode 100644 index 0000000..85a4086 --- /dev/null +++ b/ui/gfx/display_observer.h @@ -0,0 +1,33 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_GFX_DISPLAY_OBSERVER_H_ +#define UI_GFX_DISPLAY_OBSERVER_H_ + +#include "ui/base/ui_export.h" + +namespace gfx { +class Display; + +// Observers for display configuration changes. +// TODO(oshima): consolidate |WorkAreaWatcherObserver| and +// |DisplaySettingsProvier|. crbug.com/122863. +class UI_EXPORT DisplayObserver { + public: + // Called when the |display|'s bound has changed. + virtual void OnDisplayBoundsChanged(const Display& display) = 0; + + // Called when |new_display| has been added. + virtual void OnDisplayAdded(const Display& new_display) = 0; + + // Called when |old_display| has been removed. + virtual void OnDisplayRemoved(const Display& old_display) = 0; + + protected: + virtual ~DisplayObserver(); +}; + +} // namespace gfx + +#endif // UI_GFX_DISPLAY_OBSERVER_H_ diff --git a/ui/gfx/screen.h b/ui/gfx/screen.h index 1a04214..9410d02 100644 --- a/ui/gfx/screen.h +++ b/ui/gfx/screen.h @@ -13,6 +13,7 @@ #include "ui/gfx/screen_type_delegate.h" namespace gfx { +class DisplayObserver; class Rect; // A utility class for getting various info about screen size, displays, @@ -70,6 +71,10 @@ class UI_EXPORT Screen { // Returns the primary display. virtual gfx::Display GetPrimaryDisplay() const = 0; + // Adds/Removes display observers. + virtual void AddObserver(DisplayObserver* observer) = 0; + virtual void RemoveObserver(DisplayObserver* observer) = 0; + private: DISALLOW_COPY_AND_ASSIGN(Screen); }; diff --git a/ui/gfx/screen_android.cc b/ui/gfx/screen_android.cc index 2111661..a80582e 100644 --- a/ui/gfx/screen_android.cc +++ b/ui/gfx/screen_android.cc @@ -48,6 +48,14 @@ class ScreenAndroid : public Screen { return GetPrimaryDisplay(); } + virtual void AddObserver(DisplayObserver* observer) OVERRIDE { + // no display change on Android. + } + + virtual void RemoveObserver(DisplayObserver* observer) OVERRIDE { + // no display change on Android. + } + private: DISALLOW_COPY_AND_ASSIGN(ScreenAndroid); }; diff --git a/ui/gfx/screen_gtk.cc b/ui/gfx/screen_gtk.cc index 5aefb15..8ef803d 100644 --- a/ui/gfx/screen_gtk.cc +++ b/ui/gfx/screen_gtk.cc @@ -165,6 +165,14 @@ class ScreenGtk : public gfx::Screen { return display; } + virtual void AddObserver(gfx::DisplayObserver* observer) OVERRIDE { + // TODO(oshima): crbug.com/122863. + } + + virtual void RemoveObserver(gfx::DisplayObserver* observer) OVERRIDE { + // TODO(oshima): crbug.com/122863. + } + private: DISALLOW_COPY_AND_ASSIGN(ScreenGtk); }; diff --git a/ui/gfx/screen_ios.mm b/ui/gfx/screen_ios.mm index d1572af..dfb0d1b 100644 --- a/ui/gfx/screen_ios.mm +++ b/ui/gfx/screen_ios.mm @@ -63,6 +63,14 @@ class ScreenIos : public gfx::Screen { display.set_device_scale_factor([mainScreen scale]); return display; } + + virtual void AddObserver(gfx::DisplayObserver* observer) OVERRIDE { + // no display change on iOS. + } + + virtual void RemoveObserver(gfx::DisplayObserver* observer) OVERRIDE { + // no display change on iOS. + } }; } // namespace diff --git a/ui/gfx/screen_mac.mm b/ui/gfx/screen_mac.mm index 595ca3e..15bbf37 100644 --- a/ui/gfx/screen_mac.mm +++ b/ui/gfx/screen_mac.mm @@ -168,6 +168,14 @@ class ScreenMac : public gfx::Screen { return display; } + virtual void AddObserver(gfx::DisplayObserver* observer) OVERRIDE { + // TODO(oshima): crbug.com/122863. + } + + virtual void RemoveObserver(gfx::DisplayObserver* observer) OVERRIDE { + // TODO(oshima): crbug.com/122863. + } + private: DISALLOW_COPY_AND_ASSIGN(ScreenMac); }; diff --git a/ui/gfx/screen_win.cc b/ui/gfx/screen_win.cc index 072f47a..9b33c6b 100644 --- a/ui/gfx/screen_win.cc +++ b/ui/gfx/screen_win.cc @@ -90,6 +90,14 @@ gfx::Display ScreenWin::GetPrimaryDisplay() const { return display; } +void ScreenWin::AddObserver(DisplayObserver* observer) { + // TODO(oshima): crbug.com/122863. +} + +void ScreenWin::RemoveObserver(DisplayObserver* observer) { + // TODO(oshima): crbug.com/122863. +} + HWND ScreenWin::GetHWNDFromNativeView(NativeView window) const { #if defined(USE_AURA) NOTREACHED(); diff --git a/ui/gfx/screen_win.h b/ui/gfx/screen_win.h index 7cfc265..f6b7d40a 100644 --- a/ui/gfx/screen_win.h +++ b/ui/gfx/screen_win.h @@ -29,6 +29,8 @@ class UI_EXPORT ScreenWin : public gfx::Screen { virtual gfx::Display GetDisplayMatching( const gfx::Rect& match_rect) const OVERRIDE; virtual gfx::Display GetPrimaryDisplay() const OVERRIDE; + virtual void AddObserver(DisplayObserver* observer) OVERRIDE; + virtual void RemoveObserver(DisplayObserver* observer) OVERRIDE; // Returns the HWND associated with the NativeView. virtual HWND GetHWNDFromNativeView(NativeView window) const; |