| 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_MOJO_FONT_FETCHER_MOJO_IMPL_H_ | |
| 6 #define BLIMP_ENGINE_MOJO_FONT_FETCHER_MOJO_IMPL_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "blimp/engine/mojo/font_fetcher.mojom.h" | |
| 11 #include "mojo/public/cpp/bindings/binding_set.h" | |
| 12 | |
| 13 namespace blimp { | |
| 14 namespace engine { | |
| 15 | |
| 16 class FontDataFetcher; | |
| 17 | |
| 18 // Service for processing FontFetcher requests from the renderer. | |
| 19 // Caller is responsible for executing all methods on the IO thread. | |
| 20 class FontFetcherMojoImpl : public mojom::FontFetcher { | |
| 21 public: | |
| 22 // |font_data_fetcher|: The FontDataFetcher object which will get the font | |
| 23 // data stream, it must outlive the Mojo connection. | |
| 24 explicit FontFetcherMojoImpl(FontDataFetcher* font_data_fetcher); | |
| 25 ~FontFetcherMojoImpl() override; | |
| 26 | |
| 27 // Factory method called by Mojo. | |
| 28 // Binds |this| to the connection specified by |request|. | |
| 29 void BindRequest(mojo::InterfaceRequest<mojom::FontFetcher> request); | |
| 30 | |
| 31 // mojom::FontAccess implementation. | |
| 32 void GetFontStream(const std::string& font_hash, | |
| 33 const GetFontStreamCallback& callback) override; | |
| 34 | |
| 35 private: | |
| 36 mojo::BindingSet<mojom::FontFetcher> bindings_; | |
| 37 | |
| 38 // Fetcher object which fetches the font stream and passed over the Mojo | |
| 39 // service. | |
| 40 FontDataFetcher* font_data_fetcher_; | |
| 41 | |
| 42 DISALLOW_COPY_AND_ASSIGN(FontFetcherMojoImpl); | |
| 43 }; | |
| 44 | |
| 45 } // namespace engine | |
| 46 } // namespace blimp | |
| 47 | |
| 48 #endif // BLIMP_ENGINE_MOJO_FONT_FETCHER_MOJO_IMPL_H_ | |
| OLD | NEW |