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_SHELL_APPLICATION_H_ | 5 #ifndef MOJO_PUBLIC_SHELL_APPLICATION_H_ |
6 #define MOJO_PUBLIC_SHELL_APPLICATION_H_ | 6 #define MOJO_PUBLIC_SHELL_APPLICATION_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "mojo/public/bindings/remote_ptr.h" | 10 #include "mojo/public/bindings/remote_ptr.h" |
11 #include "mojo/public/shell/service.h" | 11 #include "mojo/public/shell/service.h" |
12 #include "mojo/public/system/core_cpp.h" | 12 #include "mojo/public/system/core_cpp.h" |
13 #include "mojom/shell.h" | 13 #include "mojom/shell.h" |
14 | 14 |
15 namespace mojo { | 15 namespace mojo { |
16 | 16 |
17 class Application : public internal::ServiceFactoryBase::Owner, | 17 class Application : public internal::ServiceFactoryBase::Owner { |
18 public ShellClient { | |
19 public: | 18 public: |
20 explicit Application(ScopedShellHandle shell_handle); | 19 explicit Application(ScopedShellHandle shell_handle); |
21 explicit Application(MojoHandle shell_handle); | 20 explicit Application(MojoHandle shell_handle); |
22 virtual ~Application(); | 21 virtual ~Application(); |
23 | 22 |
24 // internal::ServiceFactoryBase::Owner methods. | 23 // internal::ServiceFactoryBase::Owner methods. |
25 virtual Shell* GetShell() MOJO_OVERRIDE; | |
26 // Takes ownership of |service_factory|. | 24 // Takes ownership of |service_factory|. |
27 virtual void AddServiceFactory(internal::ServiceFactoryBase* service_factory) | 25 virtual void AddServiceFactory(internal::ServiceFactoryBase* service_factory) |
28 MOJO_OVERRIDE; | 26 MOJO_OVERRIDE; |
29 virtual void RemoveServiceFactory( | 27 virtual void RemoveServiceFactory( |
30 internal::ServiceFactoryBase* service_factory) MOJO_OVERRIDE; | 28 internal::ServiceFactoryBase* service_factory) MOJO_OVERRIDE; |
31 | 29 |
32 protected: | 30 protected: |
33 // ShellClient methods. | 31 // ShellClient methods. |
34 virtual void AcceptConnection(const mojo::String& url, | 32 virtual void AcceptConnection(const mojo::String& url, |
35 ScopedMessagePipeHandle client_handle) | 33 ScopedMessagePipeHandle client_handle) |
36 MOJO_OVERRIDE; | 34 MOJO_OVERRIDE; |
37 | 35 |
38 private: | 36 private: |
39 typedef std::vector<internal::ServiceFactoryBase*> ServiceFactoryList; | 37 typedef std::vector<internal::ServiceFactoryBase*> ServiceFactoryList; |
40 ServiceFactoryList service_factories_; | 38 ServiceFactoryList service_factories_; |
41 RemotePtr<Shell> shell_; | |
42 }; | 39 }; |
43 | 40 |
44 } // namespace mojo | 41 } // namespace mojo |
45 | 42 |
46 #endif // MOJO_PUBLIC_SHELL_APPLICATION_H_ | 43 #endif // MOJO_PUBLIC_SHELL_APPLICATION_H_ |
OLD | NEW |