OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "mojo/public/cpp/application/application_connection.h" | 8 #include "mojo/public/cpp/application/application_connection.h" |
9 #include "mojo/public/cpp/application/application_delegate.h" | 9 #include "mojo/public/cpp/application/application_delegate.h" |
10 #include "mojo/public/cpp/application/application_impl.h" | 10 #include "mojo/public/cpp/application/application_impl.h" |
| 11 #include "mojo/public/cpp/application/service_provider_impl.h" |
| 12 #include "mojo/public/interfaces/application/service_provider.mojom.h" |
11 #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h" | 13 #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h" |
12 | 14 |
13 namespace mojo { | 15 namespace mojo { |
14 namespace examples { | 16 namespace examples { |
15 | 17 |
16 class DemoLauncher : public ApplicationDelegate { | 18 class DemoLauncher : public ApplicationDelegate { |
17 public: | 19 public: |
18 DemoLauncher() {} | 20 DemoLauncher() {} |
19 virtual ~DemoLauncher() {} | 21 virtual ~DemoLauncher() {} |
20 | 22 |
21 private: | 23 private: |
22 virtual void Initialize(ApplicationImpl* app) MOJO_OVERRIDE { | 24 virtual void Initialize(ApplicationImpl* app) MOJO_OVERRIDE { |
23 app->ConnectToService("mojo:mojo_view_manager", &view_manager_init_); | 25 app->ConnectToService("mojo:mojo_view_manager", &view_manager_init_); |
24 } | 26 } |
25 | 27 |
26 virtual bool ConfigureIncomingConnection(ApplicationConnection* connection) | 28 virtual bool ConfigureIncomingConnection(ApplicationConnection* connection) |
27 MOJO_OVERRIDE { | 29 MOJO_OVERRIDE { |
28 view_manager_init_->Embed("mojo:mojo_window_manager", | 30 ServiceProviderPtr sp; |
| 31 BindToProxy(new ServiceProviderImpl, &sp); |
| 32 view_manager_init_->Embed("mojo:mojo_window_manager", sp.Pass(), |
29 base::Bind(&DemoLauncher::OnConnect, | 33 base::Bind(&DemoLauncher::OnConnect, |
30 base::Unretained(this))); | 34 base::Unretained(this))); |
31 return true; | 35 return true; |
32 } | 36 } |
33 | 37 |
34 void OnConnect(bool success) {} | 38 void OnConnect(bool success) {} |
35 | 39 |
36 ViewManagerInitServicePtr view_manager_init_; | 40 ViewManagerInitServicePtr view_manager_init_; |
37 | 41 |
38 DISALLOW_COPY_AND_ASSIGN(DemoLauncher); | 42 DISALLOW_COPY_AND_ASSIGN(DemoLauncher); |
39 }; | 43 }; |
40 | 44 |
41 } // namespace examples | 45 } // namespace examples |
42 | 46 |
43 // static | 47 // static |
44 ApplicationDelegate* ApplicationDelegate::Create() { | 48 ApplicationDelegate* ApplicationDelegate::Create() { |
45 return new examples::DemoLauncher; | 49 return new examples::DemoLauncher; |
46 } | 50 } |
47 | 51 |
48 } // namespace mojo | 52 } // namespace mojo |
OLD | NEW |