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 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 return NULL; | 521 return NULL; |
522 } | 522 } |
523 | 523 |
524 void RootWindowController::ActivateKeyboard( | 524 void RootWindowController::ActivateKeyboard( |
525 keyboard::KeyboardController* keyboard_controller) { | 525 keyboard::KeyboardController* keyboard_controller) { |
526 if (!keyboard::IsKeyboardEnabled() || | 526 if (!keyboard::IsKeyboardEnabled() || |
527 GetContainer(kShellWindowId_VirtualKeyboardContainer)) { | 527 GetContainer(kShellWindowId_VirtualKeyboardContainer)) { |
528 return; | 528 return; |
529 } | 529 } |
530 DCHECK(keyboard_controller); | 530 DCHECK(keyboard_controller); |
531 keyboard_controller->AddObserver(shelf()->shelf_layout_manager()); | 531 if (!keyboard::IsKeyboardUsabilityTestEnabled()) { |
532 keyboard_controller->AddObserver(panel_layout_manager_); | 532 keyboard_controller->AddObserver(shelf()->shelf_layout_manager()); |
533 keyboard_controller->AddObserver(docked_layout_manager_); | 533 keyboard_controller->AddObserver(panel_layout_manager_); |
| 534 keyboard_controller->AddObserver(docked_layout_manager_); |
| 535 } |
534 aura::Window* parent = root_window(); | 536 aura::Window* parent = root_window(); |
535 aura::Window* keyboard_container = | 537 aura::Window* keyboard_container = |
536 keyboard_controller->GetContainerWindow(); | 538 keyboard_controller->GetContainerWindow(); |
537 keyboard_container->set_id(kShellWindowId_VirtualKeyboardContainer); | 539 keyboard_container->set_id(kShellWindowId_VirtualKeyboardContainer); |
538 parent->AddChild(keyboard_container); | 540 parent->AddChild(keyboard_container); |
539 // TODO(oshima): Bounds of keyboard container should be handled by | 541 // TODO(oshima): Bounds of keyboard container should be handled by |
540 // RootWindowLayoutManager. Remove this after fixed RootWindowLayoutManager. | 542 // RootWindowLayoutManager. Remove this after fixed RootWindowLayoutManager. |
541 keyboard_container->SetBounds(parent->bounds()); | 543 keyboard_container->SetBounds(parent->bounds()); |
542 } | 544 } |
543 | 545 |
544 void RootWindowController::DeactivateKeyboard( | 546 void RootWindowController::DeactivateKeyboard( |
545 keyboard::KeyboardController* keyboard_controller) { | 547 keyboard::KeyboardController* keyboard_controller) { |
546 if (!keyboard::IsKeyboardEnabled()) | 548 if (!keyboard::IsKeyboardEnabled()) |
547 return; | 549 return; |
548 | 550 |
549 DCHECK(keyboard_controller); | 551 DCHECK(keyboard_controller); |
550 aura::Window* keyboard_container = | 552 aura::Window* keyboard_container = |
551 keyboard_controller->GetContainerWindow(); | 553 keyboard_controller->GetContainerWindow(); |
552 if (keyboard_container->GetRootWindow() == root_window()) { | 554 if (keyboard_container->GetRootWindow() == root_window()) { |
553 root_window()->RemoveChild(keyboard_container); | 555 root_window()->RemoveChild(keyboard_container); |
554 keyboard_controller->RemoveObserver(shelf()->shelf_layout_manager()); | 556 if (!keyboard::IsKeyboardUsabilityTestEnabled()) { |
555 keyboard_controller->RemoveObserver(panel_layout_manager_); | 557 keyboard_controller->RemoveObserver(shelf()->shelf_layout_manager()); |
556 keyboard_controller->RemoveObserver(docked_layout_manager_); | 558 keyboard_controller->RemoveObserver(panel_layout_manager_); |
| 559 keyboard_controller->RemoveObserver(docked_layout_manager_); |
| 560 } |
557 } | 561 } |
558 } | 562 } |
559 | 563 |
560 | 564 |
561 //////////////////////////////////////////////////////////////////////////////// | 565 //////////////////////////////////////////////////////////////////////////////// |
562 // RootWindowController, private: | 566 // RootWindowController, private: |
563 | 567 |
564 RootWindowController::RootWindowController(aura::RootWindow* root_window) | 568 RootWindowController::RootWindowController(aura::RootWindow* root_window) |
565 : root_window_(root_window), | 569 : root_window_(root_window), |
566 root_window_layout_(NULL), | 570 root_window_layout_(NULL), |
567 docked_layout_manager_(NULL), | 571 docked_layout_manager_(NULL), |
568 panel_layout_manager_(NULL), | 572 panel_layout_manager_(NULL), |
569 touch_hud_debug_(NULL), | 573 touch_hud_debug_(NULL), |
570 touch_hud_projection_(NULL) { | 574 touch_hud_projection_(NULL) { |
571 GetRootWindowSettings(root_window_->window())->controller = this; | 575 GetRootWindowSettings(root_window_->window())->controller = this; |
572 screen_dimmer_.reset(new ScreenDimmer(root_window_->window())); | 576 screen_dimmer_.reset(new ScreenDimmer(root_window_->window())); |
573 | 577 |
574 stacking_controller_.reset(new StackingController); | 578 stacking_controller_.reset(new StackingController); |
575 aura::client::SetWindowTreeClient(root_window_->window(), | 579 aura::client::SetWindowTreeClient(root_window_->window(), |
576 stacking_controller_.get()); | 580 stacking_controller_.get()); |
577 capture_client_.reset( | 581 capture_client_.reset( |
578 new views::corewm::ScopedCaptureClient(root_window_->window())); | 582 new views::corewm::ScopedCaptureClient(root_window_->window())); |
579 } | 583 } |
580 | 584 |
581 void RootWindowController::Init(RootWindowType root_window_type, | 585 void RootWindowController::Init(RootWindowType root_window_type, |
582 bool first_run_after_boot) { | 586 bool first_run_after_boot) { |
583 Shell::GetInstance()->InitRootWindow(root_window()); | 587 Shell* shell = Shell::GetInstance(); |
| 588 shell->InitRootWindow(root_window()); |
584 | 589 |
585 root_window_->SetCursor(ui::kCursorPointer); | 590 root_window_->SetCursor(ui::kCursorPointer); |
586 CreateContainersInRootWindow(root_window_.get()); | 591 CreateContainersInRootWindow(root_window_.get()); |
587 | 592 |
588 if (root_window_type == VIRTUAL_KEYBOARD) | 593 if (root_window_type == VIRTUAL_KEYBOARD) { |
| 594 shell->InitKeyboard(); |
589 return; | 595 return; |
| 596 } |
590 | 597 |
591 CreateSystemBackground(first_run_after_boot); | 598 CreateSystemBackground(first_run_after_boot); |
592 | 599 |
593 InitLayoutManagers(); | 600 InitLayoutManagers(); |
594 InitTouchHuds(); | 601 InitTouchHuds(); |
595 | 602 |
596 if (Shell::GetPrimaryRootWindowController()-> | 603 if (Shell::GetPrimaryRootWindowController()-> |
597 GetSystemModalLayoutManager(NULL)->has_modal_background()) { | 604 GetSystemModalLayoutManager(NULL)->has_modal_background()) { |
598 GetSystemModalLayoutManager(NULL)->CreateModalBackground(); | 605 GetSystemModalLayoutManager(NULL)->CreateModalBackground(); |
599 } | 606 } |
600 | 607 |
601 Shell* shell = Shell::GetInstance(); | |
602 shell->AddShellObserver(this); | 608 shell->AddShellObserver(this); |
603 | 609 |
604 if (root_window_type == PRIMARY) { | 610 if (root_window_type == PRIMARY) { |
605 root_window_layout()->OnWindowResized(); | 611 root_window_layout()->OnWindowResized(); |
606 shell->InitKeyboard(this); | 612 if (!keyboard::IsKeyboardUsabilityTestEnabled()) |
| 613 shell->InitKeyboard(); |
607 } else { | 614 } else { |
608 root_window_layout()->OnWindowResized(); | 615 root_window_layout()->OnWindowResized(); |
609 shell->desktop_background_controller()->OnRootWindowAdded(root_window()); | 616 shell->desktop_background_controller()->OnRootWindowAdded(root_window()); |
610 shell->high_contrast_controller()->OnRootWindowAdded(root_window_.get()); | 617 shell->high_contrast_controller()->OnRootWindowAdded(root_window_.get()); |
611 root_window_->ShowRootWindow(); | 618 root_window_->ShowRootWindow(); |
612 | 619 |
613 // Create a launcher if a user is already logged. | 620 // Create a launcher if a user is already logged. |
614 if (shell->session_state_delegate()->NumberOfLoggedInUsers()) | 621 if (shell->session_state_delegate()->NumberOfLoggedInUsers()) |
615 shelf()->CreateLauncher(); | 622 shelf()->CreateLauncher(); |
616 } | 623 } |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
904 DisableTouchHudProjection(); | 911 DisableTouchHudProjection(); |
905 } | 912 } |
906 | 913 |
907 RootWindowController* GetRootWindowController( | 914 RootWindowController* GetRootWindowController( |
908 const aura::Window* root_window) { | 915 const aura::Window* root_window) { |
909 return root_window ? GetRootWindowSettings(root_window)->controller : NULL; | 916 return root_window ? GetRootWindowSettings(root_window)->controller : NULL; |
910 } | 917 } |
911 | 918 |
912 } // namespace internal | 919 } // namespace internal |
913 } // namespace ash | 920 } // namespace ash |
OLD | NEW |