Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(218)

Side by Side Diff: ash/root_window_controller.cc

Issue 25111002: Only show virtual keyboard on primary root window (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move KeyboardController to shell Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 const aura::Window* RootWindowController::GetContainer(int container_id) const { 324 const aura::Window* RootWindowController::GetContainer(int container_id) const {
325 return root_window_->GetChildById(container_id); 325 return root_window_->GetChildById(container_id);
326 } 326 }
327 327
328 void RootWindowController::Init(bool first_run_after_boot) { 328 void RootWindowController::Init(bool first_run_after_boot) {
329 root_window_->SetCursor(ui::kCursorPointer); 329 root_window_->SetCursor(ui::kCursorPointer);
330 CreateContainersInRootWindow(root_window_.get()); 330 CreateContainersInRootWindow(root_window_.get());
331 CreateSystemBackground(first_run_after_boot); 331 CreateSystemBackground(first_run_after_boot);
332 332
333 InitLayoutManagers(); 333 InitLayoutManagers();
334 InitKeyboard();
335 InitTouchHuds(); 334 InitTouchHuds();
336 335
337 if (Shell::GetPrimaryRootWindowController()-> 336 if (Shell::GetPrimaryRootWindowController()->
338 GetSystemModalLayoutManager(NULL)->has_modal_background()) { 337 GetSystemModalLayoutManager(NULL)->has_modal_background()) {
339 GetSystemModalLayoutManager(NULL)->CreateModalBackground(); 338 GetSystemModalLayoutManager(NULL)->CreateModalBackground();
340 } 339 }
341 340
342 Shell::GetInstance()->AddShellObserver(this); 341 Shell::GetInstance()->AddShellObserver(this);
343 } 342 }
344 343
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 const aura::Window::Windows& windows = 511 const aura::Window::Windows& windows =
513 GetContainer(kShellWindowId_DefaultContainer)->children(); 512 GetContainer(kShellWindowId_DefaultContainer)->children();
514 for (aura::Window::Windows::const_reverse_iterator iter = windows.rbegin(); 513 for (aura::Window::Windows::const_reverse_iterator iter = windows.rbegin();
515 iter != windows.rend(); ++iter) { 514 iter != windows.rend(); ++iter) {
516 if (wm::GetWindowState(*iter)->IsFullscreen()) 515 if (wm::GetWindowState(*iter)->IsFullscreen())
517 return *iter; 516 return *iter;
518 } 517 }
519 return NULL; 518 return NULL;
520 } 519 }
521 520
522 void RootWindowController::InitKeyboard() { 521 void RootWindowController::EnableKeyboard(
522 keyboard::KeyboardController* keyboard_controller) {
523 if (keyboard::IsKeyboardEnabled()) { 523 if (keyboard::IsKeyboardEnabled()) {
524 keyboard_controller->AddObserver(shelf()->shelf_layout_manager());
525 keyboard_controller->AddObserver(panel_layout_manager_);
524 aura::Window* parent = root_window(); 526 aura::Window* parent = root_window();
525
526 keyboard::KeyboardControllerProxy* proxy =
527 Shell::GetInstance()->delegate()->CreateKeyboardControllerProxy();
528 keyboard_controller_.reset(
529 new keyboard::KeyboardController(proxy));
530
531 keyboard_controller_->AddObserver(shelf()->shelf_layout_manager());
532 keyboard_controller_->AddObserver(panel_layout_manager_);
533
534 aura::Window* keyboard_container = 527 aura::Window* keyboard_container =
535 keyboard_controller_->GetContainerWindow(); 528 keyboard_controller->GetContainerWindow();
536 keyboard_container->set_id(kShellWindowId_VirtualKeyboardContainer); 529 keyboard_container->set_id(kShellWindowId_VirtualKeyboardContainer);
537 parent->AddChild(keyboard_container); 530 parent->AddChild(keyboard_container);
538 keyboard_container->SetBounds(parent->bounds()); 531 keyboard_container->SetBounds(parent->bounds());
539 } 532 }
540 } 533 }
541 534
bshe 2013/10/03 01:05:43 Note: |DisableKeyboard| is not used anywhere yet.
535 void RootWindowController::DisableKeyboard(
536 keyboard::KeyboardController* keyboard_controller) {
537 if (keyboard::IsKeyboardEnabled()) {
538 aura::Window* keyboard_container =
539 keyboard_controller->GetContainerWindow();
540 if (root_window()->Contains(keyboard_container)) {
541 root_window()->RemoveChild(keyboard_controller->GetContainerWindow());
542 keyboard_controller->RemoveObserver(shelf()->shelf_layout_manager());
543 keyboard_controller->RemoveObserver(panel_layout_manager_);
544 }
545 }
546 }
547
542 548
543 //////////////////////////////////////////////////////////////////////////////// 549 ////////////////////////////////////////////////////////////////////////////////
544 // RootWindowController, private: 550 // RootWindowController, private:
545 551
546 void RootWindowController::InitLayoutManagers() { 552 void RootWindowController::InitLayoutManagers() {
547 root_window_layout_ = 553 root_window_layout_ =
548 new RootWindowLayoutManager(root_window_.get()); 554 new RootWindowLayoutManager(root_window_.get());
549 root_window_->SetLayoutManager(root_window_layout_); 555 root_window_->SetLayoutManager(root_window_layout_);
550 556
551 aura::Window* default_container = 557 aura::Window* default_container =
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 set_touch_hud_projection(new TouchHudProjection(root_window_.get())); 811 set_touch_hud_projection(new TouchHudProjection(root_window_.get()));
806 } 812 }
807 813
808 void RootWindowController::DisableTouchHudProjection() { 814 void RootWindowController::DisableTouchHudProjection() {
809 if (!touch_hud_projection_) 815 if (!touch_hud_projection_)
810 return; 816 return;
811 touch_hud_projection_->Remove(); 817 touch_hud_projection_->Remove();
812 } 818 }
813 819
814 void RootWindowController::OnLoginStateChanged(user::LoginStatus status) { 820 void RootWindowController::OnLoginStateChanged(user::LoginStatus status) {
815 if (status != user::LOGGED_IN_NONE)
816 InitKeyboard();
817 shelf_->shelf_layout_manager()->UpdateVisibilityState(); 821 shelf_->shelf_layout_manager()->UpdateVisibilityState();
818 } 822 }
819 823
820 void RootWindowController::OnTouchHudProjectionToggled(bool enabled) { 824 void RootWindowController::OnTouchHudProjectionToggled(bool enabled) {
821 if (enabled) 825 if (enabled)
822 EnableTouchHudProjection(); 826 EnableTouchHudProjection();
823 else 827 else
824 DisableTouchHudProjection(); 828 DisableTouchHudProjection();
825 } 829 }
826 830
827 RootWindowController* GetRootWindowController( 831 RootWindowController* GetRootWindowController(
828 const aura::RootWindow* root_window) { 832 const aura::RootWindow* root_window) {
829 return root_window ? GetRootWindowSettings(root_window)->controller : NULL; 833 return root_window ? GetRootWindowSettings(root_window)->controller : NULL;
830 } 834 }
831 835
832 } // namespace internal 836 } // namespace internal
833 } // namespace ash 837 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698