| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |