| 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/shell/public/cpp/interface_factory.h" | 14 #include "services/shell/public/cpp/interface_factory.h" |
| 15 #include "services/shell/public/cpp/service.h" | 15 #include "services/shell/public/cpp/service.h" |
| 16 #include "services/tracing/public/cpp/tracing_impl.h" | 16 #include "services/tracing/public/cpp/tracing_impl.h" |
| 17 #include "skia/ext/skia_utils_base.h" | 17 #include "skia/ext/skia_utils_base.h" |
| 18 | 18 |
| 19 namespace font_service { | 19 namespace font_service { |
| 20 | 20 |
| 21 class FontServiceApp : public shell::Service, | 21 class FontServiceApp : public shell::Service, |
| 22 public shell::InterfaceFactory<mojom::FontService>, | 22 public shell::InterfaceFactory<mojom::FontService>, |
| 23 public mojom::FontService { | 23 public mojom::FontService { |
| 24 public: | 24 public: |
| 25 FontServiceApp(); | 25 FontServiceApp(); |
| 26 ~FontServiceApp() override; | 26 ~FontServiceApp() override; |
| 27 | 27 |
| 28 private: | 28 private: |
| 29 // shell::Service: | 29 // shell::Service: |
| 30 void OnStart(shell::Connector* connector, | 30 void OnStart(const shell::Identity& identity) override; |
| 31 const shell::Identity& identity, | |
| 32 uint32_t id) override; | |
| 33 bool OnConnect(shell::Connection* connection) override; | 31 bool OnConnect(shell::Connection* connection) override; |
| 34 | 32 |
| 35 // shell::InterfaceFactory<mojom::FontService>: | 33 // shell::InterfaceFactory<mojom::FontService>: |
| 36 void Create(const shell::Identity& remote_identity, | 34 void Create(const shell::Identity& remote_identity, |
| 37 mojo::InterfaceRequest<mojom::FontService> request) override; | 35 mojo::InterfaceRequest<mojom::FontService> request) override; |
| 38 | 36 |
| 39 // FontService: | 37 // FontService: |
| 40 void MatchFamilyName(const mojo::String& family_name, | 38 void MatchFamilyName(const mojo::String& family_name, |
| 41 mojom::TypefaceStylePtr requested_style, | 39 mojom::TypefaceStylePtr requested_style, |
| 42 const MatchFamilyNameCallback& callback) override; | 40 const MatchFamilyNameCallback& callback) override; |
| 43 void OpenStream(uint32_t id_number, | 41 void OpenStream(uint32_t id_number, |
| 44 const OpenStreamCallback& callback) override; | 42 const OpenStreamCallback& callback) override; |
| 45 | 43 |
| 46 int FindOrAddPath(const SkString& path); | 44 int FindOrAddPath(const SkString& path); |
| 47 | 45 |
| 48 mojo::BindingSet<mojom::FontService> bindings_; | 46 mojo::BindingSet<mojom::FontService> bindings_; |
| 49 | 47 |
| 50 mojo::TracingImpl tracing_; | 48 mojo::TracingImpl tracing_; |
| 51 | 49 |
| 52 // We don't want to leak paths to our callers; we thus enumerate the paths of | 50 // We don't want to leak paths to our callers; we thus enumerate the paths of |
| 53 // fonts. | 51 // fonts. |
| 54 std::vector<SkString> paths_; | 52 std::vector<SkString> paths_; |
| 55 | 53 |
| 56 DISALLOW_COPY_AND_ASSIGN(FontServiceApp); | 54 DISALLOW_COPY_AND_ASSIGN(FontServiceApp); |
| 57 }; | 55 }; |
| 58 | 56 |
| 59 } // namespace font_service | 57 } // namespace font_service |
| 60 | 58 |
| 61 #endif // COMPONENTS_FONT_SERVICE_FONT_SERVICE_APP_H_ | 59 #endif // COMPONENTS_FONT_SERVICE_FONT_SERVICE_APP_H_ |
| OLD | NEW |