| 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 CONTENT_CHILD_DWRITE_FONT_PROXY_DWRITE_FONT_PROXY_WIN_H_ | 5 #ifndef CONTENT_CHILD_DWRITE_FONT_PROXY_DWRITE_FONT_PROXY_WIN_H_ |
| 6 #define CONTENT_CHILD_DWRITE_FONT_PROXY_DWRITE_FONT_PROXY_WIN_H_ | 6 #define CONTENT_CHILD_DWRITE_FONT_PROXY_DWRITE_FONT_PROXY_WIN_H_ |
| 7 | 7 |
| 8 #include <dwrite.h> | 8 #include <dwrite.h> |
| 9 #include <wrl.h> | 9 #include <wrl.h> |
| 10 | 10 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 UINT32 collection_key_size, | 57 UINT32 collection_key_size, |
| 58 IDWriteFontFileEnumerator** font_file_enumerator) override; | 58 IDWriteFontFileEnumerator** font_file_enumerator) override; |
| 59 | 59 |
| 60 // IDWriteFontFileLoader: | 60 // IDWriteFontFileLoader: |
| 61 HRESULT STDMETHODCALLTYPE | 61 HRESULT STDMETHODCALLTYPE |
| 62 CreateStreamFromKey(const void* font_file_reference_key, | 62 CreateStreamFromKey(const void* font_file_reference_key, |
| 63 UINT32 font_file_reference_key_size, | 63 UINT32 font_file_reference_key_size, |
| 64 IDWriteFontFileStream** font_file_stream) override; | 64 IDWriteFontFileStream** font_file_stream) override; |
| 65 | 65 |
| 66 HRESULT STDMETHODCALLTYPE | 66 HRESULT STDMETHODCALLTYPE |
| 67 RuntimeClassInitialize(IDWriteFactory* factory, IPC::Sender* sender_override); | 67 RuntimeClassInitialize(IDWriteFactory* factory, |
| 68 const base::Callback<IPC::Sender*(void)>& sender); |
| 68 | 69 |
| 69 void Unregister(); | 70 void Unregister(); |
| 70 | 71 |
| 71 bool LoadFamily(UINT32 family_index, | 72 bool LoadFamily(UINT32 family_index, |
| 72 IDWriteFontCollection** containing_collection); | 73 IDWriteFontCollection** containing_collection); |
| 73 | 74 |
| 74 // Gets the family at the specified index with the expected name. This can be | 75 // Gets the family at the specified index with the expected name. This can be |
| 75 // used to avoid an IPC call when both the index and family name are known. | 76 // used to avoid an IPC call when both the index and family name are known. |
| 76 bool GetFontFamily(UINT32 family_index, | 77 bool GetFontFamily(UINT32 family_index, |
| 77 const base::string16& family_name, | 78 const base::string16& family_name, |
| 78 IDWriteFontFamily** font_family); | 79 IDWriteFontFamily** font_family); |
| 79 | 80 |
| 80 bool LoadFamilyNames(UINT32 family_index, IDWriteLocalizedStrings** strings); | 81 bool LoadFamilyNames(UINT32 family_index, IDWriteLocalizedStrings** strings); |
| 81 | 82 |
| 82 bool CreateFamily(UINT32 family_index); | 83 bool CreateFamily(UINT32 family_index); |
| 83 | 84 |
| 84 private: | 85 private: |
| 85 IPC::Sender* GetSender(); | |
| 86 | |
| 87 Microsoft::WRL::ComPtr<IDWriteFactory> factory_; | 86 Microsoft::WRL::ComPtr<IDWriteFactory> factory_; |
| 88 std::vector<Microsoft::WRL::ComPtr<DWriteFontFamilyProxy>> families_; | 87 std::vector<Microsoft::WRL::ComPtr<DWriteFontFamilyProxy>> families_; |
| 89 std::map<base::string16, UINT32> family_names_; | 88 std::map<base::string16, UINT32> family_names_; |
| 90 UINT32 family_count_ = UINT_MAX; | 89 UINT32 family_count_ = UINT_MAX; |
| 91 IPC::Sender* sender_override_; | 90 base::Callback<IPC::Sender*(void)> sender_; |
| 92 | 91 |
| 93 DISALLOW_ASSIGN(DWriteFontCollectionProxy); | 92 DISALLOW_ASSIGN(DWriteFontCollectionProxy); |
| 94 }; | 93 }; |
| 95 | 94 |
| 96 // Implements the DirectWrite font family interface. This class is just a | 95 // Implements the DirectWrite font family interface. This class is just a |
| 97 // stub, until something calls a method that requires actual font data. At that | 96 // stub, until something calls a method that requires actual font data. At that |
| 98 // point this will load the font files into a custom collection and | 97 // point this will load the font files into a custom collection and |
| 99 // subsequently calls will be proxied to the resulting DirectWrite object. | 98 // subsequently calls will be proxied to the resulting DirectWrite object. |
| 100 class CONTENT_EXPORT DWriteFontFamilyProxy | 99 class CONTENT_EXPORT DWriteFontFamilyProxy |
| 101 : public Microsoft::WRL::RuntimeClass< | 100 : public Microsoft::WRL::RuntimeClass< |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 HRESULT STDMETHODCALLTYPE RuntimeClassInitialize(HANDLE handle); | 198 HRESULT STDMETHODCALLTYPE RuntimeClassInitialize(HANDLE handle); |
| 200 | 199 |
| 201 private: | 200 private: |
| 202 base::MemoryMappedFile data_; | 201 base::MemoryMappedFile data_; |
| 203 | 202 |
| 204 DISALLOW_ASSIGN(FontFileStream); | 203 DISALLOW_ASSIGN(FontFileStream); |
| 205 }; | 204 }; |
| 206 | 205 |
| 207 } // namespace content | 206 } // namespace content |
| 208 #endif // CONTENT_CHILD_DWRITE_FONT_PROXY_DWRITE_FONT_PROXY_WIN_H_ | 207 #endif // CONTENT_CHILD_DWRITE_FONT_PROXY_DWRITE_FONT_PROXY_WIN_H_ |
| OLD | NEW |