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

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

Issue 10952028: Fix crashers in GetPrimaryDisplay (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
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
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 // but before the change is applied to aura/ash. 76 // but before the change is applied to aura/ash.
77 virtual void OnDisplayConfigurationChanging() = 0; 77 virtual void OnDisplayConfigurationChanging() = 0;
78 78
79 protected: 79 protected:
80 virtual ~Observer() {} 80 virtual ~Observer() {}
81 }; 81 };
82 82
83 DisplayController(); 83 DisplayController();
84 virtual ~DisplayController(); 84 virtual ~DisplayController();
85 85
86 // Gets primary display. This information is stored in global
87 // object as this can be accessed after Shell is closed.
88 static const gfx::Display& GetPrimaryDisplay();
Daniel Erat 2012/09/19 20:47:33 nit: returning a reference to an internal pointer
oshima 2012/09/19 21:21:28 This pattern isn't uncommon in chrome (quick searc
Daniel Erat 2012/09/19 21:31:47 Accessors that return const references are super-c
89
86 // Initializes primary display. 90 // Initializes primary display.
87 void InitPrimaryDisplay(); 91 void InitPrimaryDisplay();
88 92
89 // Initialize secondary displays. 93 // Initialize secondary displays.
90 void InitSecondaryDisplays(); 94 void InitSecondaryDisplays();
91 95
92 // Add/Remove observers. 96 // Add/Remove observers.
93 void AddObserver(Observer* observer); 97 void AddObserver(Observer* observer);
94 void RemoveObserver(Observer* observer); 98 void RemoveObserver(Observer* observer);
95 99
96 // Returns the root window for primary display. 100 // Returns the root window for primary display.
97 aura::RootWindow* GetPrimaryRootWindow(); 101 aura::RootWindow* GetPrimaryRootWindow();
98 102
99 // Returns the root window for |display_id|. 103 // Returns the root window for |display_id|.
100 aura::RootWindow* GetRootWindowForDisplayId(int64 id); 104 aura::RootWindow* GetRootWindowForDisplayId(int64 id);
101 105
102 // Sets/Gets primary display. 106 // Sets primary display. This re-assigns the current root
103 const gfx::Display& primary_display() const { 107 // window to given |display|.
104 return primary_display_;
105 }
106 void SetPrimaryDisplay(const gfx::Display& display); 108 void SetPrimaryDisplay(const gfx::Display& display);
107 109
108 // Returns the secondary display. 110 // Returns the secondary display.
109 gfx::Display* GetSecondaryDisplay(); 111 gfx::Display* GetSecondaryDisplay();
110 112
111 // Closes all child windows in the all root windows. 113 // Closes all child windows in the all root windows.
112 void CloseChildWindows(); 114 void CloseChildWindows();
113 115
114 // Returns all root windows. In non extended desktop mode, this 116 // Returns all root windows. In non extended desktop mode, this
115 // returns the primary root window only. 117 // returns the primary root window only.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 std::map<int64, aura::RootWindow*> root_windows_; 155 std::map<int64, aura::RootWindow*> root_windows_;
154 156
155 // The default display layout. 157 // The default display layout.
156 DisplayLayout default_display_layout_; 158 DisplayLayout default_display_layout_;
157 159
158 // Per-device display layout. 160 // Per-device display layout.
159 std::map<std::string, DisplayLayout> secondary_layouts_; 161 std::map<std::string, DisplayLayout> secondary_layouts_;
160 162
161 ObserverList<Observer> observers_; 163 ObserverList<Observer> observers_;
162 164
163 gfx::Display primary_display_;
164
165 DISALLOW_COPY_AND_ASSIGN(DisplayController); 165 DISALLOW_COPY_AND_ASSIGN(DisplayController);
166 }; 166 };
167 167
168 } // namespace ash 168 } // namespace ash
169 169
170 #endif // ASH_DISPLAY_DISPLAY_CONTROLLER_H_ 170 #endif // ASH_DISPLAY_DISPLAY_CONTROLLER_H_
OLDNEW
« no previous file with comments | « no previous file | ash/display/display_controller.cc » ('j') | chrome/browser/lifetime/application_lifetime_aura.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698