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

Unified Diff: content/renderer/render_widget_view_mus.cc

Issue 1461243002: [OLD ATTEMPT, DO NOT REVIEW] mustash: Enable connections to mus from the Chrome renderer Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Invert connection creation flow. Needs lots of work. Created 5 years, 1 month 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
Index: content/renderer/render_widget_view_mus.cc
diff --git a/content/renderer/render_widget_view_mus.cc b/content/renderer/render_widget_view_mus.cc
new file mode 100644
index 0000000000000000000000000000000000000000..15b1ac05f237f97d33580fddcee92cca90aba657
--- /dev/null
+++ b/content/renderer/render_widget_view_mus.cc
@@ -0,0 +1,52 @@
+// Copyright 2015 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/render_widget_view_mus.h"
+
+#include "components/mus/public/interfaces/window_tree.mojom.h"
+// TODO(fsamuel): This needs to be in common.
+#include "content/public/common/mojo_shell_connection.h"
+#include "content/browser/render_widget_view.mojom.h"
Fady Samuel 2015/11/24 04:42:38 Move to common.
+#include "mojo/application/public/cpp/application_impl.h"
+
+
+namespace content {
+
+RenderWidgetViewMus::RenderWidgetViewMus(int routing_id) {
+ fprintf(stderr, ">>>%s\n", __PRETTY_FUNCTION__);
+ mojom::RenderWidgetViewFactoryPtr factory;
+ MojoShellConnection::Get()->GetApplication()->
+ ConnectToService("exe://chrome", &factory);
+ mus::mojom::WindowTreeClientPtr tree_client;
+ mojo::InterfaceRequest<mus::mojom::WindowTreeClient> request =
+ GetProxy(&tree_client);
+ factory->CreateRenderWidgetView(routing_id, tree_client.Pass());
+ mus::WindowTreeConnection::Create(
+ this, request.Pass(),
+ mus::WindowTreeConnection::CreateType::DONT_WAIT_FOR_EMBED);
+}
+
+RenderWidgetViewMus::~RenderWidgetViewMus() {
+}
+
+
+void RenderWidgetViewMus::OnConnectionLost(
+ mus::WindowTreeConnection* connection) {
+ delete this;
+}
+
+void RenderWidgetViewMus::OnEmbed(mus::Window* root) {
+ fprintf(stderr, ">>>%s\n", __PRETTY_FUNCTION__);
+ root->AddObserver(this);
+}
+
+void RenderWidgetViewMus::OnUnembed() {
+}
+
+void RenderWidgetViewMus::OnWindowBoundsChanged(mus::Window* window,
+ const gfx::Rect& old_bounds,
+ const gfx::Rect& new_bounds) {
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698