🎨 Use enum for world ids
This commit is contained in:
parent
5b6397aaa6
commit
4f5c725dde
1 changed files with 7 additions and 5 deletions
|
@ -76,15 +76,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(
|
||||||
kIsolatedWorldId, &source, 1, 1);
|
World::ISOLATED, &source, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsMainWorld(int world_id) {
|
bool IsMainWorld(int world_id) {
|
||||||
return world_id == kMainWorldId;
|
return world_id == World::MAIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsIsolatedWorld(int world_id) {
|
bool IsIsolatedWorld(int world_id) {
|
||||||
return world_id == kIsolatedWorldId;
|
return world_id == World::ISOLATED;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DidCreateScriptContext(v8::Handle<v8::Context> context,
|
void DidCreateScriptContext(v8::Handle<v8::Context> context,
|
||||||
|
@ -116,8 +116,10 @@ class AtomRenderFrameObserver : public content::RenderFrameObserver {
|
||||||
bool isolated_world_;
|
bool isolated_world_;
|
||||||
AtomRendererClient* renderer_client_;
|
AtomRendererClient* renderer_client_;
|
||||||
|
|
||||||
const int kMainWorldId = 0;
|
enum World {
|
||||||
const int kIsolatedWorldId = 999;
|
MAIN = 0,
|
||||||
|
ISOLATED = 999
|
||||||
|
};
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(AtomRenderFrameObserver);
|
DISALLOW_COPY_AND_ASSIGN(AtomRenderFrameObserver);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue