| Index: ash/display/display_controller.h
|
| diff --git a/ash/display/display_controller.h b/ash/display/display_controller.h
|
| index 41aaeb19b5eaf7745cbcf44568141d10bda2372c..a830a17d820ab7c68182dcf7d6274b06ef20f5df 100644
|
| --- a/ash/display/display_controller.h
|
| +++ b/ash/display/display_controller.h
|
| @@ -20,22 +20,48 @@ class Display;
|
| class RootWindow;
|
| }
|
|
|
| +namespace base {
|
| +class Value;
|
| +template <typename T> class JSONValueConverter;
|
| +}
|
| +
|
| namespace ash {
|
| namespace internal {
|
| class RootWindowController;
|
| +}
|
|
|
| -// DisplayController owns and maintains RootWindows for each attached
|
| -// display, keeping them in sync with display configuration changes.
|
| -class ASH_EXPORT DisplayController : public aura::DisplayObserver {
|
| - public:
|
| +struct ASH_EXPORT DisplayLayout {
|
| // Layout options where the secondary display should be positioned.
|
| - enum SecondaryDisplayLayout {
|
| + enum Position {
|
| TOP,
|
| RIGHT,
|
| BOTTOM,
|
| LEFT
|
| };
|
|
|
| + DisplayLayout();
|
| + DisplayLayout(Position position, int offset);
|
| +
|
| + // Converter functions to/from base::Value.
|
| + static bool ConvertFromValue(const base::Value& value, DisplayLayout* layout);
|
| + static bool ConvertToValue(const DisplayLayout& layout, base::Value* value);
|
| +
|
| + // This method is used by base::JSONValueConverter, you don't need to call
|
| + // this directly. Instead consider using converter functions above.
|
| + static void RegisterJSONConverter(
|
| + base::JSONValueConverter<DisplayLayout>* converter);
|
| +
|
| + Position position;
|
| +
|
| + // The offset of the position of the secondary display. The offset is
|
| + // based on the top/left edge of the primary display.
|
| + int offset;
|
| +};
|
| +
|
| +// DisplayController owns and maintains RootWindows for each attached
|
| +// display, keeping them in sync with display configuration changes.
|
| +class ASH_EXPORT DisplayController : public aura::DisplayObserver {
|
| + public:
|
| DisplayController();
|
| virtual ~DisplayController();
|
|
|
| @@ -64,19 +90,23 @@ class ASH_EXPORT DisplayController : public aura::DisplayObserver {
|
| // mode, this return a RootWindowController for the primary root window only.
|
| std::vector<internal::RootWindowController*> GetAllRootWindowControllers();
|
|
|
| - SecondaryDisplayLayout secondary_display_layout() const {
|
| - return secondary_display_layout_;
|
| + const DisplayLayout& default_display_layout() const {
|
| + return default_display_layout_;
|
| }
|
| - void SetSecondaryDisplayLayout(SecondaryDisplayLayout layout);
|
| + void SetDefaultDisplayLayout(const DisplayLayout& layout);
|
|
|
| - int secondary_display_offset() const {
|
| - return secondary_display_offset_;
|
| - }
|
| - void SetSecondaryDisplayOffset(int offset);
|
| + // Sets/gets the display layout for the specified display name. Getter
|
| + // returns the default value in case it doesn't have its own layout yet.
|
| + void SetLayoutForDisplayName(const std::string& name,
|
| + const DisplayLayout& layout);
|
| + const DisplayLayout& GetLayoutForDisplayName(const std::string& name);
|
|
|
| void set_dont_warp_mouse(bool dont_warp_mouse) {
|
| dont_warp_mouse_ = dont_warp_mouse;
|
| }
|
| + bool dont_warp_mouse_for_testing() const {
|
| + return dont_warp_mouse_;
|
| + }
|
|
|
| // Warps the mouse cursor to an alternate root window when the
|
| // |point_in_root|, which is the location of the mouse cursor,
|
| @@ -96,8 +126,6 @@ class ASH_EXPORT DisplayController : public aura::DisplayObserver {
|
| static bool IsExtendedDesktopEnabled();
|
|
|
| private:
|
| - FRIEND_TEST_ALL_PREFIXES(WorkspaceWindowResizerTest, WarpMousePointer);
|
| -
|
| // Creates a root window for |display| and stores it in the |root_windows_|
|
| // map.
|
| // TODO(oshima): remove |is_primary| when non extended desktop mode is
|
| @@ -110,11 +138,11 @@ class ASH_EXPORT DisplayController : public aura::DisplayObserver {
|
| // The mapping from display ID to its root window.
|
| std::map<int64, aura::RootWindow*> root_windows_;
|
|
|
| - SecondaryDisplayLayout secondary_display_layout_;
|
| + // The default display layout.
|
| + DisplayLayout default_display_layout_;
|
|
|
| - // The offset of the position of the secondary display. The offset is
|
| - // based on the top/left edge of the primary display.
|
| - int secondary_display_offset_;
|
| + // Per-device display layout.
|
| + std::map<std::string, DisplayLayout> secondary_layouts_;
|
|
|
| // If true, the mouse pointer can't move from one display to another.
|
| bool dont_warp_mouse_;
|
| @@ -122,7 +150,6 @@ class ASH_EXPORT DisplayController : public aura::DisplayObserver {
|
| DISALLOW_COPY_AND_ASSIGN(DisplayController);
|
| };
|
|
|
| -} // namespace internal
|
| } // namespace ash
|
|
|
| #endif // ASH_DISPLAY_DISPLAY_CONTROLLER_H_
|
|
|