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 #ifndef COMPONENTS_RESOURCE_PROVIDER_RESOURCE_PROVIDER_APP_H_ | 5 #ifndef COMPONENTS_RESOURCE_PROVIDER_RESOURCE_PROVIDER_APP_H_ |
6 #define COMPONENTS_RESOURCE_PROVIDER_RESOURCE_PROVIDER_APP_H_ | 6 #define COMPONENTS_RESOURCE_PROVIDER_RESOURCE_PROVIDER_APP_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "components/resource_provider/public/interfaces/resource_provider.mojom
.h" | 11 #include "components/resource_provider/public/interfaces/resource_provider.mojom
.h" |
12 #include "mojo/common/weak_binding_set.h" | 12 #include "mojo/common/weak_binding_set.h" |
13 #include "mojo/public/cpp/bindings/binding.h" | 13 #include "mojo/public/cpp/bindings/binding.h" |
14 #include "mojo/services/tracing/public/cpp/tracing_impl.h" | 14 #include "mojo/services/tracing/public/cpp/tracing_impl.h" |
15 #include "mojo/shell/public/cpp/application_delegate.h" | |
16 #include "mojo/shell/public/cpp/interface_factory.h" | 15 #include "mojo/shell/public/cpp/interface_factory.h" |
| 16 #include "mojo/shell/public/cpp/shell_client.h" |
17 | 17 |
18 namespace mojo { | 18 namespace mojo { |
19 class Shell; | 19 class Shell; |
20 } | 20 } |
21 | 21 |
22 namespace resource_provider { | 22 namespace resource_provider { |
23 | 23 |
24 class ResourceProviderApp : public mojo::ApplicationDelegate, | 24 class ResourceProviderApp : public mojo::ShellClient, |
25 public mojo::InterfaceFactory<ResourceProvider> { | 25 public mojo::InterfaceFactory<ResourceProvider> { |
26 public: | 26 public: |
27 explicit ResourceProviderApp(const std::string& resource_provider_app_url); | 27 explicit ResourceProviderApp(const std::string& resource_provider_app_url); |
28 ~ResourceProviderApp() override; | 28 ~ResourceProviderApp() override; |
29 | 29 |
30 private: | 30 private: |
31 // ApplicationDelegate: | 31 // mojo::ShellClient: |
32 void Initialize(mojo::Shell* shell, const std::string& url, | 32 void Initialize(mojo::Shell* shell, const std::string& url, |
33 uint32_t id) override; | 33 uint32_t id) override; |
34 bool AcceptConnection( | 34 bool AcceptConnection(mojo::Connection* connection) override; |
35 mojo::ApplicationConnection* connection) override; | |
36 | 35 |
37 // mojo::InterfaceFactory<ResourceProvider>: | 36 // mojo::InterfaceFactory<ResourceProvider>: |
38 void Create(mojo::ApplicationConnection* connection, | 37 void Create(mojo::Connection* connection, |
39 mojo::InterfaceRequest<ResourceProvider> request) override; | 38 mojo::InterfaceRequest<ResourceProvider> request) override; |
40 | 39 |
41 mojo::TracingImpl tracing_; | 40 mojo::TracingImpl tracing_; |
42 | 41 |
43 mojo::WeakBindingSet<ResourceProvider> bindings_; | 42 mojo::WeakBindingSet<ResourceProvider> bindings_; |
44 | 43 |
45 // The name of the app that the resource provider code lives in. When using | 44 // The name of the app that the resource provider code lives in. When using |
46 // core services, it'll be the url of that. Otherwise it'll just be | 45 // core services, it'll be the url of that. Otherwise it'll just be |
47 // mojo:resource_provider. | 46 // mojo:resource_provider. |
48 std::string resource_provider_app_url_; | 47 std::string resource_provider_app_url_; |
49 | 48 |
50 DISALLOW_COPY_AND_ASSIGN(ResourceProviderApp); | 49 DISALLOW_COPY_AND_ASSIGN(ResourceProviderApp); |
51 }; | 50 }; |
52 | 51 |
53 } // namespace resource_provider | 52 } // namespace resource_provider |
54 | 53 |
55 #endif // COMPONENTS_RESOURCE_PROVIDER_RESOURCE_PROVIDER_APP_H_ | 54 #endif // COMPONENTS_RESOURCE_PROVIDER_RESOURCE_PROVIDER_APP_H_ |
OLD | NEW |