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

Unified Diff: content/renderer/web_ui_setup_impl.cc

Issue 256403004: Move Mojo channel initialization closer to IPC::Channel setup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: another ios fix Created 6 years, 8 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_setup_impl.h ('k') | mojo/common/channel_init.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/web_ui_setup_impl.cc
diff --git a/content/renderer/web_ui_setup_impl.cc b/content/renderer/web_ui_setup_impl.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e4c065f8a807f30243e506ac18b89508d793064b
--- /dev/null
+++ b/content/renderer/web_ui_setup_impl.cc
@@ -0,0 +1,41 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/renderer/web_ui_setup_impl.h"
+
+#include "content/public/renderer/render_view.h"
+#include "content/renderer/web_ui_mojo.h"
+
+namespace content {
+
+// static
+void WebUISetupImpl::Bind(mojo::ScopedMessagePipeHandle handle) {
+ // This instance will be destroyed when the pipe is closed. See OnError.
+ new WebUISetupImpl(handle.Pass());
+}
+
+WebUISetupImpl::WebUISetupImpl(mojo::ScopedMessagePipeHandle handle)
+ : client_(ScopedWebUISetupClientHandle::From(handle.Pass()), this) {
+}
+
+WebUISetupImpl::~WebUISetupImpl() {
+}
+
+void WebUISetupImpl::SetWebUIHandle(
+ int32 view_routing_id,
+ mojo::ScopedMessagePipeHandle web_ui_handle) {
+ RenderView* render_view = RenderView::FromRoutingID(view_routing_id);
+ if (!render_view)
+ return;
+ WebUIMojo* web_ui_mojo = WebUIMojo::Get(render_view);
+ if (!web_ui_mojo)
+ return;
+ web_ui_mojo->SetBrowserHandle(web_ui_handle.Pass());
+}
+
+void WebUISetupImpl::OnError() {
+ delete this;
+}
+
+} // namespace content
« no previous file with comments | « content/renderer/web_ui_setup_impl.h ('k') | mojo/common/channel_init.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698