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

Side by Side Diff: chrome/browser/extensions/api/sessions/sessions_api.cc

Issue 2257113002: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 3 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/sessions/sessions_api.h" 5 #include "chrome/browser/extensions/api/sessions/sessions_api.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 } 587 }
588 588
589 SessionsEventRouter::~SessionsEventRouter() { 589 SessionsEventRouter::~SessionsEventRouter() {
590 if (tab_restore_service_) 590 if (tab_restore_service_)
591 tab_restore_service_->RemoveObserver(this); 591 tab_restore_service_->RemoveObserver(this);
592 } 592 }
593 593
594 void SessionsEventRouter::TabRestoreServiceChanged( 594 void SessionsEventRouter::TabRestoreServiceChanged(
595 sessions::TabRestoreService* service) { 595 sessions::TabRestoreService* service) {
596 std::unique_ptr<base::ListValue> args(new base::ListValue()); 596 std::unique_ptr<base::ListValue> args(new base::ListValue());
597 EventRouter::Get(profile_)->BroadcastEvent(base::WrapUnique( 597 EventRouter::Get(profile_)->BroadcastEvent(base::MakeUnique<Event>(
598 new Event(events::SESSIONS_ON_CHANGED, 598 events::SESSIONS_ON_CHANGED, api::sessions::OnChanged::kEventName,
599 api::sessions::OnChanged::kEventName, std::move(args)))); 599 std::move(args)));
600 } 600 }
601 601
602 void SessionsEventRouter::TabRestoreServiceDestroyed( 602 void SessionsEventRouter::TabRestoreServiceDestroyed(
603 sessions::TabRestoreService* service) { 603 sessions::TabRestoreService* service) {
604 tab_restore_service_ = NULL; 604 tab_restore_service_ = NULL;
605 } 605 }
606 606
607 SessionsAPI::SessionsAPI(content::BrowserContext* context) 607 SessionsAPI::SessionsAPI(content::BrowserContext* context)
608 : browser_context_(context) { 608 : browser_context_(context) {
609 EventRouter::Get(browser_context_)->RegisterObserver(this, 609 EventRouter::Get(browser_context_)->RegisterObserver(this,
(...skipping 15 matching lines...) Expand all
625 return g_factory.Pointer(); 625 return g_factory.Pointer();
626 } 626 }
627 627
628 void SessionsAPI::OnListenerAdded(const EventListenerInfo& details) { 628 void SessionsAPI::OnListenerAdded(const EventListenerInfo& details) {
629 sessions_event_router_.reset( 629 sessions_event_router_.reset(
630 new SessionsEventRouter(Profile::FromBrowserContext(browser_context_))); 630 new SessionsEventRouter(Profile::FromBrowserContext(browser_context_)));
631 EventRouter::Get(browser_context_)->UnregisterObserver(this); 631 EventRouter::Get(browser_context_)->UnregisterObserver(this);
632 } 632 }
633 633
634 } // namespace extensions 634 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698