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

Side by Side Diff: ash/display/multi_display_manager.cc

Issue 10696002: ASH: Use virtual screen coordinates in Display::bounds() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 years, 5 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/display/multi_display_manager.h ('k') | ash/display/multi_display_manager_unittest.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 #include "ash/display/multi_display_manager.h" 5 #include "ash/display/multi_display_manager.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 const gfx::Display& display) { 117 const gfx::Display& display) {
118 RootWindow* root_window = new RootWindow(display.bounds_in_pixel()); 118 RootWindow* root_window = new RootWindow(display.bounds_in_pixel());
119 // No need to remove RootWindowObserver because 119 // No need to remove RootWindowObserver because
120 // the DisplayManager object outlives RootWindow objects. 120 // the DisplayManager object outlives RootWindow objects.
121 root_window->AddRootWindowObserver(this); 121 root_window->AddRootWindowObserver(this);
122 root_window->SetProperty(kDisplayIdKey, display.id()); 122 root_window->SetProperty(kDisplayIdKey, display.id());
123 root_window->Init(); 123 root_window->Init();
124 return root_window; 124 return root_window;
125 } 125 }
126 126
127 const gfx::Display& MultiDisplayManager::GetDisplayAt(size_t index) { 127 gfx::Display* MultiDisplayManager::GetDisplayAt(size_t index) {
128 return index < displays_.size() ? displays_[index] : GetInvalidDisplay(); 128 return index < displays_.size() ? &displays_[index] : NULL;
129 } 129 }
130 130
131 size_t MultiDisplayManager::GetNumDisplays() const { 131 size_t MultiDisplayManager::GetNumDisplays() const {
132 return displays_.size(); 132 return displays_.size();
133 } 133 }
134 134
135 const gfx::Display& MultiDisplayManager::GetDisplayNearestWindow( 135 const gfx::Display& MultiDisplayManager::GetDisplayNearestWindow(
136 const Window* window) const { 136 const Window* window) const {
137 if (!window) { 137 if (!window) {
138 MultiDisplayManager* manager = const_cast<MultiDisplayManager*>(this); 138 MultiDisplayManager* manager = const_cast<MultiDisplayManager*>(this);
139 return manager->GetDisplayAt(0); 139 return *manager->GetDisplayAt(0);
140 } 140 }
141 const RootWindow* root = window->GetRootWindow(); 141 const RootWindow* root = window->GetRootWindow();
142 MultiDisplayManager* manager = const_cast<MultiDisplayManager*>(this); 142 MultiDisplayManager* manager = const_cast<MultiDisplayManager*>(this);
143 return root ? manager->FindDisplayForRootWindow(root) : GetInvalidDisplay(); 143 return root ? manager->FindDisplayForRootWindow(root) : GetInvalidDisplay();
144 } 144 }
145 145
146 const gfx::Display& MultiDisplayManager::GetDisplayNearestPoint( 146 const gfx::Display& MultiDisplayManager::GetDisplayNearestPoint(
147 const gfx::Point& point) const { 147 const gfx::Point& point) const {
148 // TODO(oshima): For m19, mouse is constrained within 148 // TODO(oshima): For m19, mouse is constrained within
149 // the primary window. 149 // the primary window.
150 MultiDisplayManager* manager = const_cast<MultiDisplayManager*>(this); 150 MultiDisplayManager* manager = const_cast<MultiDisplayManager*>(this);
151 return manager->GetDisplayAt(0); 151 return *manager->GetDisplayAt(0);
152 } 152 }
153 153
154 void MultiDisplayManager::OnRootWindowResized(const aura::RootWindow* root, 154 void MultiDisplayManager::OnRootWindowResized(const aura::RootWindow* root,
155 const gfx::Size& old_size) { 155 const gfx::Size& old_size) {
156 if (!use_fullscreen_host_window()) { 156 if (!use_fullscreen_host_window()) {
157 gfx::Display& display = FindDisplayForRootWindow(root); 157 gfx::Display& display = FindDisplayForRootWindow(root);
158 display.SetSize(root->GetHostSize()); 158 display.SetSize(root->GetHostSize());
159 NotifyBoundsChanged(display); 159 NotifyBoundsChanged(display);
160 } 160 }
161 } 161 }
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 iter != displays_.end(); ++iter) { 238 iter != displays_.end(); ++iter) {
239 if ((*iter).id() == id) 239 if ((*iter).id() == id)
240 return *iter; 240 return *iter;
241 } 241 }
242 DLOG(FATAL) << "Could not find display by id:" << id; 242 DLOG(FATAL) << "Could not find display by id:" << id;
243 return GetInvalidDisplay(); 243 return GetInvalidDisplay();
244 } 244 }
245 245
246 } // namespace internal 246 } // namespace internal
247 } // namespace ash 247 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/multi_display_manager.h ('k') | ash/display/multi_display_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698