| 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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 const char* event_name, | 271 const char* event_name, |
| 272 const PermissionSet& changed_permissions) { | 272 const PermissionSet& changed_permissions) { |
| 273 EventRouter* event_router = EventRouter::Get(browser_context_); | 273 EventRouter* event_router = EventRouter::Get(browser_context_); |
| 274 if (!event_router) | 274 if (!event_router) |
| 275 return; | 275 return; |
| 276 | 276 |
| 277 std::unique_ptr<base::ListValue> value(new base::ListValue()); | 277 std::unique_ptr<base::ListValue> value(new base::ListValue()); |
| 278 std::unique_ptr<api::permissions::Permissions> permissions = | 278 std::unique_ptr<api::permissions::Permissions> permissions = |
| 279 PackPermissionSet(changed_permissions); | 279 PackPermissionSet(changed_permissions); |
| 280 value->Append(permissions->ToValue()); | 280 value->Append(permissions->ToValue()); |
| 281 std::unique_ptr<Event> event( | 281 auto event = base::MakeUnique<Event>(histogram_value, event_name, |
| 282 new Event(histogram_value, event_name, std::move(value))); | 282 std::move(value), browser_context_); |
| 283 event->restrict_to_browser_context = browser_context_; | |
| 284 event_router->DispatchEventToExtension(extension_id, std::move(event)); | 283 event_router->DispatchEventToExtension(extension_id, std::move(event)); |
| 285 } | 284 } |
| 286 | 285 |
| 287 void PermissionsUpdater::NotifyPermissionsUpdated( | 286 void PermissionsUpdater::NotifyPermissionsUpdated( |
| 288 EventType event_type, | 287 EventType event_type, |
| 289 const Extension* extension, | 288 const Extension* extension, |
| 290 const PermissionSet& changed) { | 289 const PermissionSet& changed) { |
| 291 DCHECK_EQ(0, init_flag_ & INIT_FLAG_TRANSIENT); | 290 DCHECK_EQ(0, init_flag_ & INIT_FLAG_TRANSIENT); |
| 292 | 291 |
| 293 if (changed.IsEmpty() && event_type != POLICY) | 292 if (changed.IsEmpty() && event_type != POLICY) |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 !host_iterator.IsAtEnd(); host_iterator.Advance()) { | 368 !host_iterator.IsAtEnd(); host_iterator.Advance()) { |
| 370 RenderProcessHost* host = host_iterator.GetCurrentValue(); | 369 RenderProcessHost* host = host_iterator.GetCurrentValue(); |
| 371 if (profile->IsSameProfile( | 370 if (profile->IsSameProfile( |
| 372 Profile::FromBrowserContext(host->GetBrowserContext()))) { | 371 Profile::FromBrowserContext(host->GetBrowserContext()))) { |
| 373 host->Send(new ExtensionMsg_UpdateDefaultPolicyHostRestrictions(params)); | 372 host->Send(new ExtensionMsg_UpdateDefaultPolicyHostRestrictions(params)); |
| 374 } | 373 } |
| 375 } | 374 } |
| 376 } | 375 } |
| 377 | 376 |
| 378 } // namespace extensions | 377 } // namespace extensions |
| OLD | NEW |