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

Side by Side Diff: ash/shell.cc

Issue 11017079: Remove Shell::shelf()|status_area_widget()|launcher() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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/shell.h" 5 #include "ash/shell.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "ash/accelerators/focus_manager_factory.h" 10 #include "ash/accelerators/focus_manager_factory.h"
(...skipping 18 matching lines...) Expand all
29 #include "ash/shell_factory.h" 29 #include "ash/shell_factory.h"
30 #include "ash/shell_window_ids.h" 30 #include "ash/shell_window_ids.h"
31 #include "ash/system/status_area_widget.h" 31 #include "ash/system/status_area_widget.h"
32 #include "ash/tooltips/tooltip_controller.h" 32 #include "ash/tooltips/tooltip_controller.h"
33 #include "ash/touch/touch_observer_hud.h" 33 #include "ash/touch/touch_observer_hud.h"
34 #include "ash/wm/activation_controller.h" 34 #include "ash/wm/activation_controller.h"
35 #include "ash/wm/always_on_top_controller.h" 35 #include "ash/wm/always_on_top_controller.h"
36 #include "ash/wm/app_list_controller.h" 36 #include "ash/wm/app_list_controller.h"
37 #include "ash/wm/base_layout_manager.h" 37 #include "ash/wm/base_layout_manager.h"
38 #include "ash/wm/capture_controller.h" 38 #include "ash/wm/capture_controller.h"
39 #include "ash/wm/coordinate_conversion.h"
39 #include "ash/wm/custom_frame_view_ash.h" 40 #include "ash/wm/custom_frame_view_ash.h"
40 #include "ash/wm/dialog_frame_view.h" 41 #include "ash/wm/dialog_frame_view.h"
41 #include "ash/wm/event_client_impl.h" 42 #include "ash/wm/event_client_impl.h"
42 #include "ash/wm/event_rewriter_event_filter.h" 43 #include "ash/wm/event_rewriter_event_filter.h"
43 #include "ash/wm/overlay_event_filter.h" 44 #include "ash/wm/overlay_event_filter.h"
44 #include "ash/wm/power_button_controller.h" 45 #include "ash/wm/power_button_controller.h"
45 #include "ash/wm/property_util.h" 46 #include "ash/wm/property_util.h"
46 #include "ash/wm/resize_shadow_controller.h" 47 #include "ash/wm/resize_shadow_controller.h"
47 #include "ash/wm/root_window_layout_manager.h" 48 #include "ash/wm/root_window_layout_manager.h"
48 #include "ash/wm/screen_dimmer.h" 49 #include "ash/wm/screen_dimmer.h"
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 aura::Env::GetInstance()->RemovePreTargetHandler(filter); 508 aura::Env::GetInstance()->RemovePreTargetHandler(filter);
508 } 509 }
509 510
510 void Shell::ShowContextMenu(const gfx::Point& location) { 511 void Shell::ShowContextMenu(const gfx::Point& location) {
511 // No context menus if user have not logged in. 512 // No context menus if user have not logged in.
512 if (!delegate_.get() || !delegate_->IsUserLoggedIn()) 513 if (!delegate_.get() || !delegate_->IsUserLoggedIn())
513 return; 514 return;
514 // No context menus when screen is locked. 515 // No context menus when screen is locked.
515 if (IsScreenLocked()) 516 if (IsScreenLocked())
516 return; 517 return;
517 if (launcher()) 518 aura::RootWindow* root =
518 launcher()->ShowContextMenu(location); 519 wm::GetRootWindowMatching(gfx::Rect(location, gfx::Size()));
520 Launcher::ForWindow(root)->ShowContextMenu(location);
519 } 521 }
520 522
521 void Shell::ToggleAppList() { 523 void Shell::ToggleAppList() {
522 if (!app_list_controller_.get()) 524 if (!app_list_controller_.get())
523 app_list_controller_.reset(new internal::AppListController); 525 app_list_controller_.reset(new internal::AppListController);
524 app_list_controller_->SetVisible(!app_list_controller_->IsVisible()); 526 app_list_controller_->SetVisible(!app_list_controller_->IsVisible());
525 } 527 }
526 528
527 bool Shell::GetAppListTargetVisibility() const { 529 bool Shell::GetAppListTargetVisibility() const {
528 return app_list_controller_.get() && 530 return app_list_controller_.get() &&
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 return; 574 return;
573 FOR_EACH_OBSERVER(ShellObserver, observers_, 575 FOR_EACH_OBSERVER(ShellObserver, observers_,
574 OnDisplayWorkAreaInsetsChanged()); 576 OnDisplayWorkAreaInsetsChanged());
575 } 577 }
576 578
577 void Shell::OnLoginStateChanged(user::LoginStatus status) { 579 void Shell::OnLoginStateChanged(user::LoginStatus status) {
578 FOR_EACH_OBSERVER(ShellObserver, observers_, OnLoginStateChanged(status)); 580 FOR_EACH_OBSERVER(ShellObserver, observers_, OnLoginStateChanged(status));
579 ash::Shell::GetInstance()->UpdateShelfVisibility(); 581 ash::Shell::GetInstance()->UpdateShelfVisibility();
580 } 582 }
581 583
584 void Shell::UpdateAfterLoginStatusChange(user::LoginStatus status) {
585 GetPrimaryRootWindowController()->status_area_widget()->
586 UpdateAfterLoginStatusChange(status);
587 }
588
582 void Shell::OnAppTerminating() { 589 void Shell::OnAppTerminating() {
583 FOR_EACH_OBSERVER(ShellObserver, observers_, OnAppTerminating()); 590 FOR_EACH_OBSERVER(ShellObserver, observers_, OnAppTerminating());
584 } 591 }
585 592
586 void Shell::OnLockStateChanged(bool locked) { 593 void Shell::OnLockStateChanged(bool locked) {
587 FOR_EACH_OBSERVER(ShellObserver, observers_, OnLockStateChanged(locked)); 594 FOR_EACH_OBSERVER(ShellObserver, observers_, OnLockStateChanged(locked));
588 } 595 }
589 596
590 void Shell::CreateLauncher() { 597 void Shell::CreateLauncher() {
591 GetPrimaryRootWindowController()->CreateLauncher(); 598 GetPrimaryRootWindowController()->CreateLauncher();
592 } 599 }
593 600
594 void Shell::ShowLauncher() { 601 void Shell::ShowLauncher() {
595 GetPrimaryRootWindowController()->ShowLauncher(); 602 GetPrimaryRootWindowController()->ShowLauncher();
596 } 603 }
597 604
598 void Shell::AddShellObserver(ShellObserver* observer) { 605 void Shell::AddShellObserver(ShellObserver* observer) {
599 observers_.AddObserver(observer); 606 observers_.AddObserver(observer);
600 } 607 }
601 608
602 void Shell::RemoveShellObserver(ShellObserver* observer) { 609 void Shell::RemoveShellObserver(ShellObserver* observer) {
603 observers_.RemoveObserver(observer); 610 observers_.RemoveObserver(observer);
604 } 611 }
605 612
606 Launcher* Shell::launcher() {
607 return GetPrimaryRootWindowController()->launcher();
608 }
609
610 void Shell::UpdateShelfVisibility() { 613 void Shell::UpdateShelfVisibility() {
614 // TODO(oshima): Update all root windows.
611 GetPrimaryRootWindowController()->UpdateShelfVisibility(); 615 GetPrimaryRootWindowController()->UpdateShelfVisibility();
612 } 616 }
613 617
614 void Shell::SetShelfAutoHideBehavior(ShelfAutoHideBehavior behavior) { 618 void Shell::SetShelfAutoHideBehavior(ShelfAutoHideBehavior behavior) {
615 GetPrimaryRootWindowController()->SetShelfAutoHideBehavior(behavior); 619 GetPrimaryRootWindowController()->SetShelfAutoHideBehavior(behavior);
616 } 620 }
617 621
618 ShelfAutoHideBehavior Shell::GetShelfAutoHideBehavior() const { 622 ShelfAutoHideBehavior Shell::GetShelfAutoHideBehavior() const {
619 return GetPrimaryRootWindowController()->GetShelfAutoHideBehavior(); 623 return GetPrimaryRootWindowController()->GetShelfAutoHideBehavior();
620 } 624 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 } 661 }
658 if (!activated) { 662 if (!activated) {
659 RemoveEnvEventFilter(modality_filter_.get()); 663 RemoveEnvEventFilter(modality_filter_.get());
660 modality_filter_.reset(); 664 modality_filter_.reset();
661 for (RootWindowControllerList::iterator iter = controllers.begin(); 665 for (RootWindowControllerList::iterator iter = controllers.begin();
662 iter != controllers.end(); ++iter) 666 iter != controllers.end(); ++iter)
663 (*iter)->GetSystemModalLayoutManager(removed)->DestroyModalBackground(); 667 (*iter)->GetSystemModalLayoutManager(removed)->DestroyModalBackground();
664 } 668 }
665 } 669 }
666 670
667 internal::ShelfLayoutManager* Shell::shelf() const { 671 WebNotificationTray* Shell::GetWebNotificationTray() {
668 return GetPrimaryRootWindowController()->shelf(); 672 return GetPrimaryRootWindowController()->status_area_widget()->
669 } 673 web_notification_tray();
670
671 internal::StatusAreaWidget* Shell::status_area_widget() const {
672 return GetPrimaryRootWindowController()->status_area_widget();
673 } 674 }
674 675
675 SystemTrayDelegate* Shell::tray_delegate() { 676 SystemTrayDelegate* Shell::tray_delegate() {
676 return status_area_widget() ? status_area_widget()->system_tray_delegate() : 677 // TODO(oshima): Decouple system tray and its delegate.
677 NULL; 678 internal::StatusAreaWidget* status_area_widget =
679 GetPrimaryRootWindowController()->status_area_widget();
680 return status_area_widget ? status_area_widget->system_tray_delegate() : NULL;
678 } 681 }
679 682
680 SystemTray* Shell::system_tray() { 683 SystemTray* Shell::system_tray() {
681 return status_area_widget() ? status_area_widget()->system_tray() : 684 internal::StatusAreaWidget* status_area_widget =
682 NULL; 685 GetPrimaryRootWindowController()->status_area_widget();
686 return status_area_widget ? status_area_widget->system_tray() : NULL;
683 } 687 }
684 688
685 void Shell::InitRootWindowForSecondaryDisplay(aura::RootWindow* root) { 689 void Shell::InitRootWindowForSecondaryDisplay(aura::RootWindow* root) {
686 root->set_focus_manager(focus_manager_.get()); 690 root->set_focus_manager(focus_manager_.get());
687 internal::RootWindowController* controller = 691 internal::RootWindowController* controller =
688 new internal::RootWindowController(root); 692 new internal::RootWindowController(root);
689 controller->CreateContainers(); 693 controller->CreateContainers();
690 InitRootWindowController(controller); 694 InitRootWindowController(controller);
691 controller->root_window_layout()->OnWindowResized(); 695 controller->root_window_layout()->OnWindowResized();
692 desktop_background_controller_->OnRootWindowAdded(root); 696 desktop_background_controller_->OnRootWindowAdded(root);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 iter != controllers.end(); ++iter) { 762 iter != controllers.end(); ++iter) {
759 if ((*iter)->GetSystemModalLayoutManager(window)-> 763 if ((*iter)->GetSystemModalLayoutManager(window)->
760 CanWindowReceiveEvents(window)) { 764 CanWindowReceiveEvents(window)) {
761 return true; 765 return true;
762 } 766 }
763 } 767 }
764 return false; 768 return false;
765 } 769 }
766 770
767 } // namespace ash 771 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698