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

Unified Diff: chrome/renderer/extensions/user_script_slave.h

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: Switch to whitelisting effective permissions. 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 side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/extensions/user_script_slave.h
diff --git a/chrome/renderer/extensions/user_script_slave.h b/chrome/renderer/extensions/user_script_slave.h
index f5037ac675c231e441e4f87b7ce6807c8a13f24c..e2b57d2e5316834642fc63c6f28ec1083e73e3d2 100644
--- a/chrome/renderer/extensions/user_script_slave.h
+++ b/chrome/renderer/extensions/user_script_slave.h
@@ -17,6 +17,7 @@
#include "chrome/common/extensions/user_script.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptSource.h"
+class Extension;
class ExtensionSet;
namespace WebKit {
@@ -28,7 +29,7 @@ using WebKit::WebScriptSource;
// Manages installed UserScripts for a render process.
class UserScriptSlave {
public:
- UserScriptSlave(const ExtensionSet* extensions);
+ explicit UserScriptSlave(const ExtensionSet* extensions);
~UserScriptSlave();
// Returns the unique set of extension IDs this UserScriptSlave knows about.
@@ -42,11 +43,18 @@ class UserScriptSlave {
// testability.
void InjectScripts(WebKit::WebFrame* frame, UserScript::RunLocation location);
- static int GetIsolatedWorldId(const std::string& extension_id);
+ // Gets the isolated world ID to use for the given |extension| in the given
+ // |frame|. If no isolated world has been created for that extension,
+ // one will be created and initialized.
+ static int GetIsolatedWorldId(const Extension* extension,
+ WebKit::WebFrame* frame);
static void InsertInitExtensionCode(std::vector<WebScriptSource>* sources,
const std::string& extension_id);
private:
+ static void InitializeIsolatedWorld(int isolated_world_id,
+ const Extension* extension);
+
// Shared memory containing raw script data.
scoped_ptr<base::SharedMemory> shared_memory_;

Powered by Google App Engine
This is Rietveld 408576698