| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/extension_permissions_api.h" | 5 #include "chrome/browser/extensions/extension_permissions_api.h" |
| 6 | 6 |
| 7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/extensions/extension_event_router.h" | 9 #include "chrome/browser/extensions/extension_event_router.h" |
| 10 #include "chrome/browser/extensions/extension_prefs.h" | 10 #include "chrome/browser/extensions/extension_prefs.h" |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 | 211 |
| 212 // Notify other APIs or interested parties. | 212 // Notify other APIs or interested parties. |
| 213 UpdatedExtensionPermissionsInfo info = UpdatedExtensionPermissionsInfo( | 213 UpdatedExtensionPermissionsInfo info = UpdatedExtensionPermissionsInfo( |
| 214 extension, changed, reason); | 214 extension, changed, reason); |
| 215 content::NotificationService::current()->Notify( | 215 content::NotificationService::current()->Notify( |
| 216 chrome::NOTIFICATION_EXTENSION_PERMISSIONS_UPDATED, | 216 chrome::NOTIFICATION_EXTENSION_PERMISSIONS_UPDATED, |
| 217 content::Source<Profile>(extension_service_->profile()), | 217 content::Source<Profile>(extension_service_->profile()), |
| 218 content::Details<UpdatedExtensionPermissionsInfo>(&info)); | 218 content::Details<UpdatedExtensionPermissionsInfo>(&info)); |
| 219 | 219 |
| 220 // Send the new permissions to the renderers. | 220 // Send the new permissions to the renderers. |
| 221 for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); | 221 for (content::RenderProcessHost::iterator i( |
| 222 content::RenderProcessHost::AllHostsIterator()); |
| 222 !i.IsAtEnd(); i.Advance()) { | 223 !i.IsAtEnd(); i.Advance()) { |
| 223 RenderProcessHost* host = i.GetCurrentValue(); | 224 content::RenderProcessHost* host = i.GetCurrentValue(); |
| 224 Profile* profile = Profile::FromBrowserContext(host->browser_context()); | 225 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); |
| 225 if (extension_service_->profile()->IsSameProfile(profile)) | 226 if (extension_service_->profile()->IsSameProfile(profile)) |
| 226 host->Send(new ExtensionMsg_UpdatePermissions( | 227 host->Send(new ExtensionMsg_UpdatePermissions( |
| 227 static_cast<int>(reason), | 228 static_cast<int>(reason), |
| 228 extension->id(), | 229 extension->id(), |
| 229 changed->apis(), | 230 changed->apis(), |
| 230 changed->explicit_hosts(), | 231 changed->explicit_hosts(), |
| 231 changed->scriptable_hosts())); | 232 changed->scriptable_hosts())); |
| 232 } | 233 } |
| 233 | 234 |
| 234 // Trigger the onAdded and onRemoved events in the extension. | 235 // Trigger the onAdded and onRemoved events in the extension. |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 } | 409 } |
| 409 | 410 |
| 410 void RequestPermissionsFunction::InstallUIAbort(bool user_initiated) { | 411 void RequestPermissionsFunction::InstallUIAbort(bool user_initiated) { |
| 411 install_ui_.reset(); | 412 install_ui_.reset(); |
| 412 result_.reset(Value::CreateBooleanValue(false)); | 413 result_.reset(Value::CreateBooleanValue(false)); |
| 413 requested_permissions_ = NULL; | 414 requested_permissions_ = NULL; |
| 414 | 415 |
| 415 SendResponse(true); | 416 SendResponse(true); |
| 416 Release(); | 417 Release(); |
| 417 } | 418 } |
| OLD | NEW |