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/root_window_controller.h" | 5 #include "ash/root_window_controller.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/desktop_background/desktop_background_widget_controller.h" | 9 #include "ash/desktop_background/desktop_background_widget_controller.h" |
10 #include "ash/display/display_controller.h" | 10 #include "ash/display/display_controller.h" |
11 #include "ash/display/multi_display_manager.h" | 11 #include "ash/display/multi_display_manager.h" |
12 #include "ash/shell.h" | 12 #include "ash/shell.h" |
13 #include "ash/shell_factory.h" | 13 #include "ash/shell_factory.h" |
14 #include "ash/shell_window_ids.h" | 14 #include "ash/shell_window_ids.h" |
15 #include "ash/wm/base_layout_manager.h" | 15 #include "ash/wm/base_layout_manager.h" |
16 #include "ash/wm/event_client_impl.h" | 16 #include "ash/wm/event_client_impl.h" |
17 #include "ash/wm/property_util.h" | 17 #include "ash/wm/property_util.h" |
18 #include "ash/wm/root_window_layout_manager.h" | 18 #include "ash/wm/root_window_layout_manager.h" |
19 #include "ash/wm/screen_dimmer.h" | 19 #include "ash/wm/screen_dimmer.h" |
20 #include "ash/wm/system_modal_container_layout_manager.h" | 20 #include "ash/wm/system_modal_container_layout_manager.h" |
21 #include "ash/wm/toplevel_window_event_handler.h" | 21 #include "ash/wm/toplevel_window_event_handler.h" |
22 #include "ash/wm/visibility_controller.h" | 22 #include "ash/wm/visibility_controller.h" |
23 #include "ash/wm/window_properties.h" | 23 #include "ash/wm/window_properties.h" |
| 24 #include "ash/wm/workspace/system_background_controller.h" |
24 #include "ash/wm/workspace_controller.h" | 25 #include "ash/wm/workspace_controller.h" |
25 #include "ui/aura/client/activation_client.h" | 26 #include "ui/aura/client/activation_client.h" |
26 #include "ui/aura/client/aura_constants.h" | 27 #include "ui/aura/client/aura_constants.h" |
27 #include "ui/aura/client/capture_client.h" | 28 #include "ui/aura/client/capture_client.h" |
28 #include "ui/aura/client/tooltip_client.h" | 29 #include "ui/aura/client/tooltip_client.h" |
29 #include "ui/aura/focus_manager.h" | 30 #include "ui/aura/focus_manager.h" |
30 #include "ui/aura/root_window.h" | 31 #include "ui/aura/root_window.h" |
31 #include "ui/aura/window.h" | 32 #include "ui/aura/window.h" |
32 #include "ui/aura/window_observer.h" | 33 #include "ui/aura/window_observer.h" |
33 #include "ui/aura/window_tracker.h" | 34 #include "ui/aura/window_tracker.h" |
34 #include "ui/gfx/display.h" | 35 #include "ui/gfx/display.h" |
35 #include "ui/gfx/screen.h" | 36 #include "ui/gfx/screen.h" |
36 | 37 |
37 namespace ash { | 38 namespace ash { |
38 namespace { | 39 namespace { |
39 | 40 |
| 41 #if defined(OS_CHROMEOS) |
| 42 // Color initially used for the system background after the system has first |
| 43 // booted. |
| 44 const SkColor kBootSystemBackgroundColor = 0xFFFEFEFE; |
| 45 #endif |
| 46 |
40 // Creates a new window for use as a container. | 47 // Creates a new window for use as a container. |
41 aura::Window* CreateContainer(int window_id, | 48 aura::Window* CreateContainer(int window_id, |
42 const char* name, | 49 const char* name, |
43 aura::Window* parent) { | 50 aura::Window* parent) { |
44 aura::Window* container = new aura::Window(NULL); | 51 aura::Window* container = new aura::Window(NULL); |
45 container->set_id(window_id); | 52 container->set_id(window_id); |
46 container->SetName(name); | 53 container->SetName(name); |
47 container->Init(ui::LAYER_NOT_DRAWN); | 54 container->Init(ui::LAYER_NOT_DRAWN); |
48 parent->AddChild(container); | 55 parent->AddChild(container); |
49 if (window_id != internal::kShellWindowId_UnparentedControlContainer) | 56 if (window_id != internal::kShellWindowId_UnparentedControlContainer) |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 GetContainer(internal::kShellWindowId_AlwaysOnTopContainer); | 189 GetContainer(internal::kShellWindowId_AlwaysOnTopContainer); |
183 always_on_top_container->SetLayoutManager( | 190 always_on_top_container->SetLayoutManager( |
184 new internal::BaseLayoutManager( | 191 new internal::BaseLayoutManager( |
185 always_on_top_container->GetRootWindow())); | 192 always_on_top_container->GetRootWindow())); |
186 } | 193 } |
187 | 194 |
188 void RootWindowController::CreateContainers() { | 195 void RootWindowController::CreateContainers() { |
189 CreateContainersInRootWindow(root_window_.get()); | 196 CreateContainersInRootWindow(root_window_.get()); |
190 } | 197 } |
191 | 198 |
| 199 void RootWindowController::CreateSystemBackground( |
| 200 bool is_first_run_after_boot) { |
| 201 SkColor color = SK_ColorBLACK; |
| 202 #if defined(OS_CHROMEOS) |
| 203 if (is_first_run_after_boot) |
| 204 color = kBootSystemBackgroundColor; |
| 205 #endif |
| 206 background_.reset(new SystemBackgroundController(root_window_.get(), color)); |
| 207 } |
| 208 |
| 209 void RootWindowController::HandleDesktopBackgroundVisible() { |
| 210 if (background_.get()) |
| 211 background_->SetColor(SK_ColorBLACK); |
| 212 } |
| 213 |
192 void RootWindowController::CloseChildWindows() { | 214 void RootWindowController::CloseChildWindows() { |
193 // Close background widget first as it depends on tooltip. | 215 // Close background widget first as it depends on tooltip. |
194 root_window_->SetProperty(kWindowDesktopComponent, | 216 root_window_->SetProperty(kWindowDesktopComponent, |
195 static_cast<DesktopBackgroundWidgetController*>(NULL)); | 217 static_cast<DesktopBackgroundWidgetController*>(NULL)); |
196 root_window_->SetProperty(kComponentWrapper, | 218 root_window_->SetProperty(kComponentWrapper, |
197 static_cast<ComponentWrapper*>(NULL)); | 219 static_cast<ComponentWrapper*>(NULL)); |
198 | 220 |
199 workspace_controller_.reset(); | 221 workspace_controller_.reset(); |
200 aura::client::SetTooltipClient(root_window_.get(), NULL); | 222 aura::client::SetTooltipClient(root_window_.get(), NULL); |
201 | 223 |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 | 414 |
393 aura::Window* overlay_container = CreateContainer( | 415 aura::Window* overlay_container = CreateContainer( |
394 internal::kShellWindowId_OverlayContainer, | 416 internal::kShellWindowId_OverlayContainer, |
395 "OverlayContainer", | 417 "OverlayContainer", |
396 lock_screen_related_containers); | 418 lock_screen_related_containers); |
397 SetUsesScreenCoordinates(overlay_container); | 419 SetUsesScreenCoordinates(overlay_container); |
398 } | 420 } |
399 | 421 |
400 } // namespace internal | 422 } // namespace internal |
401 } // namespace ash | 423 } // namespace ash |
OLD | NEW |