| 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/renderer/extensions/extension_dispatcher.h" | 5 #include "chrome/renderer/extensions/extension_dispatcher.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/common/child_process_logging.h" | 8 #include "chrome/common/child_process_logging.h" |
| 9 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
| 10 #include "chrome/common/extensions/extension.h" | 10 #include "chrome/common/extensions/extension.h" |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 | 216 |
| 217 const Extension* extension = extensions_.GetByID(extension_id); | 217 const Extension* extension = extensions_.GetByID(extension_id); |
| 218 if (!extension) | 218 if (!extension) |
| 219 return; | 219 return; |
| 220 | 220 |
| 221 if (is_webkit_initialized_) | 221 if (is_webkit_initialized_) |
| 222 InitHostPermissions(extension); | 222 InitHostPermissions(extension); |
| 223 } | 223 } |
| 224 | 224 |
| 225 void ExtensionDispatcher::InitHostPermissions(const Extension* extension) { | 225 void ExtensionDispatcher::InitHostPermissions(const Extension* extension) { |
| 226 if (extension->HasApiPermission(Extension::kManagementPermission)) { | 226 if (extension->HasApiPermission(ExtensionAPIPermission::Management())) { |
| 227 WebSecurityPolicy::addOriginAccessWhitelistEntry( | 227 WebSecurityPolicy::addOriginAccessWhitelistEntry( |
| 228 extension->url(), | 228 extension->url(), |
| 229 WebString::fromUTF8(chrome::kChromeUIScheme), | 229 WebString::fromUTF8(chrome::kChromeUIScheme), |
| 230 WebString::fromUTF8(chrome::kChromeUIExtensionIconHost), | 230 WebString::fromUTF8(chrome::kChromeUIExtensionIconHost), |
| 231 false); | 231 false); |
| 232 } | 232 } |
| 233 | 233 |
| 234 const URLPatternList& permissions = extension->host_permissions(); | 234 const URLPatternList& permissions = extension->host_permissions(); |
| 235 for (size_t i = 0; i < permissions.size(); ++i) { | 235 for (size_t i = 0; i < permissions.size(); ++i) { |
| 236 const char* schemes[] = { | 236 const char* schemes[] = { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 child_process_logging::SetActiveExtensions(active_extensions); | 268 child_process_logging::SetActiveExtensions(active_extensions); |
| 269 } | 269 } |
| 270 | 270 |
| 271 void ExtensionDispatcher::RegisterExtension(v8::Extension* extension, | 271 void ExtensionDispatcher::RegisterExtension(v8::Extension* extension, |
| 272 bool restrict_to_extensions) { | 272 bool restrict_to_extensions) { |
| 273 if (restrict_to_extensions) | 273 if (restrict_to_extensions) |
| 274 restricted_v8_extensions_.insert(extension->name()); | 274 restricted_v8_extensions_.insert(extension->name()); |
| 275 | 275 |
| 276 RenderThread::current()->RegisterExtension(extension); | 276 RenderThread::current()->RegisterExtension(extension); |
| 277 } | 277 } |
| OLD | NEW |