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

Side by Side Diff: chrome/renderer/extensions/extension_dispatcher.cc

Issue 7003098: Start refractoring extension permissions into ExtensionPermissionSet. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: See if rebasing fixes the tests... Created 9 years, 6 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
« no previous file with comments | « chrome/renderer/extensions/bindings_utils.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 228
229 const Extension* extension = extensions_.GetByID(extension_id); 229 const Extension* extension = extensions_.GetByID(extension_id);
230 if (!extension) 230 if (!extension)
231 return; 231 return;
232 232
233 if (is_webkit_initialized_) 233 if (is_webkit_initialized_)
234 InitHostPermissions(extension); 234 InitHostPermissions(extension);
235 } 235 }
236 236
237 void ExtensionDispatcher::InitHostPermissions(const Extension* extension) { 237 void ExtensionDispatcher::InitHostPermissions(const Extension* extension) {
238 if (extension->HasApiPermission(Extension::kManagementPermission)) { 238 if (extension->HasAPIPermission(ExtensionAPIPermission::kManagement)) {
239 WebSecurityPolicy::addOriginAccessWhitelistEntry( 239 WebSecurityPolicy::addOriginAccessWhitelistEntry(
240 extension->url(), 240 extension->url(),
241 WebString::fromUTF8(chrome::kChromeUIScheme), 241 WebString::fromUTF8(chrome::kChromeUIScheme),
242 WebString::fromUTF8(chrome::kChromeUIExtensionIconHost), 242 WebString::fromUTF8(chrome::kChromeUIExtensionIconHost),
243 false); 243 false);
244 } 244 }
245 245
246 const URLPatternList& permissions = extension->host_permissions(); 246 const URLPatternList& permissions =
247 extension->permission_set()->explicit_hosts().patterns();
247 for (size_t i = 0; i < permissions.size(); ++i) { 248 for (size_t i = 0; i < permissions.size(); ++i) {
248 const char* schemes[] = { 249 const char* schemes[] = {
249 chrome::kHttpScheme, 250 chrome::kHttpScheme,
250 chrome::kHttpsScheme, 251 chrome::kHttpsScheme,
251 chrome::kFileScheme, 252 chrome::kFileScheme,
252 chrome::kChromeUIScheme, 253 chrome::kChromeUIScheme,
253 }; 254 };
254 for (size_t j = 0; j < arraysize(schemes); ++j) { 255 for (size_t j = 0; j < arraysize(schemes); ++j) {
255 if (permissions[i].MatchesScheme(schemes[j])) { 256 if (permissions[i].MatchesScheme(schemes[j])) {
256 WebSecurityPolicy::addOriginAccessWhitelistEntry( 257 WebSecurityPolicy::addOriginAccessWhitelistEntry(
(...skipping 23 matching lines...) Expand all
280 child_process_logging::SetActiveExtensions(active_extensions); 281 child_process_logging::SetActiveExtensions(active_extensions);
281 } 282 }
282 283
283 void ExtensionDispatcher::RegisterExtension(v8::Extension* extension, 284 void ExtensionDispatcher::RegisterExtension(v8::Extension* extension,
284 bool restrict_to_extensions) { 285 bool restrict_to_extensions) {
285 if (restrict_to_extensions) 286 if (restrict_to_extensions)
286 restricted_v8_extensions_.insert(extension->name()); 287 restricted_v8_extensions_.insert(extension->name());
287 288
288 RenderThread::current()->RegisterExtension(extension); 289 RenderThread::current()->RegisterExtension(extension);
289 } 290 }
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/bindings_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698