diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-12 07:55:38 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-12 07:55:38 +0000 |
commit | b8984249eaca42461fc3266cc2b1d0057c71c840 (patch) | |
tree | d194b4a6214f7f2849c61c5197e47dbb7293c31b /ash/display/display_manager.h | |
parent | 072865b7e912c0962ccbe999bba78f8631e3c730 (diff) | |
download | chromium_src-b8984249eaca42461fc3266cc2b1d0057c71c840.zip chromium_src-b8984249eaca42461fc3266cc2b1d0057c71c840.tar.gz chromium_src-b8984249eaca42461fc3266cc2b1d0057c71c840.tar.bz2 |
[Cleanup]
* Remove aura from DisplayManager
-Introduced DislayManager::Delegate to decouple DisplayController
- Moved methods that requires aura to DisplayController
- Changed to use DisplayInfo to get native bounds instead of
RootWindow.
* Moved mirror_window_controller_ from Shell to DisplayControlller.
This should belong to DC rather than Shell.
BUG=253991
Review URL: https://chromiumcodereview.appspot.com/19038002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211357 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/display/display_manager.h')
-rw-r--r-- | ash/display/display_manager.h | 67 |
1 files changed, 37 insertions, 30 deletions
diff --git a/ash/display/display_manager.h b/ash/display/display_manager.h index 2d99e04..fb4288e 100644 --- a/ash/display/display_manager.h +++ b/ash/display/display_manager.h @@ -13,8 +13,7 @@ #include "ash/display/display_layout.h" #include "base/compiler_specific.h" #include "base/gtest_prod_util.h" -#include "ui/aura/root_window_observer.h" -#include "ui/aura/window.h" +#include "base/memory/scoped_ptr.h" #include "ui/gfx/display.h" #if defined(OS_CHROMEOS) @@ -29,6 +28,8 @@ class Rect; namespace ash { class AcceleratorControllerTest; +class DisplayController; + namespace test { class DisplayManagerTestApi; class SystemGestureEventFilterTest; @@ -38,17 +39,29 @@ class DisplayLayoutStore; // DisplayManager maintains the current display configurations, // and notifies observers when configuration changes. -// This is exported for unittest. // // TODO(oshima): Make this non internal. -class ASH_EXPORT DisplayManager : +class ASH_EXPORT DisplayManager #if defined(OS_CHROMEOS) - public chromeos::OutputConfigurator::SoftwareMirroringController, + : public chromeos::OutputConfigurator::SoftwareMirroringController #endif - public aura::RootWindowObserver { + { public: - DisplayManager(); - virtual ~DisplayManager(); + class ASH_EXPORT Delegate { + public: + virtual ~Delegate() {} + + // Create or updates the mirror window with |display_info|. + virtual void CreateOrUpdateMirrorWindow( + const DisplayInfo& display_info) = 0; + + // Closes the mirror window if exists. + virtual void CloseMirrorWindow() = 0; + + // Called before and after the display configuration changes. + virtual void PreDisplayConfigurationChange() = 0; + virtual void PostDisplayConfigurationChange() = 0; + }; // Returns the list of possible UI scales for the display. static std::vector<float> GetScalesForDisplay(const DisplayInfo& info); @@ -62,10 +75,15 @@ class ASH_EXPORT DisplayManager : const gfx::Display& primary_display, gfx::Display* secondary_display); + DisplayManager(); + virtual ~DisplayManager(); + DisplayLayoutStore* layout_store() { return layout_store_.get(); } + void set_delegate(Delegate* delegate) { delegate_ = delegate; } + // When set to true, the MonitorManager calls OnDisplayBoundsChanged // even if the display's bounds didn't change. Used to swap primary // display. @@ -88,9 +106,6 @@ class ASH_EXPORT DisplayManager : bool IsInternalDisplayId(int64 id) const; - bool UpdateWorkAreaOfDisplayNearestWindow(const aura::Window* window, - const gfx::Insets& insets); - // Returns display for given |id|; const gfx::Display& GetDisplayForId(int64 id) const; @@ -158,18 +173,6 @@ class ASH_EXPORT DisplayManager : bool IsMirrored() const; const gfx::Display& mirrored_display() const { return mirrored_display_; } - // Returns the display object nearest given |window|. - const gfx::Display& GetDisplayNearestPoint( - const gfx::Point& point) const; - - // Returns the display object nearest given |point|. - const gfx::Display& GetDisplayNearestWindow( - const aura::Window* window) const; - - // Returns the display that most closely intersects |match_rect|. - const gfx::Display& GetDisplayMatching( - const gfx::Rect& match_rect)const; - // Retuns the display info associated with |display_id|. const DisplayInfo& GetDisplayInfo(int64 display_id) const; @@ -190,9 +193,6 @@ class ASH_EXPORT DisplayManager : void AddRemoveDisplay(); void ToggleDisplayScaleFactor(); - // RootWindowObserver overrides: - virtual void OnRootWindowHostResized(const aura::RootWindow* root) OVERRIDE; - // SoftwareMirroringController override: #if defined(OS_CHROMEOS) virtual void SetSoftwareMirroring(bool enabled) OVERRIDE; @@ -208,8 +208,12 @@ private: FRIEND_TEST_ALL_PREFIXES(DisplayManagerTest, AutomaticOverscanInsets); friend class ash::AcceleratorControllerTest; friend class test::DisplayManagerTestApi; - friend class DisplayManagerTest; friend class test::SystemGestureEventFilterTest; + friend class DisplayManagerTest; + // This is to allow DisplayController to modify the state of + // DisplayManager. TODO(oshima): consider provide separate + // interface to modify the state. + friend class ash::DisplayController; typedef std::vector<gfx::Display> DisplayList; @@ -217,9 +221,11 @@ private: change_display_upon_host_resize_ = value; } - gfx::Display& FindDisplayForRootWindow(const aura::RootWindow* root); gfx::Display& FindDisplayForId(int64 id); + // Updates the bounds of the display given by |display_id|. + bool UpdateDisplayBounds(int64 display_id, const gfx::Rect& new_bounds); + // Add the mirror display's display info if the software based // mirroring is in use. void AddMirrorDisplayInfoIfAny(std::vector<DisplayInfo>* display_info_list); @@ -242,6 +248,9 @@ private: bool UpdateSecondaryDisplayBoundsForLayout(DisplayList* display_list, size_t* updated_index) const; + + Delegate* delegate_; // not owned. + scoped_ptr<DisplayLayoutStore> layout_store_; int64 first_display_id_; @@ -270,8 +279,6 @@ private: DISALLOW_COPY_AND_ASSIGN(DisplayManager); }; -extern const aura::WindowProperty<int64>* const kDisplayIdKey; - } // namespace internal } // namespace ash |