Roll src/third_party/WebKit 9f7fb92:f103b33 (svn 202621:202622)
[chromium-blink-merge.git] / components / font_service / font_service_app.h
blob9eda20a6959b63065e70c040a12874ba0f21c8ff
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.
5 #ifndef COMPONENTS_FONT_SERVICE_FONT_SERVICE_APP_H_
6 #define COMPONENTS_FONT_SERVICE_FONT_SERVICE_APP_H_
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"
14 namespace font_service {
16 class FontServiceApp : public mojo::ApplicationDelegate,
17 public mojo::InterfaceFactory<FontService>,
18 public FontService {
19 public:
20 FontServiceApp();
21 ~FontServiceApp() override;
23 private:
24 // ApplicationDelegate:
25 void Initialize(mojo::ApplicationImpl* app) override;
26 bool ConfigureIncomingConnection(
27 mojo::ApplicationConnection* connection) override;
29 // mojo::InterfaceFactory<FontService>:
30 void Create(mojo::ApplicationConnection* connection,
31 mojo::InterfaceRequest<FontService> request) override;
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;
40 int FindOrAddPath(const SkString& path);
42 mojo::WeakBindingSet<FontService> bindings_;
44 // We don't want to leak paths to our callers; we thus enumerate the paths of
45 // fonts.
46 SkTDArray<SkString*> paths_;
48 DISALLOW_COPY_AND_ASSIGN(FontServiceApp);
51 } // namespace font_service
53 #endif // COMPONENTS_FONT_SERVICE_FONT_SERVICE_APP_H_