| 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/weak_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 { | 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::ShellClient, | 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 // mojo::ShellClient: | 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, uint32_t user_id) override; | 33 uint32_t id, uint32_t user_id) override; |
| 34 bool AcceptConnection(mojo::Connection* connection) override; | 34 bool AcceptConnection(mojo::Connection* connection) override; |
| 35 | 35 |
| 36 // mojo::InterfaceFactory<ResourceProvider>: | 36 // mojo::InterfaceFactory<ResourceProvider>: |
| 37 void Create(mojo::Connection* connection, | 37 void Create(mojo::Connection* connection, |
| 38 mojo::InterfaceRequest<ResourceProvider> request) override; | 38 mojo::InterfaceRequest<ResourceProvider> request) override; |
| 39 | 39 |
| 40 mojo::TracingImpl tracing_; | 40 mojo::TracingImpl tracing_; |
| 41 | 41 |
| 42 mojo::WeakBindingSet<ResourceProvider> bindings_; | 42 mojo::BindingSet<ResourceProvider> bindings_; |
| 43 | 43 |
| 44 // 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 |
| 45 // 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 |
| 46 // mojo:resource_provider. | 46 // mojo:resource_provider. |
| 47 std::string resource_provider_app_url_; | 47 std::string resource_provider_app_url_; |
| 48 | 48 |
| 49 DISALLOW_COPY_AND_ASSIGN(ResourceProviderApp); | 49 DISALLOW_COPY_AND_ASSIGN(ResourceProviderApp); |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 } // namespace resource_provider | 52 } // namespace resource_provider |
| 53 | 53 |
| 54 #endif // COMPONENTS_RESOURCE_PROVIDER_RESOURCE_PROVIDER_APP_H_ | 54 #endif // COMPONENTS_RESOURCE_PROVIDER_RESOURCE_PROVIDER_APP_H_ |
| OLD | NEW |