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