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

Side by Side Diff: content/renderer/render_widget_window_tree_client_factory.cc

Issue 1476643002: mustash: Enable connections to mus from the Chrome renderer [take 2] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't create a RenderWidgetWindowTreeeClientFactory in tests Created 5 years 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/renderer/render_widget_window_tree_client_factory.h"
6
7 #include "base/logging.h"
8 #include "base/macros.h"
9 #include "components/mus/public/interfaces/window_tree.mojom.h"
10 #include "content/common/render_widget_window_tree_client_factory.mojom.h"
11 #include "content/public/common/mojo_shell_connection.h"
12 #include "content/renderer/render_widget_mus_connection.h"
13 #include "mojo/application/public/cpp/application_connection.h"
14 #include "mojo/application/public/cpp/interface_factory.h"
15 #include "mojo/common/weak_binding_set.h"
16 #include "url/gurl.h"
17
18 namespace content {
19
20 namespace {
21
22 // This object's lifetime is managed by MojoShellConnection because it's a
23 // MojoShellConnection::Listener.
24 class RenderWidgetWindowTreeClientFactoryImpl
25 : public MojoShellConnection::Listener,
26 public mojo::InterfaceFactory<mojom::RenderWidgetWindowTreeClientFactory>,
27 public mojom::RenderWidgetWindowTreeClientFactory {
28 public:
29 RenderWidgetWindowTreeClientFactoryImpl() {
30 DCHECK(MojoShellConnection::Get());
31 MojoShellConnection::Get()->AddListener(this);
32 }
33
34 ~RenderWidgetWindowTreeClientFactoryImpl() override {}
35
36 private:
37 // MojoShellConnection::Listener implementation:
38 bool ConfigureIncomingConnection(
39 mojo::ApplicationConnection* connection) override {
40 connection->AddService<mojom::RenderWidgetWindowTreeClientFactory>(this);
41 return true;
42 }
43
44 // mojo::InterfaceFactory<mojom::RenderWidgetWindowTreeClientFactory>:
45 void Create(mojo::ApplicationConnection* connection,
46 mojo::InterfaceRequest<mojom::RenderWidgetWindowTreeClientFactory>
47 request) override {
48 bindings_.AddBinding(this, request.Pass());
49 }
50
51 // mojom::RenderWidgetWindowTreeClientFactory implementation.
52 void CreateWindowTreeClientForRenderWidget(
53 uint32_t routing_id,
54 mojo::InterfaceRequest<mus::mojom::WindowTreeClient> request) override {
55 new RenderWidgetMusConnection(routing_id, request.Pass());
56 }
57
58 mojo::WeakBindingSet<mojom::RenderWidgetWindowTreeClientFactory> bindings_;
59
60 DISALLOW_COPY_AND_ASSIGN(RenderWidgetWindowTreeClientFactoryImpl);
61 };
62
63 } // namespace
64
65 void CreateRenderWidgetWindowTreeClientFactory() {
66 new RenderWidgetWindowTreeClientFactoryImpl;
67 }
68
69 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698