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

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

Issue 7071025: Use WebFrame::setIsolatedWorldSecurityOrigin to allow cross-origin XHRs in content scripts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Tweak whitespace. Created 9 years, 7 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 UpdateActiveExtensions(); 211 UpdateActiveExtensions();
212 212
213 const Extension* extension = extensions_.GetByID(extension_id); 213 const Extension* extension = extensions_.GetByID(extension_id);
214 if (!extension) 214 if (!extension)
215 return; 215 return;
216 216
217 if (is_webkit_initialized_) 217 if (is_webkit_initialized_)
218 InitHostPermissions(extension); 218 InitHostPermissions(extension);
219 } 219 }
220 220
221 // static
221 void ExtensionDispatcher::InitHostPermissions(const Extension* extension) { 222 void ExtensionDispatcher::InitHostPermissions(const Extension* extension) {
222 if (extension->HasApiPermission(Extension::kManagementPermission)) { 223 if (extension->HasApiPermission(Extension::kManagementPermission)) {
223 WebSecurityPolicy::addOriginAccessWhitelistEntry( 224 WebSecurityPolicy::addOriginAccessWhitelistEntry(
224 extension->url(), 225 extension->url(),
225 WebString::fromUTF8(chrome::kChromeUIScheme), 226 WebString::fromUTF8(chrome::kChromeUIScheme),
226 WebString::fromUTF8(chrome::kChromeUIExtensionIconHost), 227 WebString::fromUTF8(chrome::kChromeUIExtensionIconHost),
227 false); 228 false);
228 } 229 }
229 230
230 const URLPatternList& permissions = extension->host_permissions(); 231 const URLPatternList& permissions = extension->host_permissions();
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 child_process_logging::SetActiveExtensions(active_extensions); 265 child_process_logging::SetActiveExtensions(active_extensions);
265 } 266 }
266 267
267 void ExtensionDispatcher::RegisterExtension(v8::Extension* extension, 268 void ExtensionDispatcher::RegisterExtension(v8::Extension* extension,
268 bool restrict_to_extensions) { 269 bool restrict_to_extensions) {
269 if (restrict_to_extensions) 270 if (restrict_to_extensions)
270 restricted_v8_extensions_.insert(extension->name()); 271 restricted_v8_extensions_.insert(extension->name());
271 272
272 RenderThread::current()->RegisterExtension(extension); 273 RenderThread::current()->RegisterExtension(extension);
273 } 274 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698