| 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 <queue> | 7 #include <queue> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/ash_constants.h" | 10 #include "ash/ash_constants.h" |
| (...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 GetTopmostFullscreenWindow()); | 535 GetTopmostFullscreenWindow()); |
| 536 } | 536 } |
| 537 | 537 |
| 538 void RootWindowController::ActivateKeyboard( | 538 void RootWindowController::ActivateKeyboard( |
| 539 keyboard::KeyboardController* keyboard_controller) { | 539 keyboard::KeyboardController* keyboard_controller) { |
| 540 if (!keyboard::IsKeyboardEnabled() || | 540 if (!keyboard::IsKeyboardEnabled() || |
| 541 GetContainer(kShellWindowId_VirtualKeyboardContainer)) { | 541 GetContainer(kShellWindowId_VirtualKeyboardContainer)) { |
| 542 return; | 542 return; |
| 543 } | 543 } |
| 544 DCHECK(keyboard_controller); | 544 DCHECK(keyboard_controller); |
| 545 keyboard_controller->AddObserver(shelf()->shelf_layout_manager()); | 545 if (!keyboard::IsKeyboardUsabilityExperimentEnabled()) { |
| 546 keyboard_controller->AddObserver(panel_layout_manager_); | 546 keyboard_controller->AddObserver(shelf()->shelf_layout_manager()); |
| 547 keyboard_controller->AddObserver(docked_layout_manager_); | 547 keyboard_controller->AddObserver(panel_layout_manager_); |
| 548 keyboard_controller->AddObserver(docked_layout_manager_); |
| 549 } |
| 548 aura::Window* parent = root_window(); | 550 aura::Window* parent = root_window(); |
| 549 aura::Window* keyboard_container = | 551 aura::Window* keyboard_container = |
| 550 keyboard_controller->GetContainerWindow(); | 552 keyboard_controller->GetContainerWindow(); |
| 551 keyboard_container->set_id(kShellWindowId_VirtualKeyboardContainer); | 553 keyboard_container->set_id(kShellWindowId_VirtualKeyboardContainer); |
| 552 parent->AddChild(keyboard_container); | 554 parent->AddChild(keyboard_container); |
| 553 // TODO(oshima): Bounds of keyboard container should be handled by | 555 // TODO(oshima): Bounds of keyboard container should be handled by |
| 554 // RootWindowLayoutManager. Remove this after fixed RootWindowLayoutManager. | 556 // RootWindowLayoutManager. Remove this after fixed RootWindowLayoutManager. |
| 555 keyboard_container->SetBounds(parent->bounds()); | 557 keyboard_container->SetBounds(parent->bounds()); |
| 556 } | 558 } |
| 557 | 559 |
| 558 void RootWindowController::DeactivateKeyboard( | 560 void RootWindowController::DeactivateKeyboard( |
| 559 keyboard::KeyboardController* keyboard_controller) { | 561 keyboard::KeyboardController* keyboard_controller) { |
| 560 if (!keyboard::IsKeyboardEnabled()) | 562 if (!keyboard::IsKeyboardEnabled()) |
| 561 return; | 563 return; |
| 562 | 564 |
| 563 DCHECK(keyboard_controller); | 565 DCHECK(keyboard_controller); |
| 564 aura::Window* keyboard_container = | 566 aura::Window* keyboard_container = |
| 565 keyboard_controller->GetContainerWindow(); | 567 keyboard_controller->GetContainerWindow(); |
| 566 if (keyboard_container->GetRootWindow() == root_window()) { | 568 if (keyboard_container->GetRootWindow() == root_window()) { |
| 567 root_window()->RemoveChild(keyboard_container); | 569 root_window()->RemoveChild(keyboard_container); |
| 568 keyboard_controller->RemoveObserver(shelf()->shelf_layout_manager()); | 570 if (!keyboard::IsKeyboardUsabilityExperimentEnabled()) { |
| 569 keyboard_controller->RemoveObserver(panel_layout_manager_); | 571 keyboard_controller->RemoveObserver(shelf()->shelf_layout_manager()); |
| 570 keyboard_controller->RemoveObserver(docked_layout_manager_); | 572 keyboard_controller->RemoveObserver(panel_layout_manager_); |
| 573 keyboard_controller->RemoveObserver(docked_layout_manager_); |
| 574 } |
| 571 } | 575 } |
| 572 } | 576 } |
| 573 | 577 |
| 574 //////////////////////////////////////////////////////////////////////////////// | 578 //////////////////////////////////////////////////////////////////////////////// |
| 575 // RootWindowController, private: | 579 // RootWindowController, private: |
| 576 | 580 |
| 577 RootWindowController::RootWindowController(aura::RootWindow* root_window) | 581 RootWindowController::RootWindowController(aura::RootWindow* root_window) |
| 578 : root_window_(root_window), | 582 : root_window_(root_window), |
| 579 root_window_layout_(NULL), | 583 root_window_layout_(NULL), |
| 580 docked_layout_manager_(NULL), | 584 docked_layout_manager_(NULL), |
| 581 panel_layout_manager_(NULL), | 585 panel_layout_manager_(NULL), |
| 582 touch_hud_debug_(NULL), | 586 touch_hud_debug_(NULL), |
| 583 touch_hud_projection_(NULL) { | 587 touch_hud_projection_(NULL) { |
| 584 GetRootWindowSettings(root_window_->window())->controller = this; | 588 GetRootWindowSettings(root_window_->window())->controller = this; |
| 585 screen_dimmer_.reset(new ScreenDimmer(root_window_->window())); | 589 screen_dimmer_.reset(new ScreenDimmer(root_window_->window())); |
| 586 | 590 |
| 587 stacking_controller_.reset(new StackingController); | 591 stacking_controller_.reset(new StackingController); |
| 588 aura::client::SetWindowTreeClient(root_window_->window(), | 592 aura::client::SetWindowTreeClient(root_window_->window(), |
| 589 stacking_controller_.get()); | 593 stacking_controller_.get()); |
| 590 capture_client_.reset( | 594 capture_client_.reset( |
| 591 new views::corewm::ScopedCaptureClient(root_window_->window())); | 595 new views::corewm::ScopedCaptureClient(root_window_->window())); |
| 592 } | 596 } |
| 593 | 597 |
| 594 void RootWindowController::Init(RootWindowType root_window_type, | 598 void RootWindowController::Init(RootWindowType root_window_type, |
| 595 bool first_run_after_boot) { | 599 bool first_run_after_boot) { |
| 596 Shell::GetInstance()->InitRootWindow(root_window()); | 600 Shell* shell = Shell::GetInstance(); |
| 601 shell->InitRootWindow(root_window()); |
| 597 | 602 |
| 598 root_window_->SetCursor(ui::kCursorPointer); | 603 root_window_->SetCursor(ui::kCursorPointer); |
| 599 CreateContainersInRootWindow(root_window_->window()); | 604 CreateContainersInRootWindow(root_window_->window()); |
| 600 | 605 |
| 601 if (root_window_type == VIRTUAL_KEYBOARD) | 606 if (root_window_type == VIRTUAL_KEYBOARD) { |
| 607 shell->InitKeyboard(); |
| 602 return; | 608 return; |
| 609 } |
| 603 | 610 |
| 604 CreateSystemBackground(first_run_after_boot); | 611 CreateSystemBackground(first_run_after_boot); |
| 605 | 612 |
| 606 InitLayoutManagers(); | 613 InitLayoutManagers(); |
| 607 InitTouchHuds(); | 614 InitTouchHuds(); |
| 608 | 615 |
| 609 if (Shell::GetPrimaryRootWindowController()-> | 616 if (Shell::GetPrimaryRootWindowController()-> |
| 610 GetSystemModalLayoutManager(NULL)->has_modal_background()) { | 617 GetSystemModalLayoutManager(NULL)->has_modal_background()) { |
| 611 GetSystemModalLayoutManager(NULL)->CreateModalBackground(); | 618 GetSystemModalLayoutManager(NULL)->CreateModalBackground(); |
| 612 } | 619 } |
| 613 | 620 |
| 614 Shell* shell = Shell::GetInstance(); | |
| 615 shell->AddShellObserver(this); | 621 shell->AddShellObserver(this); |
| 616 | 622 |
| 617 if (root_window_type == PRIMARY) { | 623 if (root_window_type == PRIMARY) { |
| 618 root_window_layout()->OnWindowResized(); | 624 root_window_layout()->OnWindowResized(); |
| 619 shell->InitKeyboard(this); | 625 if (!keyboard::IsKeyboardUsabilityExperimentEnabled()) |
| 626 shell->InitKeyboard(); |
| 620 } else { | 627 } else { |
| 621 root_window_layout()->OnWindowResized(); | 628 root_window_layout()->OnWindowResized(); |
| 622 shell->desktop_background_controller()->OnRootWindowAdded(root_window()); | 629 shell->desktop_background_controller()->OnRootWindowAdded(root_window()); |
| 623 shell->high_contrast_controller()->OnRootWindowAdded( | 630 shell->high_contrast_controller()->OnRootWindowAdded( |
| 624 root_window_->window()); | 631 root_window_->window()); |
| 625 root_window_->host()->Show(); | 632 root_window_->host()->Show(); |
| 626 | 633 |
| 627 // Create a launcher if a user is already logged in. | 634 // Create a launcher if a user is already logged in. |
| 628 if (shell->session_state_delegate()->NumberOfLoggedInUsers()) | 635 if (shell->session_state_delegate()->NumberOfLoggedInUsers()) |
| 629 shelf()->CreateLauncher(); | 636 shelf()->CreateLauncher(); |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 922 DisableTouchHudProjection(); | 929 DisableTouchHudProjection(); |
| 923 } | 930 } |
| 924 | 931 |
| 925 RootWindowController* GetRootWindowController( | 932 RootWindowController* GetRootWindowController( |
| 926 const aura::Window* root_window) { | 933 const aura::Window* root_window) { |
| 927 return root_window ? GetRootWindowSettings(root_window)->controller : NULL; | 934 return root_window ? GetRootWindowSettings(root_window)->controller : NULL; |
| 928 } | 935 } |
| 929 | 936 |
| 930 } // namespace internal | 937 } // namespace internal |
| 931 } // namespace ash | 938 } // namespace ash |
| OLD | NEW |