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

Unified Diff: content/shell/renderer/ipc_echo.cc

Issue 1141993002: Inline binding_helpers.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « content/shell/renderer/binding_helpers.h ('k') | content/shell/renderer/test_runner/test_runner.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/shell/renderer/ipc_echo.cc
diff --git a/content/shell/renderer/ipc_echo.cc b/content/shell/renderer/ipc_echo.cc
index fe60c65f873fb445fc39dc227ec616c4bd8a09cb..5bdb320ddad3165d775f8f4ca387b2271a1ee9fe 100644
--- a/content/shell/renderer/ipc_echo.cc
+++ b/content/shell/renderer/ipc_echo.cc
@@ -5,13 +5,16 @@
#include "content/shell/renderer/ipc_echo.h"
#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
#include "content/shell/common/shell_messages.h"
-#include "content/shell/renderer/binding_helpers.h"
+#include "gin/handle.h"
#include "gin/object_template_builder.h"
#include "gin/wrappable.h"
#include "ipc/ipc_sender.h"
#include "third_party/WebKit/public/web/WebDOMCustomEvent.h"
#include "third_party/WebKit/public/web/WebDOMEvent.h"
+#include "third_party/WebKit/public/web/WebFrame.h"
+#include "third_party/WebKit/public/web/WebKit.h"
#include "third_party/WebKit/public/web/WebSerializedScriptValue.h"
namespace content {
@@ -72,10 +75,21 @@ gin::ObjectTemplateBuilder IPCEchoBindings::GetObjectTemplateBuilder(
// static
void IPCEchoBindings::Install(base::WeakPtr<IPCEcho> echo,
blink::WebFrame* frame) {
- std::vector<std::string> names;
- names.push_back("ipcEcho");
- return InstallAsWindowProperties(
- new IPCEchoBindings(echo), frame, names);
+ v8::Isolate* isolate = blink::mainThreadIsolate();
+ v8::HandleScope handle_scope(isolate);
+ v8::Local<v8::Context> context = frame->mainWorldScriptContext();
+ if (context.IsEmpty())
+ return;
+
+ v8::Context::Scope context_scope(context);
+
+ IPCEchoBindings* wrapped = new IPCEchoBindings(echo);
+ gin::Handle<IPCEchoBindings> bindings = gin::CreateHandle(isolate, wrapped);
+ if (bindings.IsEmpty())
+ return;
+ v8::Local<v8::Object> global = context->Global();
+ v8::Local<v8::Value> v8_bindings = bindings.ToV8();
+ global->Set(gin::StringToV8(isolate, "ipcEcho"), v8_bindings);
}
IPCEcho::IPCEcho(blink::WebDocument document,
« no previous file with comments | « content/shell/renderer/binding_helpers.h ('k') | content/shell/renderer/test_runner/test_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698