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

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

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: Add some more comments 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 #include "content/test/dwrite_font_fake_sender_win.h" 5 #include "content/test/dwrite_font_fake_sender_win.h"
6 6
7 #include <dwrite.h> 7 #include <dwrite.h>
8 #include <shlobj.h> 8 #include <shlobj.h>
9 9
10 #include "content/common/dwrite_font_proxy_messages.h" 10 #include "content/common/dwrite_font_proxy_messages.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 } 102 }
103 103
104 void FakeFontCollection::ReplySender::OnGetFamilyNames( 104 void FakeFontCollection::ReplySender::OnGetFamilyNames(
105 uint32_t family_index, 105 uint32_t family_index,
106 std::vector<DWriteStringPair>* family_names) { 106 std::vector<DWriteStringPair>* family_names) {
107 collection_->OnGetFamilyNames(family_index, family_names); 107 collection_->OnGetFamilyNames(family_index, family_names);
108 } 108 }
109 109
110 void FakeFontCollection::ReplySender::OnGetFontFiles( 110 void FakeFontCollection::ReplySender::OnGetFontFiles(
111 uint32_t family_index, 111 uint32_t family_index,
112 std::vector<base::string16>* file_paths) { 112 std::vector<base::string16>* file_paths,
113 collection_->OnGetFontFiles(family_index, file_paths); 113 std::vector<IPC::PlatformFileForTransit>* file_handles) {
114 collection_->OnGetFontFiles(family_index, file_paths, file_handles);
114 } 115 }
115 116
116 void FakeFontCollection::ReplySender::OnMapCharacters( 117 void FakeFontCollection::ReplySender::OnMapCharacters(
117 const base::string16& text, 118 const base::string16& text,
118 const DWriteFontStyle& font_style, 119 const DWriteFontStyle& font_style,
119 const base::string16& locale_name, 120 const base::string16& locale_name,
120 uint32_t reading_direction, 121 uint32_t reading_direction,
121 const base::string16& base_family_name, 122 const base::string16& base_family_name,
122 MapCharactersResult* result) { 123 MapCharactersResult* result) {
123 collection_->OnMapCharacters(text, font_style, locale_name, reading_direction, 124 collection_->OnMapCharacters(text, font_style, locale_name, reading_direction,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 void FakeFontCollection::OnGetFamilyNames( 166 void FakeFontCollection::OnGetFamilyNames(
166 uint32_t family_index, 167 uint32_t family_index,
167 std::vector<DWriteStringPair>* family_names) { 168 std::vector<DWriteStringPair>* family_names) {
168 if (family_index >= fonts_.size()) 169 if (family_index >= fonts_.size())
169 return; 170 return;
170 *family_names = fonts_[family_index].family_names_; 171 *family_names = fonts_[family_index].family_names_;
171 } 172 }
172 173
173 void FakeFontCollection::OnGetFontFiles( 174 void FakeFontCollection::OnGetFontFiles(
174 uint32_t family_index, 175 uint32_t family_index,
175 std::vector<base::string16>* file_paths) { 176 std::vector<base::string16>* file_paths,
177 std::vector<IPC::PlatformFileForTransit>* file_handles) {
176 if (family_index >= fonts_.size()) 178 if (family_index >= fonts_.size())
177 return; 179 return;
178 *file_paths = fonts_[family_index].file_paths_; 180 *file_paths = fonts_[family_index].file_paths_;
181 *file_handles = fonts_[family_index].file_handles_;
179 } 182 }
180 183
181 void FakeFontCollection::OnMapCharacters(const base::string16& text, 184 void FakeFontCollection::OnMapCharacters(const base::string16& text,
182 const DWriteFontStyle& font_style, 185 const DWriteFontStyle& font_style,
183 const base::string16& locale_name, 186 const base::string16& locale_name,
184 uint32_t reading_direction, 187 uint32_t reading_direction,
185 const base::string16& base_family_name, 188 const base::string16& base_family_name,
186 MapCharactersResult* result) { 189 MapCharactersResult* result) {
187 result->family_index = 0; 190 result->family_index = 0;
188 result->family_name = fonts_[0].font_name(); 191 result->family_name = fonts_[0].font_name();
189 result->mapped_length = 1; 192 result->mapped_length = 1;
190 result->scale = 1.0; 193 result->scale = 1.0;
191 result->font_style.font_weight = DWRITE_FONT_WEIGHT_NORMAL; 194 result->font_style.font_weight = DWRITE_FONT_WEIGHT_NORMAL;
192 result->font_style.font_slant = DWRITE_FONT_STYLE_NORMAL; 195 result->font_style.font_slant = DWRITE_FONT_STYLE_NORMAL;
193 result->font_style.font_stretch = DWRITE_FONT_STRETCH_NORMAL; 196 result->font_style.font_stretch = DWRITE_FONT_STRETCH_NORMAL;
194 } 197 }
195 198
196 std::unique_ptr<FakeFontCollection::ReplySender> 199 std::unique_ptr<FakeFontCollection::ReplySender>
197 FakeFontCollection::GetReplySender() { 200 FakeFontCollection::GetReplySender() {
198 return std::unique_ptr<FakeFontCollection::ReplySender>( 201 return std::unique_ptr<FakeFontCollection::ReplySender>(
199 new FakeFontCollection::ReplySender(this)); 202 new FakeFontCollection::ReplySender(this));
200 } 203 }
201 204
202 FakeFontCollection::~FakeFontCollection() = default; 205 FakeFontCollection::~FakeFontCollection() = default;
203 206
204 } // namespace content 207 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698