blob: 5861abe2470be40d1e5ece74bfcde0cf58f46583 [file] [log] [blame]
sky63795ba2015-05-02 16:29:031// Copyright 2015 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef COMPONENTS_RESOURCE_PROVIDER_RESOURCE_PROVIDER_APP_H_
6#define COMPONENTS_RESOURCE_PROVIDER_RESOURCE_PROVIDER_APP_H_
7
8#include <map>
9
avif57136c12015-12-25 23:27:4510#include "base/macros.h"
sky63795ba2015-05-02 16:29:0311#include "components/resource_provider/public/interfaces/resource_provider.mojom.h"
rockot85dce0862015-11-13 01:33:5912#include "mojo/public/cpp/bindings/binding.h"
yzshend414dc342016-02-25 07:29:2713#include "mojo/public/cpp/bindings/binding_set.h"
benf709a3092016-04-12 22:38:2214#include "services/shell/public/cpp/interface_factory.h"
15#include "services/shell/public/cpp/shell_client.h"
ben7095d1a2016-04-13 06:14:5816#include "services/tracing/public/cpp/tracing_impl.h"
sky63795ba2015-05-02 16:29:0317
sky63795ba2015-05-02 16:29:0318namespace resource_provider {
19
bendbcf6eb2016-02-07 15:50:0420class ResourceProviderApp : public mojo::ShellClient,
sky63795ba2015-05-02 16:29:0321 public mojo::InterfaceFactory<ResourceProvider> {
22 public:
jam7d1f8ac2015-07-16 21:48:2223 explicit ResourceProviderApp(const std::string& resource_provider_app_url);
sky63795ba2015-05-02 16:29:0324 ~ResourceProviderApp() override;
25
26 private:
bendbcf6eb2016-02-07 15:50:0427 // mojo::ShellClient:
ben9a8e15f62016-03-08 05:17:4828 void Initialize(mojo::Connector* connector, const mojo::Identity& identity,
29 uint32_t id) override;
bendbcf6eb2016-02-07 15:50:0430 bool AcceptConnection(mojo::Connection* connection) override;
sky63795ba2015-05-02 16:29:0331
32 // mojo::InterfaceFactory<ResourceProvider>:
bendbcf6eb2016-02-07 15:50:0433 void Create(mojo::Connection* connection,
sky63795ba2015-05-02 16:29:0334 mojo::InterfaceRequest<ResourceProvider> request) override;
35
erg8d23e412015-11-18 22:46:5736 mojo::TracingImpl tracing_;
37
yzshend414dc342016-02-25 07:29:2738 mojo::BindingSet<ResourceProvider> bindings_;
sky63795ba2015-05-02 16:29:0339
jam7d1f8ac2015-07-16 21:48:2240 // The name of the app that the resource provider code lives in. When using
41 // core services, it'll be the url of that. Otherwise it'll just be
42 // mojo:resource_provider.
43 std::string resource_provider_app_url_;
44
sky63795ba2015-05-02 16:29:0345 DISALLOW_COPY_AND_ASSIGN(ResourceProviderApp);
46};
47
48} // namespace resource_provider
49
50#endif // COMPONENTS_RESOURCE_PROVIDER_RESOURCE_PROVIDER_APP_H_