OLD | NEW |
| (Empty) |
1 // Copyright 2016 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 BLIMP_ENGINE_BROWSER_FONT_DATA_FETCHER_H_ | |
6 #define BLIMP_ENGINE_BROWSER_FONT_DATA_FETCHER_H_ | |
7 | |
8 #include <memory> | |
9 #include <string> | |
10 | |
11 #include "base/callback.h" | |
12 #include "base/memory/ptr_util.h" | |
13 #include "third_party/skia/include/core/SkStream.h" | |
14 | |
15 namespace blimp { | |
16 namespace engine { | |
17 | |
18 // FontDataFetcher does the real work of fetching font data. | |
19 // It should be created, called, and destroyed from the same thread. | |
20 class FontDataFetcher { | |
21 public: | |
22 using FontResponseCallback = | |
23 base::Callback<void(std::unique_ptr<SkStream>)>; | |
24 | |
25 virtual ~FontDataFetcher() {} | |
26 | |
27 // Asynchronously loads the font identified by |font_hash| and invokes | |
28 // |callback| with an SkStream containing the font data. | |
29 // If there is no font for font_hash, the SkStream will be empty. | |
30 virtual void FetchFontStream(const std::string& font_hash, | |
31 const FontResponseCallback& callback) const = 0; | |
32 }; | |
33 | |
34 } // namespace engine | |
35 } // namespace blimp | |
36 | |
37 #endif // BLIMP_ENGINE_BROWSER_FONT_DATA_FETCHER_H_ | |
OLD | NEW |