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 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "components/font_service/public/interfaces/font_service.mojom.h" | 11 #include "components/font_service/public/interfaces/font_service.mojom.h" |
12 #include "mojo/common/weak_binding_set.h" | 12 #include "mojo/common/weak_binding_set.h" |
13 #include "mojo/services/tracing/public/cpp/tracing_impl.h" | 13 #include "mojo/services/tracing/public/cpp/tracing_impl.h" |
14 #include "mojo/shell/public/cpp/application_delegate.h" | |
15 #include "mojo/shell/public/cpp/interface_factory.h" | 14 #include "mojo/shell/public/cpp/interface_factory.h" |
| 15 #include "mojo/shell/public/cpp/shell_client.h" |
16 #include "skia/ext/skia_utils_base.h" | 16 #include "skia/ext/skia_utils_base.h" |
17 | 17 |
18 namespace font_service { | 18 namespace font_service { |
19 | 19 |
20 class FontServiceApp : public mojo::ApplicationDelegate, | 20 class FontServiceApp : public mojo::ShellClient, |
21 public mojo::InterfaceFactory<FontService>, | 21 public mojo::InterfaceFactory<FontService>, |
22 public FontService { | 22 public FontService { |
23 public: | 23 public: |
24 FontServiceApp(); | 24 FontServiceApp(); |
25 ~FontServiceApp() override; | 25 ~FontServiceApp() override; |
26 | 26 |
27 private: | 27 private: |
28 // ApplicationDelegate: | 28 // mojo::ShellClient: |
29 void Initialize(mojo::Shell* shell, const std::string& url, | 29 void Initialize(mojo::Shell* shell, const std::string& url, |
30 uint32_t id) override; | 30 uint32_t id) override; |
31 bool AcceptConnection( | 31 bool AcceptConnection(mojo::Connection* connection) override; |
32 mojo::ApplicationConnection* connection) override; | |
33 | 32 |
34 // mojo::InterfaceFactory<FontService>: | 33 // mojo::InterfaceFactory<FontService>: |
35 void Create(mojo::ApplicationConnection* connection, | 34 void Create(mojo::Connection* connection, |
36 mojo::InterfaceRequest<FontService> request) override; | 35 mojo::InterfaceRequest<FontService> request) override; |
37 | 36 |
38 // FontService: | 37 // FontService: |
39 void MatchFamilyName(const mojo::String& family_name, | 38 void MatchFamilyName(const mojo::String& family_name, |
40 TypefaceStyle requested_style, | 39 TypefaceStyle requested_style, |
41 const MatchFamilyNameCallback& callback) override; | 40 const MatchFamilyNameCallback& callback) override; |
42 void OpenStream(uint32_t id_number, | 41 void OpenStream(uint32_t id_number, |
43 const OpenStreamCallback& callback) override; | 42 const OpenStreamCallback& callback) override; |
44 | 43 |
45 int FindOrAddPath(const SkString& path); | 44 int FindOrAddPath(const SkString& path); |
46 | 45 |
47 mojo::WeakBindingSet<FontService> bindings_; | 46 mojo::WeakBindingSet<FontService> bindings_; |
48 | 47 |
49 mojo::TracingImpl tracing_; | 48 mojo::TracingImpl tracing_; |
50 | 49 |
51 // 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 |
52 // fonts. | 51 // fonts. |
53 SkTDArray<SkString*> paths_; | 52 SkTDArray<SkString*> paths_; |
54 | 53 |
55 DISALLOW_COPY_AND_ASSIGN(FontServiceApp); | 54 DISALLOW_COPY_AND_ASSIGN(FontServiceApp); |
56 }; | 55 }; |
57 | 56 |
58 } // namespace font_service | 57 } // namespace font_service |
59 | 58 |
60 #endif // COMPONENTS_FONT_SERVICE_FONT_SERVICE_APP_H_ | 59 #endif // COMPONENTS_FONT_SERVICE_FONT_SERVICE_APP_H_ |
OLD | NEW |