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

Unified Diff: content/renderer/web_ui_mojo_context_state.cc

Issue 365513002: Port identity_internals to mojo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to ToT for commit Created 6 years, 5 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/renderer/web_ui_mojo_context_state.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/web_ui_mojo_context_state.cc
diff --git a/content/renderer/web_ui_mojo_context_state.cc b/content/renderer/web_ui_mojo_context_state.cc
index f1ff5f4896a058ee2ec87a868a4467211387fcf6..56a46dfcffb279724a8f820f0ca6278ae80e909d 100644
--- a/content/renderer/web_ui_mojo_context_state.cc
+++ b/content/renderer/web_ui_mojo_context_state.cc
@@ -6,6 +6,8 @@
#include "base/bind.h"
#include "base/stl_util.h"
+#include "content/common/frame_messages.h"
+#include "content/public/renderer/render_frame.h"
#include "content/public/renderer/resource_fetcher.h"
#include "content/renderer/web_ui_runner.h"
#include "gin/converter.h"
@@ -35,17 +37,6 @@ namespace {
// TODO(sky): move this into some common place.
const char kModulePrefix[] = "chrome://mojo/";
-void RunMain(base::WeakPtr<gin::Runner> runner,
- mojo::ScopedMessagePipeHandle* handle,
- v8::Handle<v8::Value> module) {
- v8::Isolate* isolate = runner->GetContextHolder()->isolate();
- v8::Handle<v8::Function> start;
- CHECK(gin::ConvertFromV8(isolate, module, &start));
- v8::Handle<v8::Value> args[] = {
- gin::ConvertToV8(isolate, mojo::Handle(handle->release().value())) };
- runner->Call(start, runner->global(), 1, args);
-}
-
} // namespace
// WebUIMojo -------------------------------------------------------------------
@@ -78,7 +69,23 @@ void WebUIMojoContextState::SetHandle(mojo::ScopedMessagePipeHandle handle) {
gin::ModuleRegistry::From(context_holder->context())->LoadModule(
context_holder->isolate(),
"main",
- base::Bind(RunMain, runner_->GetWeakPtr(), base::Owned(passed_handle)));
+ base::Bind(&WebUIMojoContextState::RunMain,
+ AsWeakPtr(),
+ base::Owned(passed_handle)));
+}
+
+void WebUIMojoContextState::RunMain(mojo::ScopedMessagePipeHandle* handle,
+ v8::Handle<v8::Value> module) {
+ v8::Isolate* isolate = runner_->GetContextHolder()->isolate();
+ v8::Handle<v8::Function> start;
+ CHECK(gin::ConvertFromV8(isolate, module, &start));
+ v8::Handle<v8::Value> args[] = {
+ gin::ConvertToV8(isolate, mojo::Handle(handle->release().value())) };
+ runner_->Call(start, runner_->global(), 1, args);
+
+ RenderFrame* render_frame = RenderFrame::FromWebFrame(frame_);
+ render_frame->Send(new FrameHostMsg_WebUIMojoMainRan(
+ render_frame->GetRoutingID()));
}
void WebUIMojoContextState::FetchModules(const std::vector<std::string>& ids) {
« no previous file with comments | « content/renderer/web_ui_mojo_context_state.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698