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 "mojo/public/cpp/application/application.h" | 7 #include "mojo/public/cpp/application/application.h" |
8 #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h" | 8 #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h" |
9 | 9 |
10 namespace mojo { | 10 namespace mojo { |
11 namespace examples { | 11 namespace examples { |
12 | 12 |
13 // ViewManagerInit is responsible for establishing the initial connection to | 13 // ViewManagerInit is responsible for establishing the initial connection to |
14 // the view manager. When established it loads |mojo_aura_demo|. | 14 // the view manager. When established it loads |mojo_aura_demo|. |
15 class ViewManagerInit : public Application { | 15 class ViewManagerInit : public Application { |
16 public: | 16 public: |
17 ViewManagerInit() {} | 17 ViewManagerInit() {} |
18 virtual ~ViewManagerInit() {} | 18 virtual ~ViewManagerInit() {} |
19 | 19 |
20 virtual void Initialize() OVERRIDE { | 20 virtual void Initialize() OVERRIDE { |
21 ConnectTo("mojo:mojo_view_manager", &view_manager_init_); | 21 ConnectTo("mojo:mojo_view_manager", &view_manager_init_); |
22 view_manager_init_->Connect("mojo:mojo_aura_demo", | 22 view_manager_init_->EmbedRoot("mojo:mojo_aura_demo", |
23 base::Bind(&ViewManagerInit::DidConnect, | 23 base::Bind(&ViewManagerInit::DidConnect, |
24 base::Unretained(this))); | 24 base::Unretained(this))); |
25 } | 25 } |
26 | 26 |
27 private: | 27 private: |
28 void DidConnect(bool result) { | 28 void DidConnect(bool result) { |
29 DCHECK(result); | 29 DCHECK(result); |
30 VLOG(1) << "ViewManagerInit::DidConnection result=" << result; | 30 VLOG(1) << "ViewManagerInit::DidConnection result=" << result; |
31 } | 31 } |
32 | 32 |
33 view_manager::IViewManagerInitPtr view_manager_init_; | 33 view_manager::IViewManagerInitPtr view_manager_init_; |
34 | 34 |
35 DISALLOW_COPY_AND_ASSIGN(ViewManagerInit); | 35 DISALLOW_COPY_AND_ASSIGN(ViewManagerInit); |
36 }; | 36 }; |
37 | 37 |
38 } // namespace examples | 38 } // namespace examples |
39 | 39 |
40 // static | 40 // static |
41 Application* Application::Create() { | 41 Application* Application::Create() { |
42 return new examples::ViewManagerInit(); | 42 return new examples::ViewManagerInit(); |
43 } | 43 } |
44 | 44 |
45 } // namespace mojo | 45 } // namespace mojo |
46 | 46 |
OLD | NEW |