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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
265 } | 265 } |
266 | 266 |
267 void RootWindowController::SetAnimatingWallpaperController( | 267 void RootWindowController::SetAnimatingWallpaperController( |
268 AnimatingDesktopController* controller) { | 268 AnimatingDesktopController* controller) { |
269 if (animating_wallpaper_controller_.get()) | 269 if (animating_wallpaper_controller_.get()) |
270 animating_wallpaper_controller_->StopAnimating(); | 270 animating_wallpaper_controller_->StopAnimating(); |
271 animating_wallpaper_controller_.reset(controller); | 271 animating_wallpaper_controller_.reset(controller); |
272 } | 272 } |
273 | 273 |
274 void RootWindowController::Shutdown() { | 274 void RootWindowController::Shutdown() { |
275 if (root_window_type_ == VIRTUAL_KEYBOARD) { | |
276 return; | |
277 } | |
oshima
2013/10/30 21:05:30
ditto
bshe
2013/10/31 16:45:44
Done.
| |
278 | |
275 Shell::GetInstance()->RemoveShellObserver(this); | 279 Shell::GetInstance()->RemoveShellObserver(this); |
276 | 280 |
277 if (animating_wallpaper_controller_.get()) | 281 if (animating_wallpaper_controller_.get()) |
278 animating_wallpaper_controller_->StopAnimating(); | 282 animating_wallpaper_controller_->StopAnimating(); |
279 wallpaper_controller_.reset(); | 283 wallpaper_controller_.reset(); |
280 animating_wallpaper_controller_.reset(); | 284 animating_wallpaper_controller_.reset(); |
281 | 285 |
282 // Change the target root window before closing child windows. If any child | 286 // Change the target root window before closing child windows. If any child |
283 // being removed triggers a relayout of the shelf it will try to build a | 287 // being removed triggers a relayout of the shelf it will try to build a |
284 // window list adding windows from the target root window's containers which | 288 // window list adding windows from the target root window's containers which |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
521 return NULL; | 525 return NULL; |
522 } | 526 } |
523 | 527 |
524 void RootWindowController::ActivateKeyboard( | 528 void RootWindowController::ActivateKeyboard( |
525 keyboard::KeyboardController* keyboard_controller) { | 529 keyboard::KeyboardController* keyboard_controller) { |
526 if (!keyboard::IsKeyboardEnabled() || | 530 if (!keyboard::IsKeyboardEnabled() || |
527 GetContainer(kShellWindowId_VirtualKeyboardContainer)) { | 531 GetContainer(kShellWindowId_VirtualKeyboardContainer)) { |
528 return; | 532 return; |
529 } | 533 } |
530 DCHECK(keyboard_controller); | 534 DCHECK(keyboard_controller); |
531 keyboard_controller->AddObserver(shelf()->shelf_layout_manager()); | 535 if (!keyboard::IsKeyboardUsabilityTestEnabled()) { |
532 keyboard_controller->AddObserver(panel_layout_manager_); | 536 keyboard_controller->AddObserver(shelf()->shelf_layout_manager()); |
533 keyboard_controller->AddObserver(docked_layout_manager_); | 537 keyboard_controller->AddObserver(panel_layout_manager_); |
538 keyboard_controller->AddObserver(docked_layout_manager_); | |
539 } | |
534 aura::Window* parent = root_window(); | 540 aura::Window* parent = root_window(); |
535 aura::Window* keyboard_container = | 541 aura::Window* keyboard_container = |
536 keyboard_controller->GetContainerWindow(); | 542 keyboard_controller->GetContainerWindow(); |
537 keyboard_container->set_id(kShellWindowId_VirtualKeyboardContainer); | 543 keyboard_container->set_id(kShellWindowId_VirtualKeyboardContainer); |
538 parent->AddChild(keyboard_container); | 544 parent->AddChild(keyboard_container); |
539 // TODO(oshima): Bounds of keyboard container should be handled by | 545 // TODO(oshima): Bounds of keyboard container should be handled by |
540 // RootWindowLayoutManager. Remove this after fixed RootWindowLayoutManager. | 546 // RootWindowLayoutManager. Remove this after fixed RootWindowLayoutManager. |
541 keyboard_container->SetBounds(parent->bounds()); | 547 keyboard_container->SetBounds(parent->bounds()); |
542 } | 548 } |
543 | 549 |
544 void RootWindowController::DeactivateKeyboard( | 550 void RootWindowController::DeactivateKeyboard( |
545 keyboard::KeyboardController* keyboard_controller) { | 551 keyboard::KeyboardController* keyboard_controller) { |
546 if (!keyboard::IsKeyboardEnabled()) | 552 if (!keyboard::IsKeyboardEnabled()) |
547 return; | 553 return; |
548 | 554 |
549 DCHECK(keyboard_controller); | 555 DCHECK(keyboard_controller); |
550 aura::Window* keyboard_container = | 556 aura::Window* keyboard_container = |
551 keyboard_controller->GetContainerWindow(); | 557 keyboard_controller->GetContainerWindow(); |
552 if (keyboard_container->GetRootWindow() == root_window()) { | 558 if (keyboard_container->GetRootWindow() == root_window()) { |
553 root_window()->RemoveChild(keyboard_container); | 559 root_window()->RemoveChild(keyboard_container); |
554 keyboard_controller->RemoveObserver(shelf()->shelf_layout_manager()); | 560 if (!keyboard::IsKeyboardUsabilityTestEnabled()) { |
555 keyboard_controller->RemoveObserver(panel_layout_manager_); | 561 keyboard_controller->RemoveObserver(shelf()->shelf_layout_manager()); |
556 keyboard_controller->RemoveObserver(docked_layout_manager_); | 562 keyboard_controller->RemoveObserver(panel_layout_manager_); |
563 keyboard_controller->RemoveObserver(docked_layout_manager_); | |
564 } | |
557 } | 565 } |
558 } | 566 } |
559 | 567 |
560 | 568 |
561 //////////////////////////////////////////////////////////////////////////////// | 569 //////////////////////////////////////////////////////////////////////////////// |
562 // RootWindowController, private: | 570 // RootWindowController, private: |
563 | 571 |
564 RootWindowController::RootWindowController(aura::RootWindow* root_window) | 572 RootWindowController::RootWindowController(aura::RootWindow* root_window) |
565 : root_window_(root_window), | 573 : root_window_(root_window), |
566 root_window_layout_(NULL), | 574 root_window_layout_(NULL), |
567 docked_layout_manager_(NULL), | 575 docked_layout_manager_(NULL), |
568 panel_layout_manager_(NULL), | 576 panel_layout_manager_(NULL), |
569 touch_hud_debug_(NULL), | 577 touch_hud_debug_(NULL), |
570 touch_hud_projection_(NULL) { | 578 touch_hud_projection_(NULL) { |
571 GetRootWindowSettings(root_window)->controller = this; | 579 GetRootWindowSettings(root_window)->controller = this; |
572 screen_dimmer_.reset(new ScreenDimmer(root_window)); | 580 screen_dimmer_.reset(new ScreenDimmer(root_window)); |
573 | 581 |
574 stacking_controller_.reset(new StackingController); | 582 stacking_controller_.reset(new StackingController); |
575 aura::client::SetWindowTreeClient(root_window, stacking_controller_.get()); | 583 aura::client::SetWindowTreeClient(root_window, stacking_controller_.get()); |
576 capture_client_.reset(new views::corewm::ScopedCaptureClient(root_window)); | 584 capture_client_.reset(new views::corewm::ScopedCaptureClient(root_window)); |
577 } | 585 } |
578 | 586 |
579 void RootWindowController::Init(RootWindowType root_window_type, | 587 void RootWindowController::Init(RootWindowType root_window_type, |
580 bool first_run_after_boot) { | 588 bool first_run_after_boot) { |
581 Shell::GetInstance()->InitRootWindow(root_window_.get()); | 589 Shell* shell = Shell::GetInstance(); |
590 root_window_type_ = root_window_type; | |
591 shell->InitRootWindow(root_window_.get()); | |
582 | 592 |
583 root_window_->SetCursor(ui::kCursorPointer); | 593 root_window_->SetCursor(ui::kCursorPointer); |
584 CreateContainersInRootWindow(root_window_.get()); | 594 CreateContainersInRootWindow(root_window_.get()); |
585 | 595 |
586 if (root_window_type == VIRTUAL_KEYBOARD) | 596 if (root_window_type == VIRTUAL_KEYBOARD) { |
597 shell->InitKeyboard(this); | |
587 return; | 598 return; |
599 } | |
588 | 600 |
589 CreateSystemBackground(first_run_after_boot); | 601 CreateSystemBackground(first_run_after_boot); |
590 | 602 |
591 InitLayoutManagers(); | 603 InitLayoutManagers(); |
592 InitTouchHuds(); | 604 InitTouchHuds(); |
593 | 605 |
594 if (Shell::GetPrimaryRootWindowController()-> | 606 if (Shell::GetPrimaryRootWindowController()-> |
595 GetSystemModalLayoutManager(NULL)->has_modal_background()) { | 607 GetSystemModalLayoutManager(NULL)->has_modal_background()) { |
596 GetSystemModalLayoutManager(NULL)->CreateModalBackground(); | 608 GetSystemModalLayoutManager(NULL)->CreateModalBackground(); |
597 } | 609 } |
598 | 610 |
599 Shell* shell = Shell::GetInstance(); | |
600 shell->AddShellObserver(this); | 611 shell->AddShellObserver(this); |
601 | 612 |
602 if (root_window_type == PRIMARY) { | 613 if (root_window_type == PRIMARY) { |
603 root_window_layout()->OnWindowResized(); | 614 root_window_layout()->OnWindowResized(); |
604 shell->InitKeyboard(this); | 615 if (!keyboard::IsKeyboardUsabilityTestEnabled()) { |
616 shell->InitKeyboard(this); | |
617 } | |
oshima
2013/10/30 21:05:30
nuke {}
bshe
2013/10/31 16:45:44
Done.
| |
605 } else { | 618 } else { |
606 root_window_layout()->OnWindowResized(); | 619 root_window_layout()->OnWindowResized(); |
607 shell->desktop_background_controller()->OnRootWindowAdded( | 620 shell->desktop_background_controller()->OnRootWindowAdded( |
608 root_window_.get()); | 621 root_window_.get()); |
609 shell->high_contrast_controller()->OnRootWindowAdded(root_window_.get()); | 622 shell->high_contrast_controller()->OnRootWindowAdded(root_window_.get()); |
610 root_window_->ShowRootWindow(); | 623 root_window_->ShowRootWindow(); |
611 // Activate new root for testing. | 624 // Activate new root for testing. |
612 // TODO(oshima): remove this. | 625 // TODO(oshima): remove this. |
613 shell->set_target_root_window(root_window_.get()); | 626 shell->set_target_root_window(root_window_.get()); |
614 | 627 |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
907 DisableTouchHudProjection(); | 920 DisableTouchHudProjection(); |
908 } | 921 } |
909 | 922 |
910 RootWindowController* GetRootWindowController( | 923 RootWindowController* GetRootWindowController( |
911 const aura::Window* root_window) { | 924 const aura::Window* root_window) { |
912 return root_window ? GetRootWindowSettings(root_window)->controller : NULL; | 925 return root_window ? GetRootWindowSettings(root_window)->controller : NULL; |
913 } | 926 } |
914 | 927 |
915 } // namespace internal | 928 } // namespace internal |
916 } // namespace ash | 929 } // namespace ash |
OLD | NEW |