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

Side by Side Diff: chrome/browser/chromeos/power/extension_event_observer.cc

Issue 2257103002: 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/chromeos/power/extension_event_observer.h" 5 #include "chrome/browser/chromeos/power/extension_event_observer.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 void ExtensionEventObserver::OnBackgroundHostCreated( 125 void ExtensionEventObserver::OnBackgroundHostCreated(
126 extensions::ExtensionHost* host) { 126 extensions::ExtensionHost* host) {
127 // We only care about ExtensionHosts for extensions that use GCM and have a 127 // We only care about ExtensionHosts for extensions that use GCM and have a
128 // lazy background page. 128 // lazy background page.
129 if (!host->extension()->permissions_data()->HasAPIPermission( 129 if (!host->extension()->permissions_data()->HasAPIPermission(
130 extensions::APIPermission::kGcm) || 130 extensions::APIPermission::kGcm) ||
131 !extensions::BackgroundInfo::HasLazyBackgroundPage(host->extension())) 131 !extensions::BackgroundInfo::HasLazyBackgroundPage(host->extension()))
132 return; 132 return;
133 133
134 auto result = 134 auto result =
135 keepalive_sources_.add(host, base::WrapUnique(new KeepaliveSources())); 135 keepalive_sources_.add(host, base::MakeUnique<KeepaliveSources>());
136 136
137 if (result.second) 137 if (result.second)
138 host->AddObserver(this); 138 host->AddObserver(this);
139 } 139 }
140 140
141 void ExtensionEventObserver::OnExtensionHostDestroyed( 141 void ExtensionEventObserver::OnExtensionHostDestroyed(
142 const extensions::ExtensionHost* host) { 142 const extensions::ExtensionHost* host) {
143 DCHECK(keepalive_sources_.contains(host)); 143 DCHECK(keepalive_sources_.contains(host));
144 144
145 std::unique_ptr<KeepaliveSources> sources = 145 std::unique_ptr<KeepaliveSources> sources =
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 if (!suspend_is_pending_ || suspend_keepalive_count_ > 0 || 265 if (!suspend_is_pending_ || suspend_keepalive_count_ > 0 ||
266 power_manager_callback_.is_null()) 266 power_manager_callback_.is_null())
267 return; 267 return;
268 268
269 suspend_is_pending_ = false; 269 suspend_is_pending_ = false;
270 power_manager_callback_.Run(); 270 power_manager_callback_.Run();
271 power_manager_callback_.Reset(); 271 power_manager_callback_.Reset();
272 } 272 }
273 273
274 } // namespace chromeos 274 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698