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