Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1093)

Side by Side Diff: content/child/dwrite_font_proxy/dwrite_font_proxy_win.h

Issue 2204603002: Implement support for loading font files from outside system directory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 FontFileEnumerator(); 157 FontFileEnumerator();
158 ~FontFileEnumerator() override; 158 ~FontFileEnumerator() override;
159 159
160 // IDWriteFontFileEnumerator: 160 // IDWriteFontFileEnumerator:
161 HRESULT STDMETHODCALLTYPE GetCurrentFontFile(IDWriteFontFile** file) override; 161 HRESULT STDMETHODCALLTYPE GetCurrentFontFile(IDWriteFontFile** file) override;
162 HRESULT STDMETHODCALLTYPE MoveNext(BOOL* has_current_file) override; 162 HRESULT STDMETHODCALLTYPE MoveNext(BOOL* has_current_file) override;
163 163
164 HRESULT STDMETHODCALLTYPE 164 HRESULT STDMETHODCALLTYPE
165 RuntimeClassInitialize(IDWriteFactory* factory, 165 RuntimeClassInitialize(IDWriteFactory* factory,
166 IDWriteFontFileLoader* loader, 166 IDWriteFontFileLoader* loader,
167 std::vector<base::string16>* file_names); 167 std::vector<HANDLE>* files);
168 168
169 private: 169 private:
170 Microsoft::WRL::ComPtr<IDWriteFactory> factory_; 170 Microsoft::WRL::ComPtr<IDWriteFactory> factory_;
171 Microsoft::WRL::ComPtr<IDWriteFontFileLoader> loader_; 171 Microsoft::WRL::ComPtr<IDWriteFontFileLoader> loader_;
172 std::vector<base::string16> file_names_; 172 std::vector<HANDLE> files_;
173 std::vector<Microsoft::WRL::ComPtr<IDWriteFontFileStream>> file_streams_;
174 UINT32 next_file_ = 0; 173 UINT32 next_file_ = 0;
175 UINT32 current_file_ = UINT_MAX; 174 UINT32 current_file_ = UINT_MAX;
176 175
177 DISALLOW_ASSIGN(FontFileEnumerator); 176 DISALLOW_ASSIGN(FontFileEnumerator);
178 }; 177 };
179 178
180 // Implements the DirectWrite font file stream interface that maps the file to 179 // Implements the DirectWrite font file stream interface that maps the file to
181 // be loaded as a memory mapped file, and subsequently returns pointers into 180 // be loaded as a memory mapped file, and subsequently returns pointers into
182 // the mapped memory block. 181 // the mapped memory block.
183 class CONTENT_EXPORT FontFileStream 182 class CONTENT_EXPORT FontFileStream
184 : public Microsoft::WRL::RuntimeClass< 183 : public Microsoft::WRL::RuntimeClass<
185 Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom>, 184 Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom>,
186 IDWriteFontFileStream> { 185 IDWriteFontFileStream> {
187 public: 186 public:
188 FontFileStream(); 187 FontFileStream();
189 ~FontFileStream() override; 188 ~FontFileStream() override;
190 189
191 // IDWriteFontFileStream: 190 // IDWriteFontFileStream:
192 HRESULT STDMETHODCALLTYPE GetFileSize(UINT64* file_size) override; 191 HRESULT STDMETHODCALLTYPE GetFileSize(UINT64* file_size) override;
193 HRESULT STDMETHODCALLTYPE GetLastWriteTime(UINT64* last_write_time) override; 192 HRESULT STDMETHODCALLTYPE GetLastWriteTime(UINT64* last_write_time) override;
194 HRESULT STDMETHODCALLTYPE ReadFileFragment(const void** fragment_start, 193 HRESULT STDMETHODCALLTYPE ReadFileFragment(const void** fragment_start,
195 UINT64 file_offset, 194 UINT64 file_offset,
196 UINT64 fragment_size, 195 UINT64 fragment_size,
197 void** fragment_context) override; 196 void** fragment_context) override;
198 void STDMETHODCALLTYPE ReleaseFileFragment(void* fragment_context) override {} 197 void STDMETHODCALLTYPE ReleaseFileFragment(void* fragment_context) override {}
199 198
200 HRESULT STDMETHODCALLTYPE 199 HRESULT STDMETHODCALLTYPE RuntimeClassInitialize(HANDLE handle);
201 RuntimeClassInitialize(const base::string16& file_name);
202 200
203 private: 201 private:
204 base::MemoryMappedFile data_; 202 base::MemoryMappedFile data_;
205 203
206 DISALLOW_ASSIGN(FontFileStream); 204 DISALLOW_ASSIGN(FontFileStream);
207 }; 205 };
208 206
209 } // namespace content 207 } // namespace content
210 #endif // CONTENT_CHILD_DWRITE_FONT_PROXY_DWRITE_FONT_PROXY_WIN_H_ 208 #endif // CONTENT_CHILD_DWRITE_FONT_PROXY_DWRITE_FONT_PROXY_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698