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/bind.h" | 5 #include "base/bind.h" |
6 #include "mojo/examples/wm_flow/app/embedder.mojom.h" | 6 #include "mojo/examples/wm_flow/app/embedder.mojom.h" |
7 #include "mojo/examples/wm_flow/embedded/embeddee.mojom.h" | 7 #include "mojo/examples/wm_flow/embedded/embeddee.mojom.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" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 public: | 49 public: |
50 WMFlowApp() | 50 WMFlowApp() |
51 : embed_count_(0), | 51 : embed_count_(0), |
52 view_manager_client_factory_(this) {} | 52 view_manager_client_factory_(this) {} |
53 virtual ~WMFlowApp() {} | 53 virtual ~WMFlowApp() {} |
54 | 54 |
55 private: | 55 private: |
56 // Overridden from Application: | 56 // Overridden from Application: |
57 virtual void Initialize(mojo::ApplicationImpl* app) MOJO_OVERRIDE { | 57 virtual void Initialize(mojo::ApplicationImpl* app) MOJO_OVERRIDE { |
58 mojo::ServiceProviderPtr sp; | 58 mojo::ServiceProviderPtr sp; |
59 app->ConnectToService("mojo:mojo_view_manager", &init_svc_); | 59 mojo::ViewManagerInitServicePtr init_svc; |
60 init_svc_->Embed("mojo:mojo_wm_flow_app", sp.Pass(), | 60 app->ConnectToService("mojo:mojo_view_manager", &init_svc); |
61 base::Bind(&ConnectCallback)); | 61 init_svc->Embed("mojo:mojo_wm_flow_app", sp.Pass(), |
| 62 base::Bind(&ConnectCallback)); |
62 } | 63 } |
63 virtual bool ConfigureIncomingConnection( | 64 virtual bool ConfigureIncomingConnection( |
64 mojo::ApplicationConnection* connection) MOJO_OVERRIDE { | 65 mojo::ApplicationConnection* connection) MOJO_OVERRIDE { |
65 connection->AddService(&view_manager_client_factory_); | 66 connection->AddService(&view_manager_client_factory_); |
66 return true; | 67 return true; |
67 } | 68 } |
68 | 69 |
69 void OnConnect(bool success) {} | 70 void OnConnect(bool success) {} |
70 | 71 |
71 // Overridden from mojo::ViewManagerDelegate: | 72 // Overridden from mojo::ViewManagerDelegate: |
(...skipping 24 matching lines...) Expand all Loading... |
96 mojo::ViewManager* view_manager) MOJO_OVERRIDE {} | 97 mojo::ViewManager* view_manager) MOJO_OVERRIDE {} |
97 | 98 |
98 void HelloBackAck() { | 99 void HelloBackAck() { |
99 printf("HelloBack() ack'ed\n"); | 100 printf("HelloBack() ack'ed\n"); |
100 } | 101 } |
101 | 102 |
102 int embed_count_; | 103 int embed_count_; |
103 mojo::ViewManagerClientFactory view_manager_client_factory_; | 104 mojo::ViewManagerClientFactory view_manager_client_factory_; |
104 mojo::InterfaceFactoryImpl<EmbedderImpl> embedder_factory_; | 105 mojo::InterfaceFactoryImpl<EmbedderImpl> embedder_factory_; |
105 EmbeddeePtr embeddee_; | 106 EmbeddeePtr embeddee_; |
106 mojo::ViewManagerInitServicePtr init_svc_; | |
107 | 107 |
108 DISALLOW_COPY_AND_ASSIGN(WMFlowApp); | 108 DISALLOW_COPY_AND_ASSIGN(WMFlowApp); |
109 }; | 109 }; |
110 | 110 |
111 } // namespace examples | 111 } // namespace examples |
112 | 112 |
113 namespace mojo { | 113 namespace mojo { |
114 | 114 |
115 // static | 115 // static |
116 ApplicationDelegate* ApplicationDelegate::Create() { | 116 ApplicationDelegate* ApplicationDelegate::Create() { |
117 return new examples::WMFlowApp; | 117 return new examples::WMFlowApp; |
118 } | 118 } |
119 | 119 |
120 } // namespace | 120 } // namespace |
OLD | NEW |