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" | 15 #include "mojo/shell/public/cpp/application_delegate.h" |
16 #include "mojo/shell/public/cpp/interface_factory.h" | 16 #include "mojo/shell/public/cpp/interface_factory.h" |
17 | 17 |
18 namespace mojo { | 18 namespace mojo { |
19 class ApplicationImpl; | 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::ApplicationDelegate, |
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 // ApplicationDelegate: |
32 void Initialize(mojo::ApplicationImpl* app) override; | 32 void Initialize(mojo::Shell* shell, const std::string& url, |
| 33 uint32_t id) override; |
33 bool AcceptConnection( | 34 bool AcceptConnection( |
34 mojo::ApplicationConnection* connection) override; | 35 mojo::ApplicationConnection* connection) override; |
35 | 36 |
36 // mojo::InterfaceFactory<ResourceProvider>: | 37 // mojo::InterfaceFactory<ResourceProvider>: |
37 void Create(mojo::ApplicationConnection* connection, | 38 void Create(mojo::ApplicationConnection* connection, |
38 mojo::InterfaceRequest<ResourceProvider> request) override; | 39 mojo::InterfaceRequest<ResourceProvider> request) override; |
39 | 40 |
40 mojo::TracingImpl tracing_; | 41 mojo::TracingImpl tracing_; |
41 | 42 |
42 mojo::WeakBindingSet<ResourceProvider> bindings_; | 43 mojo::WeakBindingSet<ResourceProvider> bindings_; |
43 | 44 |
44 // The name of the app that the resource provider code lives in. When using | 45 // The name of the app that the resource provider code lives in. When using |
45 // core services, it'll be the url of that. Otherwise it'll just be | 46 // core services, it'll be the url of that. Otherwise it'll just be |
46 // mojo:resource_provider. | 47 // mojo:resource_provider. |
47 std::string resource_provider_app_url_; | 48 std::string resource_provider_app_url_; |
48 | 49 |
49 DISALLOW_COPY_AND_ASSIGN(ResourceProviderApp); | 50 DISALLOW_COPY_AND_ASSIGN(ResourceProviderApp); |
50 }; | 51 }; |
51 | 52 |
52 } // namespace resource_provider | 53 } // namespace resource_provider |
53 | 54 |
54 #endif // COMPONENTS_RESOURCE_PROVIDER_RESOURCE_PROVIDER_APP_H_ | 55 #endif // COMPONENTS_RESOURCE_PROVIDER_RESOURCE_PROVIDER_APP_H_ |
OLD | NEW |