Chromium Code Reviews| Index: ash/display/display_controller.h |
| diff --git a/ash/display/display_controller.h b/ash/display/display_controller.h |
| index 41aaeb19b5eaf7745cbcf44568141d10bda2372c..9c41525e96860f5e0c3ce4b0c896906792afade7 100644 |
| --- a/ash/display/display_controller.h |
| +++ b/ash/display/display_controller.h |
| @@ -20,22 +20,41 @@ class Display; |
| class RootWindow; |
| } |
| +namespace base { |
| +class DictionaryValue; |
| +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 |
| }; |
| + 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; |
| + DisplayLayout(); |
|
sky
2012/08/29 15:05:57
structs follow the same layout as classes, so meth
Jun Mukai
2012/08/30 02:08:04
Done.
|
| + DisplayLayout(Position position, int offset); |
| + static void RegisterJSONConverter( |
|
sky
2012/08/29 15:05:57
Move this to a standalone function, and ConvertToV
Jun Mukai
2012/08/30 02:08:04
Sorry, this is needed to be a static method since
|
| + base::JSONValueConverter<DisplayLayout>* converter); |
| + bool ConvertToValue(base::DictionaryValue* value); |
| +}; |
| + |
| +// 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,15 +83,16 @@ 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; |
| @@ -110,11 +130,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_; |