| 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/ash_constants.h" | 9 #include "ash/ash_constants.h" |
| 10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 #include "ui/aura/client/capture_client.h" | 42 #include "ui/aura/client/capture_client.h" |
| 43 #include "ui/aura/client/focus_client.h" | 43 #include "ui/aura/client/focus_client.h" |
| 44 #include "ui/aura/client/tooltip_client.h" | 44 #include "ui/aura/client/tooltip_client.h" |
| 45 #include "ui/aura/root_window.h" | 45 #include "ui/aura/root_window.h" |
| 46 #include "ui/aura/window.h" | 46 #include "ui/aura/window.h" |
| 47 #include "ui/aura/window_observer.h" | 47 #include "ui/aura/window_observer.h" |
| 48 #include "ui/aura/window_tracker.h" | 48 #include "ui/aura/window_tracker.h" |
| 49 #include "ui/base/models/menu_model.h" | 49 #include "ui/base/models/menu_model.h" |
| 50 #include "ui/gfx/display.h" | 50 #include "ui/gfx/display.h" |
| 51 #include "ui/gfx/screen.h" | 51 #include "ui/gfx/screen.h" |
| 52 #include "ui/keyboard/keyboard_controller.h" |
| 53 #include "ui/keyboard/keyboard_util.h" |
| 52 #include "ui/views/controls/menu/menu_runner.h" | 54 #include "ui/views/controls/menu/menu_runner.h" |
| 53 #include "ui/views/corewm/visibility_controller.h" | 55 #include "ui/views/corewm/visibility_controller.h" |
| 54 #include "ui/views/view_model.h" | 56 #include "ui/views/view_model.h" |
| 55 #include "ui/views/view_model_utils.h" | 57 #include "ui/views/view_model_utils.h" |
| 56 | 58 |
| 57 namespace ash { | 59 namespace ash { |
| 58 namespace { | 60 namespace { |
| 59 | 61 |
| 60 // Duration for the animation that hides the boot splash screen, in | 62 // Duration for the animation that hides the boot splash screen, in |
| 61 // milliseconds. This should be short enough in relation to | 63 // milliseconds. This should be short enough in relation to |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 aura::Window* panel_container = GetContainer( | 285 aura::Window* panel_container = GetContainer( |
| 284 internal::kShellWindowId_PanelContainer); | 286 internal::kShellWindowId_PanelContainer); |
| 285 panel_layout_manager_ = | 287 panel_layout_manager_ = |
| 286 new internal::PanelLayoutManager(panel_container); | 288 new internal::PanelLayoutManager(panel_container); |
| 287 panel_container_handler_.reset( | 289 panel_container_handler_.reset( |
| 288 new ToplevelWindowEventHandler(panel_container)); | 290 new ToplevelWindowEventHandler(panel_container)); |
| 289 panel_container->SetLayoutManager(panel_layout_manager_); | 291 panel_container->SetLayoutManager(panel_layout_manager_); |
| 290 } | 292 } |
| 291 if (Shell::GetInstance()->delegate()->IsUserLoggedIn()) | 293 if (Shell::GetInstance()->delegate()->IsUserLoggedIn()) |
| 292 shelf_->CreateLauncher(); | 294 shelf_->CreateLauncher(); |
| 295 |
| 296 // TODO(bryeung): Move this to CreateContainersInRootWindow when the |
| 297 // keyboard controller will take care of deferring creation of the keyboard. |
| 298 InitKeyboard(); |
| 293 } | 299 } |
| 294 | 300 |
| 295 void RootWindowController::CreateContainers() { | 301 void RootWindowController::CreateContainers() { |
| 296 CreateContainersInRootWindow(root_window_.get()); | 302 CreateContainersInRootWindow(root_window_.get()); |
| 297 | 303 |
| 298 // Create touch observer HUD if needed. HUD should be created after the | 304 // Create touch observer HUD if needed. HUD should be created after the |
| 299 // containers have been created, so that its widget can be added to them. | 305 // containers have been created, so that its widget can be added to them. |
| 300 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 306 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 301 if (command_line->HasSwitch(switches::kAshTouchHud)) { | 307 if (command_line->HasSwitch(switches::kAshTouchHud)) { |
| 302 int64 id = root_window_->GetProperty(kDisplayIdKey); | 308 int64 id = root_window_->GetProperty(kDisplayIdKey); |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 bool RootWindowController::IsImmersiveMode() const { | 495 bool RootWindowController::IsImmersiveMode() const { |
| 490 aura::Window* container = workspace_controller_->GetActiveWorkspaceWindow(); | 496 aura::Window* container = workspace_controller_->GetActiveWorkspaceWindow(); |
| 491 for (size_t i = 0; i < container->children().size(); ++i) { | 497 for (size_t i = 0; i < container->children().size(); ++i) { |
| 492 aura::Window* child = container->children()[i]; | 498 aura::Window* child = container->children()[i]; |
| 493 if (child->IsVisible() && child->GetProperty(kImmersiveModeKey)) | 499 if (child->IsVisible() && child->GetProperty(kImmersiveModeKey)) |
| 494 return true; | 500 return true; |
| 495 } | 501 } |
| 496 return false; | 502 return false; |
| 497 } | 503 } |
| 498 | 504 |
| 505 void RootWindowController::InitKeyboard() { |
| 506 if (keyboard::IsKeyboardEnabled()) { |
| 507 aura::Window* parent = root_window(); |
| 508 |
| 509 keyboard::KeyboardControllerProxy* proxy = |
| 510 Shell::GetInstance()->delegate()->CreateKeyboardControllerProxy(); |
| 511 keyboard_controller_.reset( |
| 512 new keyboard::KeyboardController(proxy)); |
| 513 aura::Window* keyboard_container = |
| 514 keyboard_controller_->GetContainerWindow(); |
| 515 parent->AddChild(keyboard_container); |
| 516 // TODO(bryeung): move this to the controller on visibility changed |
| 517 parent->StackChildAtTop(keyboard_container); |
| 518 keyboard_container->Show(); |
| 519 } |
| 520 } |
| 521 |
| 522 |
| 499 //////////////////////////////////////////////////////////////////////////////// | 523 //////////////////////////////////////////////////////////////////////////////// |
| 500 // RootWindowController, private: | 524 // RootWindowController, private: |
| 501 | 525 |
| 502 void RootWindowController::CreateContainersInRootWindow( | 526 void RootWindowController::CreateContainersInRootWindow( |
| 503 aura::RootWindow* root_window) { | 527 aura::RootWindow* root_window) { |
| 504 // These containers are just used by PowerButtonController to animate groups | 528 // These containers are just used by PowerButtonController to animate groups |
| 505 // of containers simultaneously without messing up the current transformations | 529 // of containers simultaneously without messing up the current transformations |
| 506 // on those containers. These are direct children of the root window; all of | 530 // on those containers. These are direct children of the root window; all of |
| 507 // the other containers are their children. | 531 // the other containers are their children. |
| 508 | 532 |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 "OverlayContainer", | 674 "OverlayContainer", |
| 651 lock_screen_related_containers); | 675 lock_screen_related_containers); |
| 652 SetUsesScreenCoordinates(overlay_container); | 676 SetUsesScreenCoordinates(overlay_container); |
| 653 | 677 |
| 654 CreateContainer(kShellWindowId_PowerButtonAnimationContainer, | 678 CreateContainer(kShellWindowId_PowerButtonAnimationContainer, |
| 655 "PowerButtonAnimationContainer", root_window) ; | 679 "PowerButtonAnimationContainer", root_window) ; |
| 656 } | 680 } |
| 657 | 681 |
| 658 } // namespace internal | 682 } // namespace internal |
| 659 } // namespace ash | 683 } // namespace ash |
| OLD | NEW |