Separate AtomBindings for renderer.
This commit is contained in:
parent
2ba3ce740c
commit
a7c3bdbf5d
8 changed files with 68 additions and 26 deletions
34
renderer/api/atom_renderer_bindings.cc
Normal file
34
renderer/api/atom_renderer_bindings.cc
Normal file
|
@ -0,0 +1,34 @@
|
|||
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "renderer/api/atom_renderer_bindings.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
|
||||
|
||||
namespace atom {
|
||||
|
||||
AtomRendererBindings::AtomRendererBindings() {
|
||||
}
|
||||
|
||||
AtomRendererBindings::~AtomRendererBindings() {
|
||||
}
|
||||
|
||||
void AtomRendererBindings::BindToFrame(WebKit::WebFrame* frame) {
|
||||
v8::HandleScope handle_scope;
|
||||
|
||||
v8::Handle<v8::Context> context = frame->mainWorldScriptContext();
|
||||
if (context.IsEmpty())
|
||||
return;
|
||||
|
||||
v8::Context::Scope scope(context);
|
||||
|
||||
v8::Handle<v8::Object> process =
|
||||
context->Global()->Get(v8::String::New("process"))->ToObject();
|
||||
DCHECK(!process.IsEmpty());
|
||||
|
||||
AtomBindings::BindTo(process);
|
||||
}
|
||||
|
||||
} // namespace atom
|
26
renderer/api/atom_renderer_bindings.h
Normal file
26
renderer/api/atom_renderer_bindings.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef ATOM_RENDERER_API_ATOM_RENDERER_BINDINGS_
|
||||
#define ATOM_RENDERER_API_ATOM_RENDERER_BINDINGS_
|
||||
|
||||
#include "common/api/atom_bindings.h"
|
||||
|
||||
namespace atom {
|
||||
|
||||
class AtomRendererBindings : public AtomBindings {
|
||||
public:
|
||||
AtomRendererBindings();
|
||||
virtual ~AtomRendererBindings();
|
||||
|
||||
// Call BindTo for process object of the frame.
|
||||
void BindToFrame(WebKit::WebFrame* frame);
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(AtomRendererBindings);
|
||||
};
|
||||
|
||||
} // namespace atom
|
||||
|
||||
#endif // ATOM_RENDERER_API_ATOM_BINDINGS_
|
Loading…
Add table
Add a link
Reference in a new issue