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

Side by Side Diff: ash/shell.cc

Issue 14297013: Cleanup: Remove unnecessary ".get()" from scoped_ptrs<>. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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/shelf/shelf_widget.cc ('k') | ash/system/tray/system_tray.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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 // See bug crbug.com/134502. 238 // See bug crbug.com/134502.
239 if (active_root_window_) 239 if (active_root_window_)
240 aura::client::GetFocusClient(active_root_window_)->FocusWindow(NULL); 240 aura::client::GetFocusClient(active_root_window_)->FocusWindow(NULL);
241 241
242 // Please keep in same order as in Init() because it's easy to miss one. 242 // Please keep in same order as in Init() because it's easy to miss one.
243 RemovePreTargetHandler(user_activity_detector_.get()); 243 RemovePreTargetHandler(user_activity_detector_.get());
244 RemovePreTargetHandler(event_rewriter_filter_.get()); 244 RemovePreTargetHandler(event_rewriter_filter_.get());
245 RemovePreTargetHandler(overlay_filter_.get()); 245 RemovePreTargetHandler(overlay_filter_.get());
246 RemovePreTargetHandler(input_method_filter_.get()); 246 RemovePreTargetHandler(input_method_filter_.get());
247 RemovePreTargetHandler(window_modality_controller_.get()); 247 RemovePreTargetHandler(window_modality_controller_.get());
248 if (mouse_cursor_filter_.get()) 248 if (mouse_cursor_filter_)
249 RemovePreTargetHandler(mouse_cursor_filter_.get()); 249 RemovePreTargetHandler(mouse_cursor_filter_.get());
250 RemovePreTargetHandler(system_gesture_filter_.get()); 250 RemovePreTargetHandler(system_gesture_filter_.get());
251 #if !defined(OS_MACOSX) 251 #if !defined(OS_MACOSX)
252 RemovePreTargetHandler(accelerator_filter_.get()); 252 RemovePreTargetHandler(accelerator_filter_.get());
253 #endif 253 #endif
254 254
255 // TooltipController is deleted with the Shell so removing its references. 255 // TooltipController is deleted with the Shell so removing its references.
256 RemovePreTargetHandler(tooltip_controller_.get()); 256 RemovePreTargetHandler(tooltip_controller_.get());
257 257
258 // AppList needs to be released before shelf layout manager, which is 258 // AppList needs to be released before shelf layout manager, which is
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 // of its owned RootWindowControllers relies on the value. 298 // of its owned RootWindowControllers relies on the value.
299 display_controller_->Shutdown(); 299 display_controller_->Shutdown();
300 display_controller_.reset(); 300 display_controller_.reset();
301 screen_position_controller_.reset(); 301 screen_position_controller_.reset();
302 302
303 // Delete the activation controller after other controllers and launcher 303 // Delete the activation controller after other controllers and launcher
304 // because they might have registered ActivationChangeObserver. 304 // because they might have registered ActivationChangeObserver.
305 activation_controller_.reset(); 305 activation_controller_.reset();
306 306
307 #if defined(OS_CHROMEOS) 307 #if defined(OS_CHROMEOS)
308 if (display_change_observer_.get()) 308 if (display_change_observer_)
309 output_configurator_->RemoveObserver(display_change_observer_.get()); 309 output_configurator_->RemoveObserver(display_change_observer_.get());
310 if (output_configurator_animation_.get()) 310 if (output_configurator_animation_)
311 output_configurator_->RemoveObserver(output_configurator_animation_.get()); 311 output_configurator_->RemoveObserver(output_configurator_animation_.get());
312 if (display_error_observer_.get()) 312 if (display_error_observer_)
313 output_configurator_->RemoveObserver(display_error_observer_.get()); 313 output_configurator_->RemoveObserver(display_error_observer_.get());
314 base::MessagePumpAuraX11::Current()->RemoveDispatcherForRootWindow( 314 base::MessagePumpAuraX11::Current()->RemoveDispatcherForRootWindow(
315 output_configurator()); 315 output_configurator());
316 #endif // defined(OS_CHROMEOS) 316 #endif // defined(OS_CHROMEOS)
317 317
318 DCHECK(instance_ == this); 318 DCHECK(instance_ == this);
319 instance_ = NULL; 319 instance_ = NULL;
320 } 320 }
321 321
322 // static 322 // static
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 gfx::SCREEN_TYPE_ALTERNATE)); 546 gfx::SCREEN_TYPE_ALTERNATE));
547 AddPreTargetHandler(tooltip_controller_.get()); 547 AddPreTargetHandler(tooltip_controller_.get());
548 548
549 event_client_.reset(new internal::EventClientImpl); 549 event_client_.reset(new internal::EventClientImpl);
550 550
551 InitRootWindowController(root_window_controller); 551 InitRootWindowController(root_window_controller);
552 552
553 // This controller needs to be set before SetupManagedWindowMode. 553 // This controller needs to be set before SetupManagedWindowMode.
554 desktop_background_controller_.reset(new DesktopBackgroundController()); 554 desktop_background_controller_.reset(new DesktopBackgroundController());
555 user_wallpaper_delegate_.reset(delegate_->CreateUserWallpaperDelegate()); 555 user_wallpaper_delegate_.reset(delegate_->CreateUserWallpaperDelegate());
556 if (!user_wallpaper_delegate_.get()) 556 if (!user_wallpaper_delegate_)
557 user_wallpaper_delegate_.reset(new DummyUserWallpaperDelegate()); 557 user_wallpaper_delegate_.reset(new DummyUserWallpaperDelegate());
558 558
559 // StatusAreaWidget uses Shell's CapsLockDelegate. 559 // StatusAreaWidget uses Shell's CapsLockDelegate.
560 caps_lock_delegate_.reset(delegate_->CreateCapsLockDelegate()); 560 caps_lock_delegate_.reset(delegate_->CreateCapsLockDelegate());
561 561
562 if (!command_line->HasSwitch(views::corewm::switches::kNoDropShadows)) { 562 if (!command_line->HasSwitch(views::corewm::switches::kNoDropShadows)) {
563 resize_shadow_controller_.reset(new internal::ResizeShadowController()); 563 resize_shadow_controller_.reset(new internal::ResizeShadowController());
564 shadow_controller_.reset( 564 shadow_controller_.reset(
565 new views::corewm::ShadowController(activation_client_)); 565 new views::corewm::ShadowController(activation_client_));
566 } 566 }
567 567
568 // Create system_tray_notifier_ before the delegate. 568 // Create system_tray_notifier_ before the delegate.
569 system_tray_notifier_.reset(new ash::SystemTrayNotifier()); 569 system_tray_notifier_.reset(new ash::SystemTrayNotifier());
570 570
571 // Initialize system_tray_delegate_ before initializing StatusAreaWidget. 571 // Initialize system_tray_delegate_ before initializing StatusAreaWidget.
572 system_tray_delegate_.reset(delegate()->CreateSystemTrayDelegate()); 572 system_tray_delegate_.reset(delegate()->CreateSystemTrayDelegate());
573 if (!system_tray_delegate_.get()) 573 if (!system_tray_delegate_)
574 system_tray_delegate_.reset(SystemTrayDelegate::CreateDummyDelegate()); 574 system_tray_delegate_.reset(SystemTrayDelegate::CreateDummyDelegate());
575 575
576 // Creates StatusAreaWidget. 576 // Creates StatusAreaWidget.
577 root_window_controller->InitForPrimaryDisplay(); 577 root_window_controller->InitForPrimaryDisplay();
578 578
579 // Initialize system_tray_delegate_ after StatusAreaWidget is created. 579 // Initialize system_tray_delegate_ after StatusAreaWidget is created.
580 system_tray_delegate_->Initialize(); 580 system_tray_delegate_->Initialize();
581 581
582 display_controller_->InitSecondaryDisplays(); 582 display_controller_->InitSecondaryDisplays();
583 583
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 CHECK(rwc) << "root=" << root 619 CHECK(rwc) << "root=" << root
620 << ", location:" << location_in_screen.ToString(); 620 << ", location:" << location_in_screen.ToString();
621 if (rwc) 621 if (rwc)
622 rwc->ShowContextMenu(location_in_screen); 622 rwc->ShowContextMenu(location_in_screen);
623 } 623 }
624 624
625 void Shell::ToggleAppList(aura::Window* window) { 625 void Shell::ToggleAppList(aura::Window* window) {
626 // If the context window is not given, show it on the active root window. 626 // If the context window is not given, show it on the active root window.
627 if (!window) 627 if (!window)
628 window = GetActiveRootWindow(); 628 window = GetActiveRootWindow();
629 if (!app_list_controller_.get()) 629 if (!app_list_controller_)
630 app_list_controller_.reset(new internal::AppListController); 630 app_list_controller_.reset(new internal::AppListController);
631 app_list_controller_->SetVisible(!app_list_controller_->IsVisible(), window); 631 app_list_controller_->SetVisible(!app_list_controller_->IsVisible(), window);
632 } 632 }
633 633
634 bool Shell::GetAppListTargetVisibility() const { 634 bool Shell::GetAppListTargetVisibility() const {
635 return app_list_controller_.get() && 635 return app_list_controller_.get() &&
636 app_list_controller_->GetTargetVisibility(); 636 app_list_controller_->GetTargetVisibility();
637 } 637 }
638 638
639 aura::Window* Shell::GetAppListWindow() { 639 aura::Window* Shell::GetAppListWindow() {
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 } 778 }
779 779
780 void Shell::SetDimming(bool should_dim) { 780 void Shell::SetDimming(bool should_dim) {
781 RootWindowControllerList controllers = GetAllRootWindowControllers(); 781 RootWindowControllerList controllers = GetAllRootWindowControllers();
782 for (RootWindowControllerList::iterator iter = controllers.begin(); 782 for (RootWindowControllerList::iterator iter = controllers.begin();
783 iter != controllers.end(); ++iter) 783 iter != controllers.end(); ++iter)
784 (*iter)->screen_dimmer()->SetDimming(should_dim); 784 (*iter)->screen_dimmer()->SetDimming(should_dim);
785 } 785 }
786 786
787 void Shell::CreateModalBackground(aura::Window* window) { 787 void Shell::CreateModalBackground(aura::Window* window) {
788 if (!modality_filter_.get()) { 788 if (!modality_filter_) {
789 modality_filter_.reset(new internal::SystemModalContainerEventFilter(this)); 789 modality_filter_.reset(new internal::SystemModalContainerEventFilter(this));
790 AddPreTargetHandler(modality_filter_.get()); 790 AddPreTargetHandler(modality_filter_.get());
791 } 791 }
792 RootWindowControllerList controllers = GetAllRootWindowControllers(); 792 RootWindowControllerList controllers = GetAllRootWindowControllers();
793 for (RootWindowControllerList::iterator iter = controllers.begin(); 793 for (RootWindowControllerList::iterator iter = controllers.begin();
794 iter != controllers.end(); ++iter) 794 iter != controllers.end(); ++iter)
795 (*iter)->GetSystemModalLayoutManager(window)->CreateModalBackground(); 795 (*iter)->GetSystemModalLayoutManager(window)->CreateModalBackground();
796 } 796 }
797 797
798 void Shell::OnModalWindowRemoved(aura::Window* removed) { 798 void Shell::OnModalWindowRemoved(aura::Window* removed) {
(...skipping 21 matching lines...) Expand all
820 bool Shell::HasPrimaryStatusArea() { 820 bool Shell::HasPrimaryStatusArea() {
821 ShelfWidget* shelf = GetPrimaryRootWindowController()->shelf(); 821 ShelfWidget* shelf = GetPrimaryRootWindowController()->shelf();
822 return shelf && shelf->status_area_widget(); 822 return shelf && shelf->status_area_widget();
823 } 823 }
824 824
825 SystemTray* Shell::GetPrimarySystemTray() { 825 SystemTray* Shell::GetPrimarySystemTray() {
826 return GetPrimaryRootWindowController()->GetSystemTray(); 826 return GetPrimaryRootWindowController()->GetSystemTray();
827 } 827 }
828 828
829 LauncherDelegate* Shell::GetLauncherDelegate() { 829 LauncherDelegate* Shell::GetLauncherDelegate() {
830 if (!launcher_delegate_.get()) { 830 if (!launcher_delegate_) {
831 launcher_model_.reset(new LauncherModel); 831 launcher_model_.reset(new LauncherModel);
832 launcher_delegate_.reset( 832 launcher_delegate_.reset(
833 delegate_->CreateLauncherDelegate(launcher_model_.get())); 833 delegate_->CreateLauncherDelegate(launcher_model_.get()));
834 } 834 }
835 return launcher_delegate_.get(); 835 return launcher_delegate_.get();
836 } 836 }
837 837
838 void Shell::InitRootWindowForSecondaryDisplay(aura::RootWindow* root) { 838 void Shell::InitRootWindowForSecondaryDisplay(aura::RootWindow* root) {
839 aura::client::SetFocusClient(root, focus_client_.get()); 839 aura::client::SetFocusClient(root, focus_client_.get());
840 internal::RootWindowController* controller = 840 internal::RootWindowController* controller =
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 } 879 }
880 aura::client::SetVisibilityClient(root_window, visibility_controller_.get()); 880 aura::client::SetVisibilityClient(root_window, visibility_controller_.get());
881 aura::client::SetDragDropClient(root_window, drag_drop_controller_.get()); 881 aura::client::SetDragDropClient(root_window, drag_drop_controller_.get());
882 aura::client::SetCaptureClient(root_window, capture_controller_.get()); 882 aura::client::SetCaptureClient(root_window, capture_controller_.get());
883 aura::client::SetScreenPositionClient(root_window, 883 aura::client::SetScreenPositionClient(root_window,
884 screen_position_controller_.get()); 884 screen_position_controller_.get());
885 aura::client::SetCursorClient(root_window, &cursor_manager_); 885 aura::client::SetCursorClient(root_window, &cursor_manager_);
886 aura::client::SetTooltipClient(root_window, tooltip_controller_.get()); 886 aura::client::SetTooltipClient(root_window, tooltip_controller_.get());
887 aura::client::SetEventClient(root_window, event_client_.get()); 887 aura::client::SetEventClient(root_window, event_client_.get());
888 888
889 if (nested_dispatcher_controller_.get()) { 889 if (nested_dispatcher_controller_) {
890 aura::client::SetDispatcherClient(root_window, 890 aura::client::SetDispatcherClient(root_window,
891 nested_dispatcher_controller_.get()); 891 nested_dispatcher_controller_.get());
892 } 892 }
893 if (user_action_client_.get()) 893 if (user_action_client_)
894 aura::client::SetUserActionClient(root_window, user_action_client_.get()); 894 aura::client::SetUserActionClient(root_window, user_action_client_.get());
895 895
896 root_window->SetCursor(ui::kCursorPointer); 896 root_window->SetCursor(ui::kCursorPointer);
897 controller->InitLayoutManagers(); 897 controller->InitLayoutManagers();
898 898
899 // TODO(oshima): Move the instance to RootWindowController when 899 // TODO(oshima): Move the instance to RootWindowController when
900 // the extended desktop is enabled by default. 900 // the extended desktop is enabled by default.
901 internal::AlwaysOnTopController* always_on_top_controller = 901 internal::AlwaysOnTopController* always_on_top_controller =
902 new internal::AlwaysOnTopController; 902 new internal::AlwaysOnTopController;
903 always_on_top_controller->SetAlwaysOnTopContainer( 903 always_on_top_controller->SetAlwaysOnTopContainer(
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
944 //////////////////////////////////////////////////////////////////////////////// 944 ////////////////////////////////////////////////////////////////////////////////
945 // Shell, aura::client::ActivationChangeObserver implementation: 945 // Shell, aura::client::ActivationChangeObserver implementation:
946 946
947 void Shell::OnWindowActivated(aura::Window* gained_active, 947 void Shell::OnWindowActivated(aura::Window* gained_active,
948 aura::Window* lost_active) { 948 aura::Window* lost_active) {
949 if (gained_active) 949 if (gained_active)
950 active_root_window_ = gained_active->GetRootWindow(); 950 active_root_window_ = gained_active->GetRootWindow();
951 } 951 }
952 952
953 } // namespace ash 953 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_widget.cc ('k') | ash/system/tray/system_tray.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698