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

Side by Side Diff: ash/display/display_controller.h

Issue 10909043: Cancel drag if display configuration changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/accelerators/accelerator_table.cc ('k') | ash/display/display_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef ASH_DISPLAY_DISPLAY_CONTROLLER_H_ 5 #ifndef ASH_DISPLAY_DISPLAY_CONTROLLER_H_
6 #define ASH_DISPLAY_DISPLAY_CONTROLLER_H_ 6 #define ASH_DISPLAY_DISPLAY_CONTROLLER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
11 #include "ash/ash_export.h" 11 #include "ash/ash_export.h"
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/gtest_prod_util.h"
15 #include "base/observer_list.h"
14 #include "ui/aura/display_observer.h" 16 #include "ui/aura/display_observer.h"
15 #include "ui/aura/display_manager.h" 17 #include "ui/aura/display_manager.h"
16 18
17 namespace aura { 19 namespace aura {
18 class Display; 20 class Display;
19 class RootWindow; 21 class RootWindow;
20 } 22 }
21 23
22 namespace base { 24 namespace base {
23 class Value; 25 class Value;
(...skipping 30 matching lines...) Expand all
54 56
55 // The offset of the position of the secondary display. The offset is 57 // The offset of the position of the secondary display. The offset is
56 // based on the top/left edge of the primary display. 58 // based on the top/left edge of the primary display.
57 int offset; 59 int offset;
58 }; 60 };
59 61
60 // DisplayController owns and maintains RootWindows for each attached 62 // DisplayController owns and maintains RootWindows for each attached
61 // display, keeping them in sync with display configuration changes. 63 // display, keeping them in sync with display configuration changes.
62 class ASH_EXPORT DisplayController : public aura::DisplayObserver { 64 class ASH_EXPORT DisplayController : public aura::DisplayObserver {
63 public: 65 public:
66 class ASH_EXPORT Observer {
67 public:
68 // Invoked when the display configuration change is requested,
69 // but before the change is applied to aura/ash.
70 virtual void OnDisplayConfigurationChanging() = 0;
71
72 protected:
73 virtual ~Observer() {}
74 };
75
64 DisplayController(); 76 DisplayController();
65 virtual ~DisplayController(); 77 virtual ~DisplayController();
66 78
67 // Initializes primary display. 79 // Initializes primary display.
68 void InitPrimaryDisplay(); 80 void InitPrimaryDisplay();
69 81
70 // Initialize secondary displays. 82 // Initialize secondary displays.
71 void InitSecondaryDisplays(); 83 void InitSecondaryDisplays();
72 84
85 // Add/Remove observers.
86 void AddObserver(Observer* observer);
87 void RemoveObserver(Observer* observer);
88
73 // Returns the root window for primary display. 89 // Returns the root window for primary display.
74 aura::RootWindow* GetPrimaryRootWindow(); 90 aura::RootWindow* GetPrimaryRootWindow();
75 91
76 // Returns the root window for |display_id|. 92 // Returns the root window for |display_id|.
77 aura::RootWindow* GetRootWindowForDisplayId(int64 id); 93 aura::RootWindow* GetRootWindowForDisplayId(int64 id);
78 94
79 // Closes all child windows in the all root windows. 95 // Closes all child windows in the all root windows.
80 void CloseChildWindows(); 96 void CloseChildWindows();
81 97
82 // Returns all root windows. In non extended desktop mode, this 98 // Returns all root windows. In non extended desktop mode, this
(...skipping 21 matching lines...) Expand all
104 virtual void OnDisplayAdded(const gfx::Display& display) OVERRIDE; 120 virtual void OnDisplayAdded(const gfx::Display& display) OVERRIDE;
105 virtual void OnDisplayRemoved(const gfx::Display& display) OVERRIDE; 121 virtual void OnDisplayRemoved(const gfx::Display& display) OVERRIDE;
106 122
107 private: 123 private:
108 // Creates a root window for |display| and stores it in the |root_windows_| 124 // Creates a root window for |display| and stores it in the |root_windows_|
109 // map. 125 // map.
110 aura::RootWindow* AddRootWindowForDisplay(const gfx::Display& display); 126 aura::RootWindow* AddRootWindowForDisplay(const gfx::Display& display);
111 127
112 void UpdateDisplayBoundsForLayout(); 128 void UpdateDisplayBoundsForLayout();
113 129
130 void NotifyDisplayConfigurationChanging();
131
114 // The mapping from display ID to its root window. 132 // The mapping from display ID to its root window.
115 std::map<int64, aura::RootWindow*> root_windows_; 133 std::map<int64, aura::RootWindow*> root_windows_;
116 134
117 // The default display layout. 135 // The default display layout.
118 DisplayLayout default_display_layout_; 136 DisplayLayout default_display_layout_;
119 137
120 // Per-device display layout. 138 // Per-device display layout.
121 std::map<std::string, DisplayLayout> secondary_layouts_; 139 std::map<std::string, DisplayLayout> secondary_layouts_;
122 140
141 ObserverList<Observer> observers_;
142
123 DISALLOW_COPY_AND_ASSIGN(DisplayController); 143 DISALLOW_COPY_AND_ASSIGN(DisplayController);
124 }; 144 };
125 145
126 } // namespace ash 146 } // namespace ash
127 147
128 #endif // ASH_DISPLAY_DISPLAY_CONTROLLER_H_ 148 #endif // ASH_DISPLAY_DISPLAY_CONTROLLER_H_
OLDNEW
« no previous file with comments | « ash/accelerators/accelerator_table.cc ('k') | ash/display/display_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698