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

Side by Side Diff: ash/shell.cc

Issue 1867223004: Convert //ash from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 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
« no previous file with comments | « ash/shell.h ('k') | ash/shell/app_list.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 #include <utility> 9 #include <utility>
10 10
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 #include "ash/wm/system_modal_container_layout_manager.h" 76 #include "ash/wm/system_modal_container_layout_manager.h"
77 #include "ash/wm/toplevel_window_event_handler.h" 77 #include "ash/wm/toplevel_window_event_handler.h"
78 #include "ash/wm/video_detector.h" 78 #include "ash/wm/video_detector.h"
79 #include "ash/wm/window_animations.h" 79 #include "ash/wm/window_animations.h"
80 #include "ash/wm/window_cycle_controller.h" 80 #include "ash/wm/window_cycle_controller.h"
81 #include "ash/wm/window_positioner.h" 81 #include "ash/wm/window_positioner.h"
82 #include "ash/wm/window_properties.h" 82 #include "ash/wm/window_properties.h"
83 #include "ash/wm/window_util.h" 83 #include "ash/wm/window_util.h"
84 #include "ash/wm/workspace_controller.h" 84 #include "ash/wm/workspace_controller.h"
85 #include "base/bind.h" 85 #include "base/bind.h"
86 #include "base/memory/ptr_util.h"
86 #include "base/trace_event/trace_event.h" 87 #include "base/trace_event/trace_event.h"
87 #include "ui/aura/client/aura_constants.h" 88 #include "ui/aura/client/aura_constants.h"
88 #include "ui/aura/env.h" 89 #include "ui/aura/env.h"
89 #include "ui/aura/layout_manager.h" 90 #include "ui/aura/layout_manager.h"
90 #include "ui/aura/window.h" 91 #include "ui/aura/window.h"
91 #include "ui/aura/window_event_dispatcher.h" 92 #include "ui/aura/window_event_dispatcher.h"
92 #include "ui/base/ui_base_switches.h" 93 #include "ui/base/ui_base_switches.h"
93 #include "ui/base/user_activity/user_activity_detector.h" 94 #include "ui/base/user_activity/user_activity_detector.h"
94 #include "ui/compositor/layer.h" 95 #include "ui/compositor/layer.h"
95 #include "ui/compositor/layer_animator.h" 96 #include "ui/compositor/layer_animator.h"
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 return GetPrimaryRootWindowController()->GetSystemTray(); 587 return GetPrimaryRootWindowController()->GetSystemTray();
587 } 588 }
588 589
589 ShelfDelegate* Shell::GetShelfDelegate() { 590 ShelfDelegate* Shell::GetShelfDelegate() {
590 if (!shelf_delegate_) { 591 if (!shelf_delegate_) {
591 // Creates ShelfItemDelegateManager before ShelfDelegate. 592 // Creates ShelfItemDelegateManager before ShelfDelegate.
592 shelf_item_delegate_manager_.reset( 593 shelf_item_delegate_manager_.reset(
593 new ShelfItemDelegateManager(shelf_model_.get())); 594 new ShelfItemDelegateManager(shelf_model_.get()));
594 595
595 shelf_delegate_.reset(delegate_->CreateShelfDelegate(shelf_model_.get())); 596 shelf_delegate_.reset(delegate_->CreateShelfDelegate(shelf_model_.get()));
596 scoped_ptr<ShelfItemDelegate> controller(new AppListShelfItemDelegate); 597 std::unique_ptr<ShelfItemDelegate> controller(new AppListShelfItemDelegate);
597 598
598 // Finding the shelf model's location of the app list and setting its 599 // Finding the shelf model's location of the app list and setting its
599 // ShelfItemDelegate. 600 // ShelfItemDelegate.
600 int app_list_index = shelf_model_->GetItemIndexForType(TYPE_APP_LIST); 601 int app_list_index = shelf_model_->GetItemIndexForType(TYPE_APP_LIST);
601 DCHECK_GE(app_list_index, 0); 602 DCHECK_GE(app_list_index, 0);
602 ShelfID app_list_id = shelf_model_->items()[app_list_index].id; 603 ShelfID app_list_id = shelf_model_->items()[app_list_index].id;
603 DCHECK(app_list_id); 604 DCHECK(app_list_id);
604 shelf_item_delegate_manager_->SetShelfItemDelegate(app_list_id, 605 shelf_item_delegate_manager_->SetShelfItemDelegate(app_list_id,
605 std::move(controller)); 606 std::move(controller));
606 shelf_window_watcher_.reset(new ShelfWindowWatcher( 607 shelf_window_watcher_.reset(new ShelfWindowWatcher(
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 DCHECK(instance_ == this); 853 DCHECK(instance_ == this);
853 instance_ = nullptr; 854 instance_ = nullptr;
854 } 855 }
855 856
856 void Shell::Init(const ShellInitParams& init_params) { 857 void Shell::Init(const ShellInitParams& init_params) {
857 in_mus_ = init_params.in_mus; 858 in_mus_ = init_params.in_mus;
858 if (!in_mus_) { 859 if (!in_mus_) {
859 native_cursor_manager_ = new AshNativeCursorManager; 860 native_cursor_manager_ = new AshNativeCursorManager;
860 #if defined(OS_CHROMEOS) 861 #if defined(OS_CHROMEOS)
861 cursor_manager_.reset( 862 cursor_manager_.reset(
862 new CursorManager(make_scoped_ptr(native_cursor_manager_))); 863 new CursorManager(base::WrapUnique(native_cursor_manager_)));
863 #else 864 #else
864 cursor_manager_.reset( 865 cursor_manager_.reset(
865 new ::wm::CursorManager(make_scoped_ptr(native_cursor_manager_))); 866 new ::wm::CursorManager(base::WrapUnique(native_cursor_manager_)));
866 #endif 867 #endif
867 } 868 }
868 869
869 delegate_->PreInit(); 870 delegate_->PreInit();
870 bool display_initialized = display_manager_->InitFromCommandLine(); 871 bool display_initialized = display_manager_->InitFromCommandLine();
871 872
872 display_configuration_controller_.reset(new DisplayConfigurationController( 873 display_configuration_controller_.reset(new DisplayConfigurationController(
873 display_manager_.get(), window_tree_host_manager_.get())); 874 display_manager_.get(), window_tree_host_manager_.get()));
874 875
875 #if defined(OS_CHROMEOS) 876 #if defined(OS_CHROMEOS)
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
967 968
968 // ui::UserActivityDetector passes events to observers, so let them get 969 // ui::UserActivityDetector passes events to observers, so let them get
969 // rewritten first. 970 // rewritten first.
970 user_activity_detector_.reset(new ui::UserActivityDetector); 971 user_activity_detector_.reset(new ui::UserActivityDetector);
971 972
972 overlay_filter_.reset(new OverlayEventFilter); 973 overlay_filter_.reset(new OverlayEventFilter);
973 AddPreTargetHandler(overlay_filter_.get()); 974 AddPreTargetHandler(overlay_filter_.get());
974 AddShellObserver(overlay_filter_.get()); 975 AddShellObserver(overlay_filter_.get());
975 976
976 accelerator_filter_.reset(new ::wm::AcceleratorFilter( 977 accelerator_filter_.reset(new ::wm::AcceleratorFilter(
977 scoped_ptr<::wm::AcceleratorDelegate>(new AcceleratorDelegate), 978 std::unique_ptr<::wm::AcceleratorDelegate>(new AcceleratorDelegate),
978 accelerator_controller_->accelerator_history())); 979 accelerator_controller_->accelerator_history()));
979 AddPreTargetHandler(accelerator_filter_.get()); 980 AddPreTargetHandler(accelerator_filter_.get());
980 981
981 event_transformation_handler_.reset(new EventTransformationHandler); 982 event_transformation_handler_.reset(new EventTransformationHandler);
982 AddPreTargetHandler(event_transformation_handler_.get()); 983 AddPreTargetHandler(event_transformation_handler_.get());
983 984
984 toplevel_window_event_handler_.reset(new ToplevelWindowEventHandler); 985 toplevel_window_event_handler_.reset(new ToplevelWindowEventHandler);
985 986
986 system_gesture_filter_.reset(new SystemGestureEventFilter); 987 system_gesture_filter_.reset(new SystemGestureEventFilter);
987 AddPreTargetHandler(system_gesture_filter_.get()); 988 AddPreTargetHandler(system_gesture_filter_.get());
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 new PartialMagnificationController()); 1027 new PartialMagnificationController());
1027 1028
1028 autoclick_controller_.reset(AutoclickController::CreateInstance()); 1029 autoclick_controller_.reset(AutoclickController::CreateInstance());
1029 1030
1030 high_contrast_controller_.reset(new HighContrastController); 1031 high_contrast_controller_.reset(new HighContrastController);
1031 video_detector_.reset(new VideoDetector); 1032 video_detector_.reset(new VideoDetector);
1032 window_selector_controller_.reset(new WindowSelectorController()); 1033 window_selector_controller_.reset(new WindowSelectorController());
1033 window_cycle_controller_.reset(new WindowCycleController()); 1034 window_cycle_controller_.reset(new WindowCycleController());
1034 1035
1035 tooltip_controller_.reset(new views::corewm::TooltipController( 1036 tooltip_controller_.reset(new views::corewm::TooltipController(
1036 scoped_ptr<views::corewm::Tooltip>(new views::corewm::TooltipAura))); 1037 std::unique_ptr<views::corewm::Tooltip>(new views::corewm::TooltipAura)));
1037 AddPreTargetHandler(tooltip_controller_.get()); 1038 AddPreTargetHandler(tooltip_controller_.get());
1038 1039
1039 event_client_.reset(new EventClientImpl); 1040 event_client_.reset(new EventClientImpl);
1040 1041
1041 // This controller needs to be set before SetupManagedWindowMode. 1042 // This controller needs to be set before SetupManagedWindowMode.
1042 desktop_background_controller_.reset( 1043 desktop_background_controller_.reset(
1043 new DesktopBackgroundController(blocking_pool_)); 1044 new DesktopBackgroundController(blocking_pool_));
1044 user_wallpaper_delegate_.reset(delegate_->CreateUserWallpaperDelegate()); 1045 user_wallpaper_delegate_.reset(delegate_->CreateUserWallpaperDelegate());
1045 1046
1046 session_state_delegate_.reset(delegate_->CreateSessionStateDelegate()); 1047 session_state_delegate_.reset(delegate_->CreateSessionStateDelegate());
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1101 1102
1102 if (cursor_manager_) { 1103 if (cursor_manager_) {
1103 if (initially_hide_cursor_) 1104 if (initially_hide_cursor_)
1104 cursor_manager_->HideCursor(); 1105 cursor_manager_->HideCursor();
1105 cursor_manager_->SetCursor(ui::kCursorPointer); 1106 cursor_manager_->SetCursor(ui::kCursorPointer);
1106 } 1107 }
1107 1108
1108 #if defined(OS_CHROMEOS) 1109 #if defined(OS_CHROMEOS)
1109 // Set accelerator controller delegates. 1110 // Set accelerator controller delegates.
1110 accelerator_controller_->SetBrightnessControlDelegate( 1111 accelerator_controller_->SetBrightnessControlDelegate(
1111 scoped_ptr<BrightnessControlDelegate>( 1112 std::unique_ptr<BrightnessControlDelegate>(
1112 new system::BrightnessControllerChromeos)); 1113 new system::BrightnessControllerChromeos));
1113 1114
1114 power_event_observer_.reset(new PowerEventObserver()); 1115 power_event_observer_.reset(new PowerEventObserver());
1115 user_activity_notifier_.reset( 1116 user_activity_notifier_.reset(
1116 new ui::UserActivityPowerManagerNotifier(user_activity_detector_.get())); 1117 new ui::UserActivityPowerManagerNotifier(user_activity_detector_.get()));
1117 video_activity_notifier_.reset( 1118 video_activity_notifier_.reset(
1118 new VideoActivityNotifier(video_detector_.get())); 1119 new VideoActivityNotifier(video_detector_.get()));
1119 bluetooth_notification_controller_.reset(new BluetoothNotificationController); 1120 bluetooth_notification_controller_.reset(new BluetoothNotificationController);
1120 last_window_closed_logout_reminder_.reset(new LastWindowClosedLogoutReminder); 1121 last_window_closed_logout_reminder_.reset(new LastWindowClosedLogoutReminder);
1121 screen_orientation_controller_.reset(new ScreenOrientationController()); 1122 screen_orientation_controller_.reset(new ScreenOrientationController());
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1193 // Shell, ui::EventTarget overrides: 1194 // Shell, ui::EventTarget overrides:
1194 1195
1195 bool Shell::CanAcceptEvent(const ui::Event& event) { 1196 bool Shell::CanAcceptEvent(const ui::Event& event) {
1196 return true; 1197 return true;
1197 } 1198 }
1198 1199
1199 ui::EventTarget* Shell::GetParentTarget() { 1200 ui::EventTarget* Shell::GetParentTarget() {
1200 return aura::Env::GetInstance(); 1201 return aura::Env::GetInstance();
1201 } 1202 }
1202 1203
1203 scoped_ptr<ui::EventTargetIterator> Shell::GetChildIterator() const { 1204 std::unique_ptr<ui::EventTargetIterator> Shell::GetChildIterator() const {
1204 return scoped_ptr<ui::EventTargetIterator>(); 1205 return std::unique_ptr<ui::EventTargetIterator>();
1205 } 1206 }
1206 1207
1207 ui::EventTargeter* Shell::GetEventTargeter() { 1208 ui::EventTargeter* Shell::GetEventTargeter() {
1208 NOTREACHED(); 1209 NOTREACHED();
1209 return nullptr; 1210 return nullptr;
1210 } 1211 }
1211 1212
1212 //////////////////////////////////////////////////////////////////////////////// 1213 ////////////////////////////////////////////////////////////////////////////////
1213 // Shell, aura::client::ActivationChangeObserver implementation: 1214 // Shell, aura::client::ActivationChangeObserver implementation:
1214 1215
1215 void Shell::OnWindowActivated( 1216 void Shell::OnWindowActivated(
1216 aura::client::ActivationChangeObserver::ActivationReason reason, 1217 aura::client::ActivationChangeObserver::ActivationReason reason,
1217 aura::Window* gained_active, 1218 aura::Window* gained_active,
1218 aura::Window* lost_active) { 1219 aura::Window* lost_active) {
1219 if (gained_active) 1220 if (gained_active)
1220 target_root_window_ = gained_active->GetRootWindow(); 1221 target_root_window_ = gained_active->GetRootWindow();
1221 } 1222 }
1222 1223
1223 } // namespace ash 1224 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shell.h ('k') | ash/shell/app_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698