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/services/public/interfaces/view_manager/view_manager.mojom.h" | 11 #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h" |
12 | 12 |
13 namespace mojo { | 13 namespace mojo { |
14 namespace examples { | 14 namespace examples { |
15 | 15 |
16 class DemoLauncher : public ApplicationDelegate { | 16 class DemoLauncher : public ApplicationDelegate { |
17 public: | 17 public: |
18 DemoLauncher() {} | 18 DemoLauncher() {} |
19 virtual ~DemoLauncher() {} | 19 virtual ~DemoLauncher() {} |
20 | 20 |
21 private: | 21 private: |
22 virtual void Initialize(ApplicationImpl* app) MOJO_OVERRIDE { | 22 virtual void Initialize(ApplicationImpl* app) MOJO_OVERRIDE { |
23 app->ConnectToService("mojo:mojo_view_manager", &view_manager_init_); | 23 app->ConnectToService("mojo:mojo_view_manager", &view_manager_init_); |
24 } | 24 } |
25 | 25 |
26 virtual bool ConfigureIncomingConnection(ApplicationConnection* connection) | 26 virtual bool ConfigureIncomingConnection(ApplicationConnection* connection) |
27 MOJO_OVERRIDE { | 27 MOJO_OVERRIDE { |
28 view_manager_init_->EmbedRoot("mojo:mojo_window_manager", | 28 view_manager_init_->Embed("mojo:mojo_window_manager", |
29 base::Bind(&DemoLauncher::OnConnect, | 29 base::Bind(&DemoLauncher::OnConnect, |
30 base::Unretained(this))); | 30 base::Unretained(this))); |
31 return true; | 31 return true; |
32 } | 32 } |
33 | 33 |
34 void OnConnect(bool success) {} | 34 void OnConnect(bool success) {} |
35 | 35 |
36 view_manager::ViewManagerInitServicePtr view_manager_init_; | 36 view_manager::ViewManagerInitServicePtr view_manager_init_; |
37 | 37 |
38 DISALLOW_COPY_AND_ASSIGN(DemoLauncher); | 38 DISALLOW_COPY_AND_ASSIGN(DemoLauncher); |
39 }; | 39 }; |
40 | 40 |
41 } // namespace examples | 41 } // namespace examples |
42 | 42 |
43 // static | 43 // static |
44 ApplicationDelegate* ApplicationDelegate::Create() { | 44 ApplicationDelegate* ApplicationDelegate::Create() { |
45 return new examples::DemoLauncher; | 45 return new examples::DemoLauncher; |
46 } | 46 } |
47 | 47 |
48 } // namespace mojo | 48 } // namespace mojo |
OLD | NEW |