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

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: fix a bad merge 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
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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698