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

Unified Diff: content/renderer/web_ui_mojo.cc

Issue 302573002: Add a Javascript wrapper around ServiceRegistry and expose it to WebUI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@render-view-shell
Patch Set: address comments 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.h ('k') | content/renderer/web_ui_mojo_context_state.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/web_ui_mojo.cc
diff --git a/content/renderer/web_ui_mojo.cc b/content/renderer/web_ui_mojo.cc
index 863fdb49c7da92cf6e86d566c14ea166b8c968b6..3722195d820b549bf530dbd64c87fcedda69da4b 100644
--- a/content/renderer/web_ui_mojo.cc
+++ b/content/renderer/web_ui_mojo.cc
@@ -5,7 +5,6 @@
#include "content/renderer/web_ui_mojo.h"
#include "content/common/view_messages.h"
-#include "content/public/common/service_registry.h"
#include "content/public/renderer/render_frame.h"
#include "content/public/renderer/render_view.h"
#include "content/renderer/web_ui_mojo_context_state.h"
@@ -49,18 +48,10 @@ void WebUIMojo::MainFrameObserver::DidFinishDocumentLoad() {
WebUIMojo::WebUIMojo(RenderView* render_view)
: RenderViewObserver(render_view),
RenderViewObserverTracker<WebUIMojo>(render_view),
- main_frame_observer_(this),
- did_finish_document_load_(false) {
+ main_frame_observer_(this) {
CreateContextState();
}
-void WebUIMojo::SetBrowserHandle(mojo::ScopedMessagePipeHandle handle) {
- if (did_finish_document_load_)
- SetHandleOnContextState(handle.Pass());
- else
- pending_handle_ = handle.Pass();
-}
-
WebUIMojo::~WebUIMojo() {
}
@@ -84,20 +75,10 @@ void WebUIMojo::DestroyContextState(v8::Handle<v8::Context> context) {
}
void WebUIMojo::OnDidFinishDocumentLoad() {
- did_finish_document_load_ = true;
- mojo::MessagePipe pipe;
- SetHandleOnContextState(pipe.handle0.Pass());
- RenderFrame::FromWebFrame(render_view()->GetWebView()->mainFrame())->
- GetServiceRegistry()->
- ConnectToRemoteService("webui_controller", pipe.handle1.Pass());
-}
-
-void WebUIMojo::SetHandleOnContextState(mojo::ScopedMessagePipeHandle handle) {
- DCHECK(did_finish_document_load_);
v8::HandleScope handle_scope(blink::mainThreadIsolate());
WebUIMojoContextState* state = GetContextState();
if (state)
- state->SetHandle(handle.Pass());
+ state->Run();
}
WebUIMojoContextState* WebUIMojo::GetContextState() {
« no previous file with comments | « content/renderer/web_ui_mojo.h ('k') | content/renderer/web_ui_mojo_context_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698