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

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: rebase 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..8bdbeaf42c0c5e163ee40120ff465345cf8e6e17 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 p, int o);
oshima 2012/08/27 23:00:46 p -> position, o ->offset
Jun Mukai 2012/08/28 08:12:42 Done.
+ static void RegisterJSONConverter(
+ base::JSONValueConverter<DisplayLayout>* converter);
+ bool GetValue(base::DictionaryValue* value);
oshima 2012/08/27 23:00:46 GetValue is a bit confusing. How about SetValueTo
Jun Mukai 2012/08/28 08:12:42 Changed to ConvertToValue(). What do you think?
+};
+
+// 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,16 +83,21 @@ 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_;
+ DisplayLayout::Position secondary_display_layout() const {
+ return default_display_layout_.position;
}
oshima 2012/08/27 23:00:46 since DisplayLayout is POD, it'd be better to simp
Jun Mukai 2012/08/28 08:12:42 Done.
- void SetSecondaryDisplayLayout(SecondaryDisplayLayout layout);
+ void SetSecondaryDisplayLayout(DisplayLayout::Position layout);
int secondary_display_offset() const {
- return secondary_display_offset_;
+ return default_display_layout_.offset;
}
void SetSecondaryDisplayOffset(int offset);
+ void SetDisplayLayoutForName(const std::string& name,
+ const base::Value& value);
+ void GetLayoutForDisplay(const gfx::Display& display,
+ int* layout, int* offset);
oshima 2012/08/27 23:00:46 document these methods
Jun Mukai 2012/08/28 08:12:42 Done.
+
void set_dont_warp_mouse(bool dont_warp_mouse) {
dont_warp_mouse_ = dont_warp_mouse;
}
@@ -110,11 +134,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