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

Side by Side Diff: chrome/browser/extensions/permissions_updater.cc

Issue 2051663003: base::ListValue::Append cleanup: pass unique_ptr instead of the released pointer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 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/permissions_updater.h" 5 #include "chrome/browser/extensions/permissions_updater.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 events::HistogramValue histogram_value, 225 events::HistogramValue histogram_value,
226 const char* event_name, 226 const char* event_name,
227 const PermissionSet& changed_permissions) { 227 const PermissionSet& changed_permissions) {
228 EventRouter* event_router = EventRouter::Get(browser_context_); 228 EventRouter* event_router = EventRouter::Get(browser_context_);
229 if (!event_router) 229 if (!event_router)
230 return; 230 return;
231 231
232 std::unique_ptr<base::ListValue> value(new base::ListValue()); 232 std::unique_ptr<base::ListValue> value(new base::ListValue());
233 std::unique_ptr<api::permissions::Permissions> permissions = 233 std::unique_ptr<api::permissions::Permissions> permissions =
234 PackPermissionSet(changed_permissions); 234 PackPermissionSet(changed_permissions);
235 value->Append(permissions->ToValue().release()); 235 value->Append(permissions->ToValue());
236 std::unique_ptr<Event> event( 236 std::unique_ptr<Event> event(
237 new Event(histogram_value, event_name, std::move(value))); 237 new Event(histogram_value, event_name, std::move(value)));
238 event->restrict_to_browser_context = browser_context_; 238 event->restrict_to_browser_context = browser_context_;
239 event_router->DispatchEventToExtension(extension_id, std::move(event)); 239 event_router->DispatchEventToExtension(extension_id, std::move(event));
240 } 240 }
241 241
242 void PermissionsUpdater::NotifyPermissionsUpdated( 242 void PermissionsUpdater::NotifyPermissionsUpdated(
243 EventType event_type, 243 EventType event_type,
244 const Extension* extension, 244 const Extension* extension,
245 const PermissionSet& changed) { 245 const PermissionSet& changed) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 Profile::FromBrowserContext(host->GetBrowserContext()))) { 286 Profile::FromBrowserContext(host->GetBrowserContext()))) {
287 host->Send(new ExtensionMsg_UpdatePermissions(params)); 287 host->Send(new ExtensionMsg_UpdatePermissions(params));
288 } 288 }
289 } 289 }
290 290
291 // Trigger the onAdded and onRemoved events in the extension. 291 // Trigger the onAdded and onRemoved events in the extension.
292 DispatchEvent(extension->id(), histogram_value, event_name, changed); 292 DispatchEvent(extension->id(), histogram_value, event_name, changed);
293 } 293 }
294 294
295 } // namespace extensions 295 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698