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 #ifndef MOJO_PUBLIC_CPP_APPLICATION_APPLICATION_IMPL_H_ | 5 #ifndef MOJO_PUBLIC_CPP_APPLICATION_APPLICATION_IMPL_H_ |
6 #define MOJO_PUBLIC_CPP_APPLICATION_APPLICATION_IMPL_H_ | 6 #define MOJO_PUBLIC_CPP_APPLICATION_APPLICATION_IMPL_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "mojo/public/cpp/application/application_delegate.h" | 12 #include "mojo/public/cpp/application/application_delegate.h" |
13 #include "mojo/public/cpp/application/lib/service_registry.h" | 13 #include "mojo/public/cpp/application/lib/service_registry.h" |
14 #include "mojo/public/cpp/system/macros.h" | 14 #include "mojo/public/cpp/system/macros.h" |
15 #include "mojo/public/interfaces/application/application.mojom.h" | 15 #include "mojo/public/interfaces/application/application.mojom.h" |
16 #include "mojo/public/interfaces/application/application_connector.mojom.h" | 16 #include "mojo/public/interfaces/application/application_connector.mojom.h" |
17 #include "mojo/public/interfaces/application/shell.mojom.h" | 17 #include "mojo/public/interfaces/application/shell.mojom.h" |
18 | 18 |
19 namespace mojo { | 19 namespace mojo { |
20 | 20 |
21 // Implements the Application interface, which the shell uses for basic | 21 // Implements the Application interface, which the shell uses for basic |
22 // communication with an application (e.g., to connect clients to services | 22 // communication with an application (e.g., to connect clients to services |
23 // provided by an application). Also provides the application access to the | 23 // provided by an application). Also provides the application access to the |
24 // Shell, which, e.g., may be used by an application to connect to other | 24 // Shell, which, e.g., may be used by an application to connect to other |
25 // services. | 25 // services. |
26 // | 26 // |
27 // Typically, you create one or more classes implementing your APIs (e.g., | 27 // Typically, you create one or more classes implementing your APIs (e.g., |
28 // FooImpl implementing Foo). See bindings/binding.h for more information. Then | 28 // FooImpl implementing Foo). See bindings/binding.h for more information. Then |
29 // you implement an mojo::ApplicationDelegate that either is or owns a | 29 // you implement an mojo::ApplicationDelegate whose |
30 // mojo::InterfaceFactory<Foo> and whose ConfigureIncomingConnection() adds that | 30 // ConfigureIncomingConnection() adds services to each connection. Finally, you |
31 // factory to each connection. Finally, you instantiate your delegate and pass | 31 // instantiate your delegate and pass it to an ApplicationRunner, which will |
32 // it to an ApplicationRunner, which will create the ApplicationImpl and then | 32 // create the ApplicationImpl and then run a message (or run) loop. |
33 // run a message (or run) loop. | |
34 class ApplicationImpl : public Application { | 33 class ApplicationImpl : public Application { |
35 public: | 34 public: |
36 // Does not take ownership of |delegate|, which must remain valid for the | 35 // Does not take ownership of |delegate|, which must remain valid for the |
37 // lifetime of ApplicationImpl. | 36 // lifetime of ApplicationImpl. |
38 ApplicationImpl(ApplicationDelegate* delegate, | 37 ApplicationImpl(ApplicationDelegate* delegate, |
39 InterfaceRequest<Application> request); | 38 InterfaceRequest<Application> request); |
40 ~ApplicationImpl() override; | 39 ~ApplicationImpl() override; |
41 | 40 |
42 // Quits the main run loop for this application. | 41 // Quits the main run loop for this application. |
43 // TODO(vtl): This is implemented in application_runner.cc (for example). Its | 42 // TODO(vtl): This is implemented in application_runner.cc (for example). Its |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 ShellPtr shell_; | 89 ShellPtr shell_; |
91 std::string url_; | 90 std::string url_; |
92 std::vector<std::string> args_; | 91 std::vector<std::string> args_; |
93 | 92 |
94 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationImpl); | 93 MOJO_DISALLOW_COPY_AND_ASSIGN(ApplicationImpl); |
95 }; | 94 }; |
96 | 95 |
97 } // namespace mojo | 96 } // namespace mojo |
98 | 97 |
99 #endif // MOJO_PUBLIC_CPP_APPLICATION_APPLICATION_IMPL_H_ | 98 #endif // MOJO_PUBLIC_CPP_APPLICATION_APPLICATION_IMPL_H_ |
OLD | NEW |