Add world id constants
This commit is contained in:
parent
d194a84ae4
commit
073d8c2177
1 changed files with 6 additions and 7 deletions
|
@ -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);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue