OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "base/bind.h" |
| 6 #include "mojo/public/cpp/application/application_delegate.h" |
| 7 #include "mojo/public/cpp/application/application_impl.h" |
| 8 #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h" |
| 9 |
| 10 namespace examples { |
| 11 namespace { |
| 12 void ConnectCallback(bool success) {} |
| 13 } // namespace |
| 14 |
| 15 // This application starts the view manager, embeds the window manager and then |
| 16 // starts another app (wm_flow_app) which also connects to the view manager and |
| 17 // asks to be embedded without context. |
| 18 class WMFlowInit : public mojo::ApplicationDelegate { |
| 19 public: |
| 20 WMFlowInit() {} |
| 21 virtual ~WMFlowInit() {} |
| 22 |
| 23 private: |
| 24 // Overridden from Application: |
| 25 virtual void Initialize(mojo::ApplicationImpl* app) MOJO_OVERRIDE { |
| 26 app->ConnectToService("mojo:mojo_view_manager", &view_manager_init_); |
| 27 view_manager_init_->Embed("mojo:mojo_wm_flow_wm", |
| 28 base::Bind(&ConnectCallback)); |
| 29 app->ConnectToApplication("mojo:mojo_wm_flow_app"); |
| 30 } |
| 31 |
| 32 void OnConnect(bool success) {} |
| 33 |
| 34 mojo::view_manager::ViewManagerInitServicePtr view_manager_init_; |
| 35 |
| 36 DISALLOW_COPY_AND_ASSIGN(WMFlowInit); |
| 37 }; |
| 38 |
| 39 } // namespace examples |
| 40 |
| 41 namespace mojo { |
| 42 |
| 43 // static |
| 44 ApplicationDelegate* ApplicationDelegate::Create() { |
| 45 return new examples::WMFlowInit; |
| 46 } |
| 47 |
| 48 } // namespace |
OLD | NEW |