| 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 "mojo/application/application_runner_chromium.h" | 5 #include "mojo/application/application_runner_chromium.h" |
| 6 #include "mojo/public/c/system/main.h" | 6 #include "mojo/public/c/system/main.h" |
| 7 #include "mojo/public/cpp/application/application_delegate.h" | 7 #include "mojo/public/cpp/application/application_delegate.h" |
| 8 #include "mojo/public/cpp/application/application_impl.h" | 8 #include "mojo/public/cpp/application/application_impl.h" |
| 9 #include "mojo/services/public/cpp/view_manager/view_manager.h" | 9 #include "mojo/services/public/cpp/view_manager/view_manager.h" |
| 10 #include "mojo/services/public/cpp/view_manager/view_manager_context.h" | 10 #include "mojo/services/public/cpp/view_manager/view_manager_context.h" |
| 11 | 11 |
| 12 namespace examples { | 12 namespace examples { |
| 13 | 13 |
| 14 // This application starts the view manager, embeds the window manager and then | 14 // This application starts the view manager, embeds the window manager and then |
| 15 // starts another app (wm_flow_app) which also connects to the view manager and | 15 // starts another app (wm_flow_app) which also connects to the view manager and |
| 16 // asks to be embedded without context. | 16 // asks to be embedded without context. |
| 17 class WMFlowInit : public mojo::ApplicationDelegate { | 17 class WMFlowInit : public mojo::ApplicationDelegate { |
| 18 public: | 18 public: |
| 19 WMFlowInit() {} | 19 WMFlowInit() {} |
| 20 virtual ~WMFlowInit() {} | 20 virtual ~WMFlowInit() {} |
| 21 | 21 |
| 22 private: | 22 private: |
| 23 // Overridden from Application: | 23 // Overridden from Application: |
| 24 virtual void Initialize(mojo::ApplicationImpl* app) override { | 24 virtual void Initialize(mojo::ApplicationImpl* app) override { |
| 25 context_.reset(new mojo::ViewManagerContext(app)); | 25 context_.reset(new mojo::ViewManagerContext(app)); |
| 26 context_->Embed("mojo:mojo_wm_flow_wm"); | 26 context_->Embed("mojo:wm_flow_wm"); |
| 27 app->ConnectToApplication("mojo:mojo_wm_flow_app"); | 27 app->ConnectToApplication("mojo:wm_flow_app"); |
| 28 } | 28 } |
| 29 | 29 |
| 30 scoped_ptr<mojo::ViewManagerContext> context_; | 30 scoped_ptr<mojo::ViewManagerContext> context_; |
| 31 | 31 |
| 32 DISALLOW_COPY_AND_ASSIGN(WMFlowInit); | 32 DISALLOW_COPY_AND_ASSIGN(WMFlowInit); |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 } // namespace examples | 35 } // namespace examples |
| 36 | 36 |
| 37 MojoResult MojoMain(MojoHandle shell_handle) { | 37 MojoResult MojoMain(MojoHandle shell_handle) { |
| 38 mojo::ApplicationRunnerChromium runner(new examples::WMFlowInit); | 38 mojo::ApplicationRunnerChromium runner(new examples::WMFlowInit); |
| 39 return runner.Run(shell_handle); | 39 return runner.Run(shell_handle); |
| 40 } | 40 } |
| OLD | NEW |