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

Side by Side Diff: content/test/dwrite_font_fake_sender_win.h

Issue 2153343002: Implement support for loading font files from outside system directory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test patchset to run try job Created 4 years, 5 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 (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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_TEST_DWRITE_FONT_FAKE_SENDER_WIN_H_ 5 #ifndef CONTENT_TEST_DWRITE_FONT_FAKE_SENDER_WIN_H_
6 #define CONTENT_TEST_DWRITE_FONT_FAKE_SENDER_WIN_H_ 6 #define CONTENT_TEST_DWRITE_FONT_FAKE_SENDER_WIN_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <wrl.h> 10 #include <wrl.h>
(...skipping 26 matching lines...) Expand all
37 37
38 FakeFont(const FakeFont& other); 38 FakeFont(const FakeFont& other);
39 39
40 ~FakeFont(); 40 ~FakeFont();
41 41
42 FakeFont& AddFilePath(const base::string16& file_path) { 42 FakeFont& AddFilePath(const base::string16& file_path) {
43 file_paths_.push_back(file_path); 43 file_paths_.push_back(file_path);
44 return *this; 44 return *this;
45 } 45 }
46 46
47 FakeFont& AddFileHandle(uint32_t handle) {
48 file_handles_.push_back(handle);
49 return *this;
50 }
51
47 FakeFont& AddFamilyName(const base::string16& locale, 52 FakeFont& AddFamilyName(const base::string16& locale,
48 const base::string16& family_name) { 53 const base::string16& family_name) {
49 family_names_.emplace_back(locale, family_name); 54 family_names_.emplace_back(locale, family_name);
50 return *this; 55 return *this;
51 } 56 }
52 57
53 const base::string16& font_name() { return font_name_; } 58 const base::string16& font_name() { return font_name_; }
54 59
55 private: 60 private:
56 friend FakeFontCollection; 61 friend FakeFontCollection;
57 base::string16 font_name_; 62 base::string16 font_name_;
58 std::vector<base::string16> file_paths_; 63 std::vector<base::string16> file_paths_;
64 std::vector<uint32_t> file_handles_;
59 std::vector<std::pair<base::string16, base::string16>> family_names_; 65 std::vector<std::pair<base::string16, base::string16>> family_names_;
60 66
61 DISALLOW_ASSIGN(FakeFont); 67 DISALLOW_ASSIGN(FakeFont);
62 }; 68 };
63 69
64 // Implements a font collection that supports interaction through sending IPC 70 // Implements a font collection that supports interaction through sending IPC
65 // messages from dwrite_font_proxy_messages.h. 71 // messages from dwrite_font_proxy_messages.h.
66 // Usage: 72 // Usage:
67 // Create a new FakeFontCollection. 73 // Create a new FakeFontCollection.
68 // Call AddFont() to add fonts. 74 // Call AddFont() to add fonts.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 116
111 private: 117 private:
112 void OnFindFamily(const base::string16& family_name, uint32_t* index); 118 void OnFindFamily(const base::string16& family_name, uint32_t* index);
113 119
114 void OnGetFamilyCount(uint32_t* count); 120 void OnGetFamilyCount(uint32_t* count);
115 121
116 void OnGetFamilyNames( 122 void OnGetFamilyNames(
117 uint32_t family_index, 123 uint32_t family_index,
118 std::vector<std::pair<base::string16, base::string16>>* family_names); 124 std::vector<std::pair<base::string16, base::string16>>* family_names);
119 void OnGetFontFiles(uint32_t family_index, 125 void OnGetFontFiles(uint32_t family_index,
120 std::vector<base::string16>* file_paths_); 126 std::vector<base::string16>* file_paths,
127 std::vector<uint32_t>* file_handles);
121 128
122 void OnMapCharacters(const base::string16& text, 129 void OnMapCharacters(const base::string16& text,
123 const DWriteFontStyle& font_style, 130 const DWriteFontStyle& font_style,
124 const base::string16& locale_name, 131 const base::string16& locale_name,
125 uint32_t reading_direction, 132 uint32_t reading_direction,
126 const base::string16& base_family_name, 133 const base::string16& base_family_name,
127 MapCharactersResult* result); 134 MapCharactersResult* result);
128 135
129 private: 136 private:
130 scoped_refptr<FakeFontCollection> collection_; 137 scoped_refptr<FakeFontCollection> collection_;
(...skipping 20 matching lines...) Expand all
151 158
152 void OnFindFamily(const base::string16& family_name, uint32_t* index); 159 void OnFindFamily(const base::string16& family_name, uint32_t* index);
153 160
154 void OnGetFamilyCount(uint32_t* count); 161 void OnGetFamilyCount(uint32_t* count);
155 162
156 void OnGetFamilyNames( 163 void OnGetFamilyNames(
157 uint32_t family_index, 164 uint32_t family_index,
158 std::vector<std::pair<base::string16, base::string16>>* family_names); 165 std::vector<std::pair<base::string16, base::string16>>* family_names);
159 166
160 void OnGetFontFiles(uint32_t family_index, 167 void OnGetFontFiles(uint32_t family_index,
161 std::vector<base::string16>* file_paths); 168 std::vector<base::string16>* file_paths,
169 std::vector<uint32_t>* file_handles);
162 170
163 void OnMapCharacters(const base::string16& text, 171 void OnMapCharacters(const base::string16& text,
164 const DWriteFontStyle& font_style, 172 const DWriteFontStyle& font_style,
165 const base::string16& locale_name, 173 const base::string16& locale_name,
166 uint32_t reading_direction, 174 uint32_t reading_direction,
167 const base::string16& base_family_name, 175 const base::string16& base_family_name,
168 MapCharactersResult* result); 176 MapCharactersResult* result);
169 177
170 std::unique_ptr<ReplySender> GetReplySender(); 178 std::unique_ptr<ReplySender> GetReplySender();
171 179
172 private: 180 private:
173 friend class base::RefCounted<FakeFontCollection>; 181 friend class base::RefCounted<FakeFontCollection>;
174 ~FakeFontCollection(); 182 ~FakeFontCollection();
175 183
176 std::vector<FakeFont> fonts_; 184 std::vector<FakeFont> fonts_;
177 std::vector<std::unique_ptr<IPC::Message>> messages_; 185 std::vector<std::unique_ptr<IPC::Message>> messages_;
178 186
179 DISALLOW_COPY_AND_ASSIGN(FakeFontCollection); 187 DISALLOW_COPY_AND_ASSIGN(FakeFontCollection);
180 }; 188 };
181 189
182 } // namespace content 190 } // namespace content
183 191
184 #endif // CONTENT_TEST_DWRITE_FONT_FAKE_SENDER_WIN_H_ 192 #endif // CONTENT_TEST_DWRITE_FONT_FAKE_SENDER_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698