OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/mojo_runner_state.h" | 5 #include "chrome/browser/mojo_runner_state.h" |
6 | 6 |
| 7 #include "components/mus/public/interfaces/window_manager.mojom.h" |
7 #include "mojo/application/public/cpp/application_delegate.h" | 8 #include "mojo/application/public/cpp/application_delegate.h" |
8 #include "mojo/application/public/cpp/application_impl.h" | 9 #include "mojo/application/public/cpp/application_impl.h" |
| 10 #include "mojo/converters/network/network_type_converters.h" |
9 #include "mojo/runner/child/runner_connection.h" | 11 #include "mojo/runner/child/runner_connection.h" |
| 12 #include "ui/views/mus/window_manager_connection.h" |
10 | 13 |
11 class ChromeApplicationDelegate : public mojo::ApplicationDelegate { | 14 class ChromeApplicationDelegate : public mojo::ApplicationDelegate { |
12 public: | 15 public: |
13 ChromeApplicationDelegate() {} | 16 ChromeApplicationDelegate() {} |
14 ~ChromeApplicationDelegate() override {} | 17 ~ChromeApplicationDelegate() override {} |
15 | 18 |
16 private: | 19 private: |
17 void Initialize(mojo::ApplicationImpl* application) override { | 20 void Initialize(mojo::ApplicationImpl* application) override { |
18 // TODO(beng): Connect to the window manager. | 21 mus::mojom::WindowManagerPtr window_manager; |
| 22 application->ConnectToService( |
| 23 mojo::URLRequest::From(std::string("mojo:example_wm")), |
| 24 &window_manager); |
| 25 views::WindowManagerConnection::Create(window_manager.Pass(), application); |
19 } | 26 } |
20 bool ConfigureIncomingConnection( | 27 bool ConfigureIncomingConnection( |
21 mojo::ApplicationConnection* connection) override { | 28 mojo::ApplicationConnection* connection) override { |
22 return false; | 29 return false; |
23 } | 30 } |
24 | 31 |
25 DISALLOW_COPY_AND_ASSIGN(ChromeApplicationDelegate); | 32 DISALLOW_COPY_AND_ASSIGN(ChromeApplicationDelegate); |
26 }; | 33 }; |
27 | 34 |
28 MojoRunnerState::MojoRunnerState() {} | 35 MojoRunnerState::MojoRunnerState() {} |
29 MojoRunnerState::~MojoRunnerState() {} | 36 MojoRunnerState::~MojoRunnerState() {} |
30 | 37 |
31 void MojoRunnerState::WaitForConnection() { | 38 void MojoRunnerState::WaitForConnection() { |
32 mojo::InterfaceRequest<mojo::Application> application_request; | 39 mojo::InterfaceRequest<mojo::Application> application_request; |
33 runner_connection_.reset( | 40 runner_connection_.reset( |
34 mojo::runner::RunnerConnection::ConnectToRunner(&application_request)); | 41 mojo::runner::RunnerConnection::ConnectToRunner(&application_request)); |
35 application_delegate_.reset(new ChromeApplicationDelegate); | 42 application_delegate_.reset(new ChromeApplicationDelegate); |
36 application_impl_.reset(new mojo::ApplicationImpl( | 43 application_impl_.reset(new mojo::ApplicationImpl( |
37 application_delegate_.get(), application_request.Pass())); | 44 application_delegate_.get(), application_request.Pass())); |
38 application_impl_->WaitForInitialize(); | 45 application_impl_->WaitForInitialize(); |
39 } | 46 } |
OLD | NEW |