OLD | NEW |
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/display_controller.h" | 5 #include "ash/display/display_controller.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 DisplayController::~DisplayController() { | 240 DisplayController::~DisplayController() { |
241 } | 241 } |
242 | 242 |
243 void DisplayController::Start() { | 243 void DisplayController::Start() { |
244 // Created here so that Shell has finished being created. Adds itself | 244 // Created here so that Shell has finished being created. Adds itself |
245 // as a ShellObserver. | 245 // as a ShellObserver. |
246 virtual_keyboard_window_controller_.reset( | 246 virtual_keyboard_window_controller_.reset( |
247 new VirtualKeyboardWindowController); | 247 new VirtualKeyboardWindowController); |
248 Shell::GetScreen()->AddObserver(this); | 248 Shell::GetScreen()->AddObserver(this); |
249 Shell::GetInstance()->display_manager()->set_delegate(this); | 249 Shell::GetInstance()->display_manager()->set_delegate(this); |
250 | |
251 FOR_EACH_OBSERVER(Observer, observers_, OnDisplaysInitialized()); | |
252 } | 250 } |
253 | 251 |
254 void DisplayController::Shutdown() { | 252 void DisplayController::Shutdown() { |
255 // Unset the display manager's delegate here because | 253 // Unset the display manager's delegate here because |
256 // DisplayManager outlives DisplayController. | 254 // DisplayManager outlives DisplayController. |
257 Shell::GetInstance()->display_manager()->set_delegate(NULL); | 255 Shell::GetInstance()->display_manager()->set_delegate(NULL); |
258 | 256 |
259 cursor_window_controller_.reset(); | 257 cursor_window_controller_.reset(); |
260 mirror_window_controller_.reset(); | 258 mirror_window_controller_.reset(); |
261 virtual_keyboard_window_controller_.reset(); | 259 virtual_keyboard_window_controller_.reset(); |
(...skipping 25 matching lines...) Expand all Loading... |
287 | 285 |
288 DisplayManager* display_manager = GetDisplayManager(); | 286 DisplayManager* display_manager = GetDisplayManager(); |
289 for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i) { | 287 for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i) { |
290 const gfx::Display& display = display_manager->GetDisplayAt(i); | 288 const gfx::Display& display = display_manager->GetDisplayAt(i); |
291 if (primary_display_id != display.id()) { | 289 if (primary_display_id != display.id()) { |
292 AshWindowTreeHost* ash_host = AddWindowTreeHostForDisplay(display); | 290 AshWindowTreeHost* ash_host = AddWindowTreeHostForDisplay(display); |
293 RootWindowController::CreateForSecondaryDisplay(ash_host); | 291 RootWindowController::CreateForSecondaryDisplay(ash_host); |
294 } | 292 } |
295 } | 293 } |
296 UpdateHostWindowNames(); | 294 UpdateHostWindowNames(); |
| 295 |
| 296 FOR_EACH_OBSERVER(Observer, observers_, OnDisplaysInitialized()); |
297 } | 297 } |
298 | 298 |
299 void DisplayController::AddObserver(Observer* observer) { | 299 void DisplayController::AddObserver(Observer* observer) { |
300 observers_.AddObserver(observer); | 300 observers_.AddObserver(observer); |
301 } | 301 } |
302 | 302 |
303 void DisplayController::RemoveObserver(Observer* observer) { | 303 void DisplayController::RemoveObserver(Observer* observer) { |
304 observers_.RemoveObserver(observer); | 304 observers_.RemoveObserver(observer); |
305 } | 305 } |
306 | 306 |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 std::string name = | 748 std::string name = |
749 root_windows[i] == primary ? "aura_root_0" : "aura_root_x"; | 749 root_windows[i] == primary ? "aura_root_0" : "aura_root_x"; |
750 gfx::AcceleratedWidget xwindow = | 750 gfx::AcceleratedWidget xwindow = |
751 root_windows[i]->GetHost()->GetAcceleratedWidget(); | 751 root_windows[i]->GetHost()->GetAcceleratedWidget(); |
752 XStoreName(gfx::GetXDisplay(), xwindow, name.c_str()); | 752 XStoreName(gfx::GetXDisplay(), xwindow, name.c_str()); |
753 } | 753 } |
754 #endif | 754 #endif |
755 } | 755 } |
756 | 756 |
757 } // namespace ash | 757 } // namespace ash |
OLD | NEW |