| 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 "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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 content::NotificationService::current()->Notify( | 131 content::NotificationService::current()->Notify( |
| 132 chrome::NOTIFICATION_EXTENSION_PERMISSIONS_UPDATED, | 132 chrome::NOTIFICATION_EXTENSION_PERMISSIONS_UPDATED, |
| 133 content::Source<Profile>(profile_), | 133 content::Source<Profile>(profile_), |
| 134 content::Details<UpdatedExtensionPermissionsInfo>(&info)); | 134 content::Details<UpdatedExtensionPermissionsInfo>(&info)); |
| 135 | 135 |
| 136 // Send the new permissions to the renderers. | 136 // Send the new permissions to the renderers. |
| 137 for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); | 137 for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); |
| 138 !i.IsAtEnd(); i.Advance()) { | 138 !i.IsAtEnd(); i.Advance()) { |
| 139 RenderProcessHost* host = i.GetCurrentValue(); | 139 RenderProcessHost* host = i.GetCurrentValue(); |
| 140 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); | 140 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); |
| 141 if (profile_->IsSameProfile(profile)) | 141 if (profile_->IsSameProfile(profile)) { |
| 142 host->Send(new ExtensionMsg_UpdatePermissions( | 142 ExtensionMsg_UpdatePermissions_Params info; |
| 143 static_cast<int>(reason), | 143 info.reason_id = static_cast<int>(reason); |
| 144 extension->id(), | 144 info.extension_id = extension->id(); |
| 145 changed->apis(), | 145 info.apis = changed->apis(); |
| 146 changed->explicit_hosts(), | 146 info.manifest_permissions = changed->manifest_permissions(); |
| 147 changed->scriptable_hosts())); | 147 info.explicit_hosts = changed->explicit_hosts(); |
| 148 info.scriptable_hosts = changed->scriptable_hosts(); |
| 149 host->Send(new ExtensionMsg_UpdatePermissions(info)); |
| 150 } |
| 148 } | 151 } |
| 149 | 152 |
| 150 // Trigger the onAdded and onRemoved events in the extension. | 153 // Trigger the onAdded and onRemoved events in the extension. |
| 151 DispatchEvent(extension->id(), event_name, changed); | 154 DispatchEvent(extension->id(), event_name, changed); |
| 152 } | 155 } |
| 153 | 156 |
| 154 } // namespace extensions | 157 } // namespace extensions |
| OLD | NEW |