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 |
11 #include "ash/ash_switches.h" | 11 #include "ash/ash_switches.h" |
12 #include "ash/display/display_layout_store.h" | 12 #include "ash/display/display_layout_store.h" |
13 #include "ash/display/display_manager.h" | 13 #include "ash/display/display_manager.h" |
14 #include "ash/display/mirror_window_controller.h" | 14 #include "ash/display/mirror_window_controller.h" |
15 #include "ash/display/root_window_transformers.h" | 15 #include "ash/display/root_window_transformers.h" |
16 #include "ash/display/virtual_keyboard_window_controller.h" | 16 #include "ash/display/virtual_keyboard_window_controller.h" |
17 #include "ash/host/root_window_host_factory.h" | 17 #include "ash/host/root_window_host_factory.h" |
18 #include "ash/root_window_controller.h" | 18 #include "ash/root_window_controller.h" |
19 #include "ash/root_window_settings.h" | 19 #include "ash/root_window_settings.h" |
20 #include "ash/screen_ash.h" | 20 #include "ash/screen_ash.h" |
21 #include "ash/shell.h" | 21 #include "ash/shell.h" |
| 22 #include "ash/shell_delegate.h" |
22 #include "ash/wm/coordinate_conversion.h" | 23 #include "ash/wm/coordinate_conversion.h" |
23 #include "base/command_line.h" | 24 #include "base/command_line.h" |
24 #include "base/strings/stringprintf.h" | 25 #include "base/strings/stringprintf.h" |
25 #include "third_party/skia/include/utils/SkMatrix44.h" | 26 #include "third_party/skia/include/utils/SkMatrix44.h" |
26 #include "ui/aura/client/activation_client.h" | 27 #include "ui/aura/client/activation_client.h" |
27 #include "ui/aura/client/capture_client.h" | 28 #include "ui/aura/client/capture_client.h" |
28 #include "ui/aura/client/cursor_client.h" | 29 #include "ui/aura/client/cursor_client.h" |
29 #include "ui/aura/client/focus_client.h" | 30 #include "ui/aura/client/focus_client.h" |
30 #include "ui/aura/client/screen_position_client.h" | 31 #include "ui/aura/client/screen_position_client.h" |
31 #include "ui/aura/root_window.h" | 32 #include "ui/aura/root_window.h" |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 num_displays_for_shutdown = -1; | 240 num_displays_for_shutdown = -1; |
240 } | 241 } |
241 | 242 |
242 DisplayController::~DisplayController() { | 243 DisplayController::~DisplayController() { |
243 DCHECK(primary_display_for_shutdown); | 244 DCHECK(primary_display_for_shutdown); |
244 } | 245 } |
245 | 246 |
246 void DisplayController::Start() { | 247 void DisplayController::Start() { |
247 Shell::GetScreen()->AddObserver(this); | 248 Shell::GetScreen()->AddObserver(this); |
248 Shell::GetInstance()->display_manager()->set_delegate(this); | 249 Shell::GetInstance()->display_manager()->set_delegate(this); |
| 250 |
| 251 if (Shell::GetInstance()->delegate()->IsFirstRunAfterBoot()) { |
| 252 // Update the display pref with the initial power state. |
| 253 FOR_EACH_OBSERVER(Observer, observers_, OnDisplayConfigurationChanging()); |
| 254 FOR_EACH_OBSERVER(Observer, observers_, OnDisplayConfigurationChanged()); |
| 255 } |
249 } | 256 } |
250 | 257 |
251 void DisplayController::Shutdown() { | 258 void DisplayController::Shutdown() { |
252 // Unset the display manager's delegate here because | 259 // Unset the display manager's delegate here because |
253 // DisplayManager outlives DisplayController. | 260 // DisplayManager outlives DisplayController. |
254 Shell::GetInstance()->display_manager()->set_delegate(NULL); | 261 Shell::GetInstance()->display_manager()->set_delegate(NULL); |
255 | 262 |
256 mirror_window_controller_.reset(); | 263 mirror_window_controller_.reset(); |
257 virtual_keyboard_window_controller_.reset(); | 264 virtual_keyboard_window_controller_.reset(); |
258 | 265 |
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 std::string name = | 822 std::string name = |
816 root_windows[i] == primary ? "aura_root_0" : "aura_root_x"; | 823 root_windows[i] == primary ? "aura_root_0" : "aura_root_x"; |
817 gfx::AcceleratedWidget xwindow = | 824 gfx::AcceleratedWidget xwindow = |
818 root_windows[i]->GetDispatcher()->host()->GetAcceleratedWidget(); | 825 root_windows[i]->GetDispatcher()->host()->GetAcceleratedWidget(); |
819 XStoreName(gfx::GetXDisplay(), xwindow, name.c_str()); | 826 XStoreName(gfx::GetXDisplay(), xwindow, name.c_str()); |
820 } | 827 } |
821 #endif | 828 #endif |
822 } | 829 } |
823 | 830 |
824 } // namespace ash | 831 } // namespace ash |
OLD | NEW |