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_FONT_SERVICE_FONT_SERVICE_APP_H_ | 5 #ifndef COMPONENTS_FONT_SERVICE_FONT_SERVICE_APP_H_ |
6 #define COMPONENTS_FONT_SERVICE_FONT_SERVICE_APP_H_ | 6 #define COMPONENTS_FONT_SERVICE_FONT_SERVICE_APP_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "components/font_service/public/interfaces/font_service.mojom.h" | 12 #include "components/font_service/public/interfaces/font_service.mojom.h" |
13 #include "mojo/public/cpp/bindings/binding_set.h" | 13 #include "mojo/public/cpp/bindings/binding_set.h" |
| 14 #include "services/service_manager/public/cpp/binder_registry.h" |
14 #include "services/service_manager/public/cpp/interface_factory.h" | 15 #include "services/service_manager/public/cpp/interface_factory.h" |
15 #include "services/service_manager/public/cpp/service.h" | 16 #include "services/service_manager/public/cpp/service.h" |
16 #include "services/tracing/public/cpp/provider.h" | 17 #include "services/tracing/public/cpp/provider.h" |
17 #include "skia/ext/skia_utils_base.h" | 18 #include "skia/ext/skia_utils_base.h" |
18 | 19 |
19 namespace font_service { | 20 namespace font_service { |
20 | 21 |
21 class FontServiceApp | 22 class FontServiceApp |
22 : public service_manager::Service, | 23 : public service_manager::Service, |
23 public service_manager::InterfaceFactory<mojom::FontService>, | 24 public service_manager::InterfaceFactory<mojom::FontService>, |
24 public mojom::FontService { | 25 public mojom::FontService { |
25 public: | 26 public: |
26 FontServiceApp(); | 27 FontServiceApp(); |
27 ~FontServiceApp() override; | 28 ~FontServiceApp() override; |
28 | 29 |
29 private: | 30 private: |
30 // service_manager::Service: | 31 // service_manager::Service: |
31 void OnStart() override; | 32 void OnStart() override; |
32 bool OnConnect(const service_manager::ServiceInfo& remote_info, | 33 void OnBindInterface(const service_manager::ServiceInfo& source_info, |
33 service_manager::InterfaceRegistry* registry) override; | 34 const std::string& interface_name, |
| 35 mojo::ScopedMessagePipeHandle interface_pipe) override; |
34 | 36 |
35 // service_manager::InterfaceFactory<mojom::FontService>: | 37 // service_manager::InterfaceFactory<mojom::FontService>: |
36 void Create(const service_manager::Identity& remote_identity, | 38 void Create(const service_manager::Identity& remote_identity, |
37 mojo::InterfaceRequest<mojom::FontService> request) override; | 39 mojo::InterfaceRequest<mojom::FontService> request) override; |
38 | 40 |
39 // FontService: | 41 // FontService: |
40 void MatchFamilyName(const std::string& family_name, | 42 void MatchFamilyName(const std::string& family_name, |
41 mojom::TypefaceStylePtr requested_style, | 43 mojom::TypefaceStylePtr requested_style, |
42 const MatchFamilyNameCallback& callback) override; | 44 const MatchFamilyNameCallback& callback) override; |
43 void OpenStream(uint32_t id_number, | 45 void OpenStream(uint32_t id_number, |
44 const OpenStreamCallback& callback) override; | 46 const OpenStreamCallback& callback) override; |
45 | 47 |
46 int FindOrAddPath(const SkString& path); | 48 int FindOrAddPath(const SkString& path); |
47 | 49 |
| 50 service_manager::BinderRegistry registry_; |
48 mojo::BindingSet<mojom::FontService> bindings_; | 51 mojo::BindingSet<mojom::FontService> bindings_; |
49 | 52 |
50 tracing::Provider tracing_; | 53 tracing::Provider tracing_; |
51 | 54 |
52 // We don't want to leak paths to our callers; we thus enumerate the paths of | 55 // We don't want to leak paths to our callers; we thus enumerate the paths of |
53 // fonts. | 56 // fonts. |
54 std::vector<SkString> paths_; | 57 std::vector<SkString> paths_; |
55 | 58 |
56 DISALLOW_COPY_AND_ASSIGN(FontServiceApp); | 59 DISALLOW_COPY_AND_ASSIGN(FontServiceApp); |
57 }; | 60 }; |
58 | 61 |
59 } // namespace font_service | 62 } // namespace font_service |
60 | 63 |
61 #endif // COMPONENTS_FONT_SERVICE_FONT_SERVICE_APP_H_ | 64 #endif // COMPONENTS_FONT_SERVICE_FONT_SERVICE_APP_H_ |
OLD | NEW |