OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 // This is a simple example application (with an embeddable view), which embeds | 5 // This is a simple example application (with an embeddable view), which embeds |
6 // the Moterm view, uses it to prompt the user, etc. | 6 // the Moterm view, uses it to prompt the user, etc. |
7 | 7 |
8 #include <string.h> | 8 #include <string.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
11 #include <utility> | 11 #include <utility> |
12 | 12 |
13 #include "base/bind.h" | 13 #include "base/bind.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
17 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
18 #include "mojo/application/application_runner_chromium.h" | |
19 #include "mojo/common/binding_set.h" | 18 #include "mojo/common/binding_set.h" |
| 19 #include "mojo/environment/scoped_chromium_init.h" |
20 #include "mojo/public/c/system/main.h" | 20 #include "mojo/public/c/system/main.h" |
21 #include "mojo/public/cpp/application/application_delegate.h" | |
22 #include "mojo/public/cpp/application/application_impl.h" | |
23 #include "mojo/public/cpp/application/connect.h" | 21 #include "mojo/public/cpp/application/connect.h" |
| 22 #include "mojo/public/cpp/application/run_application.h" |
24 #include "mojo/public/cpp/bindings/array.h" | 23 #include "mojo/public/cpp/bindings/array.h" |
25 #include "mojo/public/cpp/bindings/strong_binding.h" | 24 #include "mojo/public/cpp/bindings/strong_binding.h" |
26 #include "mojo/public/interfaces/application/service_provider.mojom.h" | 25 #include "mojo/public/interfaces/application/service_provider.mojom.h" |
27 #include "mojo/public/interfaces/application/shell.mojom.h" | 26 #include "mojo/public/interfaces/application/shell.mojom.h" |
28 #include "mojo/services/files/interfaces/file.mojom.h" | 27 #include "mojo/services/files/interfaces/file.mojom.h" |
29 #include "mojo/services/files/interfaces/types.mojom.h" | 28 #include "mojo/services/files/interfaces/types.mojom.h" |
30 #include "mojo/services/terminal/interfaces/terminal.mojom.h" | 29 #include "mojo/services/terminal/interfaces/terminal.mojom.h" |
31 #include "mojo/services/terminal/interfaces/terminal_client.mojom.h" | 30 #include "mojo/services/terminal/interfaces/terminal_client.mojom.h" |
32 #include "mojo/services/ui/views/interfaces/view_manager.mojom.h" | 31 #include "mojo/services/ui/views/interfaces/view_manager.mojom.h" |
33 #include "mojo/services/ui/views/interfaces/view_provider.mojom.h" | 32 #include "mojo/services/ui/views/interfaces/view_provider.mojom.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 class MotermExampleApp : public mojo::ui::ViewProviderApp { | 158 class MotermExampleApp : public mojo::ui::ViewProviderApp { |
160 public: | 159 public: |
161 MotermExampleApp() {} | 160 MotermExampleApp() {} |
162 ~MotermExampleApp() override {} | 161 ~MotermExampleApp() override {} |
163 | 162 |
164 // |ViewProviderApp|: | 163 // |ViewProviderApp|: |
165 void CreateView( | 164 void CreateView( |
166 const std::string& connection_url, | 165 const std::string& connection_url, |
167 mojo::InterfaceRequest<mojo::ui::ViewOwner> view_owner_request, | 166 mojo::InterfaceRequest<mojo::ui::ViewOwner> view_owner_request, |
168 mojo::InterfaceRequest<mojo::ServiceProvider> services) override { | 167 mojo::InterfaceRequest<mojo::ServiceProvider> services) override { |
169 new MotermExampleAppView(app_impl()->shell(), view_owner_request.Pass()); | 168 new MotermExampleAppView(shell(), view_owner_request.Pass()); |
170 } | 169 } |
171 | 170 |
172 private: | 171 private: |
173 DISALLOW_COPY_AND_ASSIGN(MotermExampleApp); | 172 DISALLOW_COPY_AND_ASSIGN(MotermExampleApp); |
174 }; | 173 }; |
175 | 174 |
176 MojoResult MojoMain(MojoHandle application_request) { | 175 MojoResult MojoMain(MojoHandle application_request) { |
177 mojo::ApplicationRunnerChromium runner(new MotermExampleApp()); | 176 mojo::ScopedChromiumInit init; |
178 return runner.Run(application_request); | 177 MotermExampleApp moterm_example_app; |
| 178 return mojo::RunApplication(application_request, &moterm_example_app); |
179 } | 179 } |
OLD | NEW |