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

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

Issue 425303002: Move extension notifications to extensions/browser/notification_types.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: (extension-notifications) rebase Created 6 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 | Annotate | Revision Log
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 "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 CHECK_EQ(ADDED, event_type); 295 CHECK_EQ(ADDED, event_type);
296 reason = UpdatedExtensionPermissionsInfo::ADDED; 296 reason = UpdatedExtensionPermissionsInfo::ADDED;
297 event_name = permissions::OnAdded::kEventName; 297 event_name = permissions::OnAdded::kEventName;
298 } 298 }
299 299
300 // Notify other APIs or interested parties. 300 // Notify other APIs or interested parties.
301 UpdatedExtensionPermissionsInfo info = UpdatedExtensionPermissionsInfo( 301 UpdatedExtensionPermissionsInfo info = UpdatedExtensionPermissionsInfo(
302 extension, changed, reason); 302 extension, changed, reason);
303 Profile* profile = Profile::FromBrowserContext(browser_context_); 303 Profile* profile = Profile::FromBrowserContext(browser_context_);
304 content::NotificationService::current()->Notify( 304 content::NotificationService::current()->Notify(
305 chrome::NOTIFICATION_EXTENSION_PERMISSIONS_UPDATED, 305 extensions::NOTIFICATION_EXTENSION_PERMISSIONS_UPDATED,
306 content::Source<Profile>(profile), 306 content::Source<Profile>(profile),
307 content::Details<UpdatedExtensionPermissionsInfo>(&info)); 307 content::Details<UpdatedExtensionPermissionsInfo>(&info));
308 308
309 ExtensionMsg_UpdatePermissions_Params params; 309 ExtensionMsg_UpdatePermissions_Params params;
310 params.extension_id = extension->id(); 310 params.extension_id = extension->id();
311 params.active_permissions = ExtensionMsg_PermissionSetStruct( 311 params.active_permissions = ExtensionMsg_PermissionSetStruct(
312 extension->permissions_data()->active_permissions()); 312 extension->permissions_data()->active_permissions());
313 params.withheld_permissions = ExtensionMsg_PermissionSetStruct( 313 params.withheld_permissions = ExtensionMsg_PermissionSetStruct(
314 extension->permissions_data()->withheld_permissions()); 314 extension->permissions_data()->withheld_permissions());
315 315
316 // Send the new permissions to the renderers. 316 // Send the new permissions to the renderers.
317 for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); 317 for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator());
318 !i.IsAtEnd(); i.Advance()) { 318 !i.IsAtEnd(); i.Advance()) {
319 RenderProcessHost* host = i.GetCurrentValue(); 319 RenderProcessHost* host = i.GetCurrentValue();
320 if (profile->IsSameProfile( 320 if (profile->IsSameProfile(
321 Profile::FromBrowserContext(host->GetBrowserContext()))) { 321 Profile::FromBrowserContext(host->GetBrowserContext()))) {
322 host->Send(new ExtensionMsg_UpdatePermissions(params)); 322 host->Send(new ExtensionMsg_UpdatePermissions(params));
323 } 323 }
324 } 324 }
325 325
326 // Trigger the onAdded and onRemoved events in the extension. 326 // Trigger the onAdded and onRemoved events in the extension.
327 DispatchEvent(extension->id(), event_name, changed); 327 DispatchEvent(extension->id(), event_name, changed);
328 } 328 }
329 329
330 } // namespace extensions 330 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/lazy_background_page_test_util.h ('k') | chrome/browser/extensions/permissions_updater_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698