Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2787)

Unified Diff: ash/display/display_controller.h

Issue 10870036: Allow storing display preferences per device. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ash/display/display_controller.cc » ('j') | ash/display/display_controller.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
+ DisplayLayout(Position position, int offset);
+ static void RegisterJSONConverter(
+ 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_;
« no previous file with comments | « no previous file | ash/display/display_controller.cc » ('j') | ash/display/display_controller.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698