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

Side by Side Diff: chrome/browser/extensions/api/tabs/windows_event_router.cc

Issue 2257113002: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
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 "chrome/browser/extensions/api/tabs/windows_event_router.h" 5 #include "chrome/browser/extensions/api/tabs/windows_event_router.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 return; 245 return;
246 246
247 // window_profile is either the default profile for the active window, its 247 // window_profile is either the default profile for the active window, its
248 // incognito profile, or nullptr if the previous profile is losing focus. 248 // incognito profile, or nullptr if the previous profile is losing focus.
249 focused_profile_ = window_profile; 249 focused_profile_ = window_profile;
250 focused_window_id_ = window_id; 250 focused_window_id_ = window_id;
251 251
252 if (!HasEventListener(windows::OnFocusChanged::kEventName)) 252 if (!HasEventListener(windows::OnFocusChanged::kEventName))
253 return; 253 return;
254 254
255 std::unique_ptr<Event> event(new Event( 255 std::unique_ptr<Event> event(new Event(events::WINDOWS_ON_FOCUS_CHANGED,
Devlin 2016/08/29 15:10:01 MakeUnique
Adam Rice 2016/08/30 07:03:00 Done.
256 events::WINDOWS_ON_FOCUS_CHANGED, windows::OnFocusChanged::kEventName, 256 windows::OnFocusChanged::kEventName,
257 base::WrapUnique(new base::ListValue()))); 257 base::MakeUnique<base::ListValue>()));
258 event->will_dispatch_callback = 258 event->will_dispatch_callback =
259 base::Bind(&WillDispatchWindowFocusedEvent, window_controller); 259 base::Bind(&WillDispatchWindowFocusedEvent, window_controller);
260 EventRouter::Get(profile_)->BroadcastEvent(std::move(event)); 260 EventRouter::Get(profile_)->BroadcastEvent(std::move(event));
261 } 261 }
262 262
263 void WindowsEventRouter::DispatchEvent(events::HistogramValue histogram_value, 263 void WindowsEventRouter::DispatchEvent(events::HistogramValue histogram_value,
264 const std::string& event_name, 264 const std::string& event_name,
265 WindowController* window_controller, 265 WindowController* window_controller,
266 std::unique_ptr<base::ListValue> args) { 266 std::unique_ptr<base::ListValue> args) {
267 std::unique_ptr<Event> event( 267 std::unique_ptr<Event> event(
268 new Event(histogram_value, event_name, std::move(args))); 268 new Event(histogram_value, event_name, std::move(args)));
269 event->restrict_to_browser_context = window_controller->profile(); 269 event->restrict_to_browser_context = window_controller->profile();
270 event->will_dispatch_callback = 270 event->will_dispatch_callback =
271 base::Bind(&WillDispatchWindowEvent, window_controller); 271 base::Bind(&WillDispatchWindowEvent, window_controller);
272 EventRouter::Get(profile_)->BroadcastEvent(std::move(event)); 272 EventRouter::Get(profile_)->BroadcastEvent(std::move(event));
273 } 273 }
274 274
275 bool WindowsEventRouter::HasEventListener(const std::string& event_name) { 275 bool WindowsEventRouter::HasEventListener(const std::string& event_name) {
276 return EventRouter::Get(profile_)->HasEventListener(event_name); 276 return EventRouter::Get(profile_)->HasEventListener(event_name);
277 } 277 }
278 278
279 void WindowsEventRouter::AddAppWindow(extensions::AppWindow* app_window) { 279 void WindowsEventRouter::AddAppWindow(extensions::AppWindow* app_window) {
280 std::unique_ptr<AppWindowController> controller(new AppWindowController( 280 std::unique_ptr<AppWindowController> controller(new AppWindowController(
281 app_window, base::WrapUnique(new AppBaseWindow(app_window)), profile_)); 281 app_window, base::MakeUnique<AppBaseWindow>(app_window), profile_));
282 app_windows_[app_window->session_id().id()] = std::move(controller); 282 app_windows_[app_window->session_id().id()] = std::move(controller);
283 } 283 }
284 284
285 } // namespace extensions 285 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698