| 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/aura/aura_layout_manager_adapter.h" | 10 #include "ash/aura/aura_layout_manager_adapter.h" |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 if (panel_layout_manager_) | 474 if (panel_layout_manager_) |
| 475 panel_layout_manager_->SetShelf(wm_shelf_aura_.get()); | 475 panel_layout_manager_->SetShelf(wm_shelf_aura_.get()); |
| 476 if (docked_layout_manager_) { | 476 if (docked_layout_manager_) { |
| 477 docked_layout_manager_->SetShelf(wm_shelf_aura_.get()); | 477 docked_layout_manager_->SetShelf(wm_shelf_aura_.get()); |
| 478 if (shelf_widget_->shelf_layout_manager()) | 478 if (shelf_widget_->shelf_layout_manager()) |
| 479 docked_layout_manager_->AddObserver( | 479 docked_layout_manager_->AddObserver( |
| 480 shelf_widget_->shelf_layout_manager()); | 480 shelf_widget_->shelf_layout_manager()); |
| 481 } | 481 } |
| 482 | 482 |
| 483 // Notify shell observers that the shelf has been created. | 483 // Notify shell observers that the shelf has been created. |
| 484 Shell::GetInstance()->OnShelfCreatedForRootWindow( | 484 WmShell::Get()->NotifyShelfCreatedForRootWindow( |
| 485 WmWindowAura::Get(GetRootWindow())); | 485 WmWindowAura::Get(GetRootWindow())); |
| 486 | 486 |
| 487 shelf_widget_->PostCreateShelf(); | 487 shelf_widget_->PostCreateShelf(); |
| 488 } | 488 } |
| 489 | 489 |
| 490 Shelf* RootWindowController::GetShelf() const { | 490 Shelf* RootWindowController::GetShelf() const { |
| 491 // TODO(jamescook): Shelf should be owned by this class, not by ShelfWidget. | 491 // TODO(jamescook): Shelf should be owned by this class, not by ShelfWidget. |
| 492 return shelf_widget_->shelf(); | 492 return shelf_widget_->shelf(); |
| 493 } | 493 } |
| 494 | 494 |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 GetContainer(kShellWindowId_VirtualKeyboardContainer)) { | 668 GetContainer(kShellWindowId_VirtualKeyboardContainer)) { |
| 669 return; | 669 return; |
| 670 } | 670 } |
| 671 DCHECK(keyboard_controller); | 671 DCHECK(keyboard_controller); |
| 672 keyboard_controller->AddObserver(shelf_widget()->shelf_layout_manager()); | 672 keyboard_controller->AddObserver(shelf_widget()->shelf_layout_manager()); |
| 673 keyboard_controller->AddObserver(panel_layout_manager_); | 673 keyboard_controller->AddObserver(panel_layout_manager_); |
| 674 keyboard_controller->AddObserver(docked_layout_manager_); | 674 keyboard_controller->AddObserver(docked_layout_manager_); |
| 675 keyboard_controller->AddObserver(workspace_controller_->layout_manager()); | 675 keyboard_controller->AddObserver(workspace_controller_->layout_manager()); |
| 676 keyboard_controller->AddObserver( | 676 keyboard_controller->AddObserver( |
| 677 always_on_top_controller_->GetLayoutManager()); | 677 always_on_top_controller_->GetLayoutManager()); |
| 678 WmShell::Get()->OnVirtualKeyboardActivated(true); | 678 WmShell::Get()->NotifyVirtualKeyboardActivated(true); |
| 679 aura::Window* parent = GetContainer(kShellWindowId_ImeWindowParentContainer); | 679 aura::Window* parent = GetContainer(kShellWindowId_ImeWindowParentContainer); |
| 680 DCHECK(parent); | 680 DCHECK(parent); |
| 681 aura::Window* keyboard_container = keyboard_controller->GetContainerWindow(); | 681 aura::Window* keyboard_container = keyboard_controller->GetContainerWindow(); |
| 682 keyboard_container->set_id(kShellWindowId_VirtualKeyboardContainer); | 682 keyboard_container->set_id(kShellWindowId_VirtualKeyboardContainer); |
| 683 parent->AddChild(keyboard_container); | 683 parent->AddChild(keyboard_container); |
| 684 } | 684 } |
| 685 | 685 |
| 686 void RootWindowController::DeactivateKeyboard( | 686 void RootWindowController::DeactivateKeyboard( |
| 687 keyboard::KeyboardController* keyboard_controller) { | 687 keyboard::KeyboardController* keyboard_controller) { |
| 688 if (!keyboard_controller || | 688 if (!keyboard_controller || |
| 689 !keyboard_controller->keyboard_container_initialized()) { | 689 !keyboard_controller->keyboard_container_initialized()) { |
| 690 return; | 690 return; |
| 691 } | 691 } |
| 692 aura::Window* keyboard_container = keyboard_controller->GetContainerWindow(); | 692 aura::Window* keyboard_container = keyboard_controller->GetContainerWindow(); |
| 693 if (keyboard_container->GetRootWindow() == GetRootWindow()) { | 693 if (keyboard_container->GetRootWindow() == GetRootWindow()) { |
| 694 aura::Window* parent = | 694 aura::Window* parent = |
| 695 GetContainer(kShellWindowId_ImeWindowParentContainer); | 695 GetContainer(kShellWindowId_ImeWindowParentContainer); |
| 696 DCHECK(parent); | 696 DCHECK(parent); |
| 697 parent->RemoveChild(keyboard_container); | 697 parent->RemoveChild(keyboard_container); |
| 698 // Virtual keyboard may be deactivated while still showing, notify all | 698 // Virtual keyboard may be deactivated while still showing, notify all |
| 699 // observers that keyboard bounds changed to 0 before remove them. | 699 // observers that keyboard bounds changed to 0 before remove them. |
| 700 keyboard_controller->NotifyKeyboardBoundsChanging(gfx::Rect()); | 700 keyboard_controller->NotifyKeyboardBoundsChanging(gfx::Rect()); |
| 701 keyboard_controller->RemoveObserver(shelf_widget()->shelf_layout_manager()); | 701 keyboard_controller->RemoveObserver(shelf_widget()->shelf_layout_manager()); |
| 702 keyboard_controller->RemoveObserver(panel_layout_manager_); | 702 keyboard_controller->RemoveObserver(panel_layout_manager_); |
| 703 keyboard_controller->RemoveObserver(docked_layout_manager_); | 703 keyboard_controller->RemoveObserver(docked_layout_manager_); |
| 704 keyboard_controller->RemoveObserver( | 704 keyboard_controller->RemoveObserver( |
| 705 workspace_controller_->layout_manager()); | 705 workspace_controller_->layout_manager()); |
| 706 keyboard_controller->RemoveObserver( | 706 keyboard_controller->RemoveObserver( |
| 707 always_on_top_controller_->GetLayoutManager()); | 707 always_on_top_controller_->GetLayoutManager()); |
| 708 WmShell::Get()->OnVirtualKeyboardActivated(false); | 708 WmShell::Get()->NotifyVirtualKeyboardActivated(false); |
| 709 } | 709 } |
| 710 } | 710 } |
| 711 | 711 |
| 712 bool RootWindowController::IsVirtualKeyboardWindow(aura::Window* window) { | 712 bool RootWindowController::IsVirtualKeyboardWindow(aura::Window* window) { |
| 713 aura::Window* parent = GetContainer(kShellWindowId_ImeWindowParentContainer); | 713 aura::Window* parent = GetContainer(kShellWindowId_ImeWindowParentContainer); |
| 714 return parent ? parent->Contains(window) : false; | 714 return parent ? parent->Contains(window) : false; |
| 715 } | 715 } |
| 716 | 716 |
| 717 void RootWindowController::SetTouchAccessibilityAnchorPoint( | 717 void RootWindowController::SetTouchAccessibilityAnchorPoint( |
| 718 const gfx::Point& anchor_point) { | 718 const gfx::Point& anchor_point) { |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 948 aura::Window* primary_root_window = Shell::GetInstance() | 948 aura::Window* primary_root_window = Shell::GetInstance() |
| 949 ->window_tree_host_manager() | 949 ->window_tree_host_manager() |
| 950 ->GetPrimaryRootWindow(); | 950 ->GetPrimaryRootWindow(); |
| 951 return GetRootWindowSettings(primary_root_window)->controller; | 951 return GetRootWindowSettings(primary_root_window)->controller; |
| 952 } | 952 } |
| 953 | 953 |
| 954 return GetRootWindowSettings(root_window)->controller; | 954 return GetRootWindowSettings(root_window)->controller; |
| 955 } | 955 } |
| 956 | 956 |
| 957 } // namespace ash | 957 } // namespace ash |
| OLD | NEW |