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

Side by Side Diff: ash/shell.cc

Issue 10442017: Rename GetRootWindow() -> GetPrimaryRootWindow() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: git-try -b linux_chromeos,win_aura Created 8 years, 7 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
« no previous file with comments | « ash/shell.h ('k') | ash/shell/content_client/shell_browser_main_parts.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 #endif 565 #endif
566 if (touch_observer_hud_.get()) 566 if (touch_observer_hud_.get())
567 RemoveRootWindowEventFilter(touch_observer_hud_.get()); 567 RemoveRootWindowEventFilter(touch_observer_hud_.get());
568 568
569 // Close background widget now so that the focus manager of the 569 // Close background widget now so that the focus manager of the
570 // widget gets deleted in the final message loop run. 570 // widget gets deleted in the final message loop run.
571 root_window_layout_->SetBackgroundWidget(NULL); 571 root_window_layout_->SetBackgroundWidget(NULL);
572 572
573 // TooltipController is deleted with the Shell so removing its references. 573 // TooltipController is deleted with the Shell so removing its references.
574 RemoveRootWindowEventFilter(tooltip_controller_.get()); 574 RemoveRootWindowEventFilter(tooltip_controller_.get());
575 aura::client::SetTooltipClient(GetRootWindow(), NULL); 575 aura::client::SetTooltipClient(GetPrimaryRootWindow(), NULL);
576 576
577 // Make sure we delete WorkspaceController before launcher is 577 // Make sure we delete WorkspaceController before launcher is
578 // deleted as it has a reference to launcher model. 578 // deleted as it has a reference to launcher model.
579 workspace_controller_.reset(); 579 workspace_controller_.reset();
580 580
581 // The system tray needs to be reset before all the windows are destroyed. 581 // The system tray needs to be reset before all the windows are destroyed.
582 tray_.reset(); 582 tray_.reset();
583 tray_delegate_.reset(); 583 tray_delegate_.reset();
584 584
585 // Desroy secondary monitor's widgets before all the windows are destroyed. 585 // Desroy secondary monitor's widgets before all the windows are destroyed.
586 monitor_controller_.reset(); 586 monitor_controller_.reset();
587 587
588 // Delete containers now so that child windows does not access 588 // Delete containers now so that child windows does not access
589 // observers when they are destructed. 589 // observers when they are destructed.
590 aura::RootWindow* root_window = GetRootWindow(); 590 aura::RootWindow* root_window = GetPrimaryRootWindow();
591 while (!root_window->children().empty()) { 591 while (!root_window->children().empty()) {
592 aura::Window* child = root_window->children()[0]; 592 aura::Window* child = root_window->children()[0];
593 delete child; 593 delete child;
594 } 594 }
595 595
596 // These need a valid Shell instance to clean up properly, so explicitly 596 // These need a valid Shell instance to clean up properly, so explicitly
597 // delete them before invalidating the instance. 597 // delete them before invalidating the instance.
598 // Alphabetical. 598 // Alphabetical.
599 activation_controller_.reset(); 599 activation_controller_.reset();
600 drag_drop_controller_.reset(); 600 drag_drop_controller_.reset();
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 return !!instance_; 640 return !!instance_;
641 } 641 }
642 642
643 // static 643 // static
644 void Shell::DeleteInstance() { 644 void Shell::DeleteInstance() {
645 delete instance_; 645 delete instance_;
646 instance_ = NULL; 646 instance_ = NULL;
647 } 647 }
648 648
649 // static 649 // static
650 aura::RootWindow* Shell::GetRootWindow() { 650 aura::RootWindow* Shell::GetPrimaryRootWindow() {
651 return GetInstance()->root_window_.get(); 651 return GetInstance()->root_window_.get();
652 } 652 }
653 653
654 void Shell::Init() { 654 void Shell::Init() {
655 // Install the custom factory first so that views::FocusManagers for Tray, 655 // Install the custom factory first so that views::FocusManagers for Tray,
656 // Launcher, and WallPaper could be created by the factory. 656 // Launcher, and WallPaper could be created by the factory.
657 views::FocusManagerFactory::Install(new AshFocusManagerFactory); 657 views::FocusManagerFactory::Install(new AshFocusManagerFactory);
658 658
659 aura::RootWindow* root_window = GetRootWindow(); 659 aura::RootWindow* root_window = GetPrimaryRootWindow();
660 root_filter_ = new aura::shared::RootWindowEventFilter(root_window); 660 root_filter_ = new aura::shared::RootWindowEventFilter(root_window);
661 #if !defined(OS_MACOSX) 661 #if !defined(OS_MACOSX)
662 nested_dispatcher_controller_.reset(new NestedDispatcherController); 662 nested_dispatcher_controller_.reset(new NestedDispatcherController);
663 accelerator_controller_.reset(new AcceleratorController); 663 accelerator_controller_.reset(new AcceleratorController);
664 #endif 664 #endif
665 shell_context_menu_.reset(new internal::ShellContextMenu); 665 shell_context_menu_.reset(new internal::ShellContextMenu);
666 // Pass ownership of the filter to the root window. 666 // Pass ownership of the filter to the root window.
667 GetRootWindow()->SetEventFilter(root_filter_); 667 GetPrimaryRootWindow()->SetEventFilter(root_filter_);
668 668
669 // KeyRewriterEventFilter must be the first one. 669 // KeyRewriterEventFilter must be the first one.
670 DCHECK(!GetRootWindowEventFilterCount()); 670 DCHECK(!GetRootWindowEventFilterCount());
671 key_rewriter_filter_.reset(new internal::KeyRewriterEventFilter); 671 key_rewriter_filter_.reset(new internal::KeyRewriterEventFilter);
672 AddRootWindowEventFilter(key_rewriter_filter_.get()); 672 AddRootWindowEventFilter(key_rewriter_filter_.get());
673 673
674 // PartialScreenshotEventFilter must be the second one to capture key 674 // PartialScreenshotEventFilter must be the second one to capture key
675 // events when the taking partial screenshot UI is there. 675 // events when the taking partial screenshot UI is there.
676 DCHECK_EQ(1U, GetRootWindowEventFilterCount()); 676 DCHECK_EQ(1U, GetRootWindowEventFilterCount());
677 partial_screenshot_filter_.reset(new internal::PartialScreenshotEventFilter); 677 partial_screenshot_filter_.reset(new internal::PartialScreenshotEventFilter);
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 monitor_controller_.reset(new internal::MonitorController); 767 monitor_controller_.reset(new internal::MonitorController);
768 screen_dimmer_.reset(new internal::ScreenDimmer); 768 screen_dimmer_.reset(new internal::ScreenDimmer);
769 } 769 }
770 770
771 aura::Window* Shell::GetContainer(int container_id) { 771 aura::Window* Shell::GetContainer(int container_id) {
772 return const_cast<aura::Window*>( 772 return const_cast<aura::Window*>(
773 const_cast<const Shell*>(this)->GetContainer(container_id)); 773 const_cast<const Shell*>(this)->GetContainer(container_id));
774 } 774 }
775 775
776 const aura::Window* Shell::GetContainer(int container_id) const { 776 const aura::Window* Shell::GetContainer(int container_id) const {
777 return GetRootWindow()->GetChildById(container_id); 777 return GetPrimaryRootWindow()->GetChildById(container_id);
778 } 778 }
779 779
780 void Shell::AddRootWindowEventFilter(aura::EventFilter* filter) { 780 void Shell::AddRootWindowEventFilter(aura::EventFilter* filter) {
781 static_cast<aura::shared::RootWindowEventFilter*>( 781 static_cast<aura::shared::RootWindowEventFilter*>(
782 GetRootWindow()->event_filter())->AddFilter(filter); 782 GetPrimaryRootWindow()->event_filter())->AddFilter(filter);
783 } 783 }
784 784
785 void Shell::RemoveRootWindowEventFilter(aura::EventFilter* filter) { 785 void Shell::RemoveRootWindowEventFilter(aura::EventFilter* filter) {
786 static_cast<aura::shared::RootWindowEventFilter*>( 786 static_cast<aura::shared::RootWindowEventFilter*>(
787 GetRootWindow()->event_filter())->RemoveFilter(filter); 787 GetPrimaryRootWindow()->event_filter())->RemoveFilter(filter);
788 } 788 }
789 789
790 size_t Shell::GetRootWindowEventFilterCount() const { 790 size_t Shell::GetRootWindowEventFilterCount() const {
791 return static_cast<aura::shared::RootWindowEventFilter*>( 791 return static_cast<aura::shared::RootWindowEventFilter*>(
792 GetRootWindow()->event_filter())->GetFilterCount(); 792 GetPrimaryRootWindow()->event_filter())->GetFilterCount();
793 } 793 }
794 794
795 void Shell::ShowBackgroundMenu(views::Widget* widget, 795 void Shell::ShowBackgroundMenu(views::Widget* widget,
796 const gfx::Point& location) { 796 const gfx::Point& location) {
797 if (shell_context_menu_.get()) 797 if (shell_context_menu_.get())
798 shell_context_menu_->ShowMenu(widget, location); 798 shell_context_menu_->ShowMenu(widget, location);
799 } 799 }
800 800
801 void Shell::ToggleAppList() { 801 void Shell::ToggleAppList() {
802 if (!app_list_controller_.get()) 802 if (!app_list_controller_.get())
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
962 panel_container->SetLayoutManager(panel_layout_manager_); 962 panel_container->SetLayoutManager(panel_layout_manager_);
963 } 963 }
964 } 964 }
965 965
966 void Shell::DisableWorkspaceGridLayout() { 966 void Shell::DisableWorkspaceGridLayout() {
967 if (workspace_controller_.get()) 967 if (workspace_controller_.get())
968 workspace_controller_->workspace_manager()->set_grid_size(0); 968 workspace_controller_->workspace_manager()->set_grid_size(0);
969 } 969 }
970 970
971 } // namespace ash 971 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shell.h ('k') | ash/shell/content_client/shell_browser_main_parts.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698