OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef COMPONENTS_FONT_SERVICE_FONT_SERVICE_APP_H_ |
| 6 #define COMPONENTS_FONT_SERVICE_FONT_SERVICE_APP_H_ |
| 7 |
| 8 #include "components/font_service/public/interfaces/font_service.mojom.h" |
| 9 #include "mojo/application/public/cpp/application_delegate.h" |
| 10 #include "mojo/application/public/cpp/interface_factory.h" |
| 11 #include "mojo/common/weak_binding_set.h" |
| 12 #include "skia/ext/skia_utils_base.h" |
| 13 |
| 14 namespace font_service { |
| 15 |
| 16 class FontServiceApp : public mojo::ApplicationDelegate, |
| 17 public mojo::InterfaceFactory<FontService>, |
| 18 public FontService { |
| 19 public: |
| 20 FontServiceApp(); |
| 21 ~FontServiceApp() override; |
| 22 |
| 23 private: |
| 24 // ApplicationDelegate: |
| 25 void Initialize(mojo::ApplicationImpl* app) override; |
| 26 bool ConfigureIncomingConnection( |
| 27 mojo::ApplicationConnection* connection) override; |
| 28 |
| 29 // mojo::InterfaceFactory<FontService>: |
| 30 void Create(mojo::ApplicationConnection* connection, |
| 31 mojo::InterfaceRequest<FontService> request) override; |
| 32 |
| 33 // FontService: |
| 34 void MatchFamilyName(const mojo::String& family_name, |
| 35 TypefaceStyle requested_style, |
| 36 const MatchFamilyNameCallback& callback) override; |
| 37 void OpenStream(uint32_t id_number, |
| 38 const OpenStreamCallback& callback) override; |
| 39 |
| 40 int FindOrAddPath(const SkString& path); |
| 41 |
| 42 mojo::WeakBindingSet<FontService> bindings_; |
| 43 |
| 44 // We don't want to leak paths to our callers; we thus enumerate the paths of |
| 45 // fonts. |
| 46 SkTDArray<SkString*> paths_; |
| 47 |
| 48 DISALLOW_COPY_AND_ASSIGN(FontServiceApp); |
| 49 }; |
| 50 |
| 51 } // namespace font_service |
| 52 |
| 53 #endif // COMPONENTS_FONT_SERVICE_FONT_SERVICE_APP_H_ |
OLD | NEW |