Add world id constants

This commit is contained in:
Kevin Sawicki 2016-12-08 16:06:17 -08:00
parent d194a84ae4
commit 073d8c2177

View file

@ -78,19 +78,15 @@ class AtomRenderFrameObserver : public content::RenderFrameObserver {
void CreateIsolatedWorldContext() { void CreateIsolatedWorldContext() {
blink::WebScriptSource source("void 0"); blink::WebScriptSource source("void 0");
render_frame_->GetWebFrame()->executeScriptInIsolatedWorld( render_frame_->GetWebFrame()->executeScriptInIsolatedWorld(
1, kIsolatedWorldId, &source, 1, 1);
&source,
1,
1,
nullptr);
} }
bool IsMainWorld(int world_id) { bool IsMainWorld(int world_id) {
return world_id == 0; return world_id == kMainWorldId;
} }
bool IsIsolatedWorld(int world_id) { bool IsIsolatedWorld(int world_id) {
return world_id == 1; return world_id == kIsolatedWorldId;
} }
void DidCreateScriptContext(v8::Handle<v8::Context> context, void DidCreateScriptContext(v8::Handle<v8::Context> context,
@ -133,6 +129,9 @@ class AtomRenderFrameObserver : public content::RenderFrameObserver {
bool isolated_context_created_; bool isolated_context_created_;
AtomRendererClient* renderer_client_; AtomRendererClient* renderer_client_;
const int kMainWorldId = 0;
const int kIsolatedWorldId = 999;
DISALLOW_COPY_AND_ASSIGN(AtomRenderFrameObserver); DISALLOW_COPY_AND_ASSIGN(AtomRenderFrameObserver);
}; };