| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "webkit/tools/test_shell/test_shell.h" | 5 #include "webkit/tools/test_shell/test_shell.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #include <fontconfig/fontconfig.h> | 9 #include <fontconfig/fontconfig.h> |
| 10 #include <gtk/gtk.h> | 10 #include <gtk/gtk.h> |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 | 177 |
| 178 // We have fontconfig parse a config file from our resources file. This | 178 // We have fontconfig parse a config file from our resources file. This |
| 179 // sets a number of aliases ("sans"->"Arial" etc), but doesn't include any | 179 // sets a number of aliases ("sans"->"Arial" etc), but doesn't include any |
| 180 // font directories. | 180 // font directories. |
| 181 | 181 |
| 182 // fontconfig only knows how to load font config configs from a file name, so | 182 // fontconfig only knows how to load font config configs from a file name, so |
| 183 // we write to a temp file. | 183 // we write to a temp file. |
| 184 StringPiece font_config_xml; | 184 StringPiece font_config_xml; |
| 185 g_resource_data_pack->Get(IDR_LINUX_FONT_CONFIG, &font_config_xml); | 185 g_resource_data_pack->Get(IDR_LINUX_FONT_CONFIG, &font_config_xml); |
| 186 FilePath fontconfig_path; | 186 FilePath fontconfig_path; |
| 187 if (!file_util::CreateTemporaryFileName(&fontconfig_path)) { | 187 if (!file_util::CreateTemporaryFile(&fontconfig_path)) { |
| 188 LOG(FATAL) << "failed to create temp font config file"; | 188 LOG(FATAL) << "failed to create temp font config file"; |
| 189 } | 189 } |
| 190 if (-1 == file_util::WriteFile(fontconfig_path.ToWStringHack(), | 190 if (-1 == file_util::WriteFile(fontconfig_path.ToWStringHack(), |
| 191 font_config_xml.data(), | 191 font_config_xml.data(), |
| 192 font_config_xml.length())) { | 192 font_config_xml.length())) { |
| 193 LOG(FATAL) << "failed to write temp font config file"; | 193 LOG(FATAL) << "failed to write temp font config file"; |
| 194 } | 194 } |
| 195 | 195 |
| 196 FcInit(); | 196 FcInit(); |
| 197 | 197 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 } else { | 266 } else { |
| 267 if (!FcConfigAppFontAddFile(fontcfg, (FcChar8 *) font)) | 267 if (!FcConfigAppFontAddFile(fontcfg, (FcChar8 *) font)) |
| 268 LOG(FATAL) << "Failed to load font " << font; | 268 LOG(FATAL) << "Failed to load font " << font; |
| 269 } | 269 } |
| 270 } | 270 } |
| 271 | 271 |
| 272 // Also load the layout-test-specific "Ahem" font. | 272 // Also load the layout-test-specific "Ahem" font. |
| 273 StringPiece ahem_font; | 273 StringPiece ahem_font; |
| 274 g_resource_data_pack->Get(IDR_AHEM_FONT, &ahem_font); | 274 g_resource_data_pack->Get(IDR_AHEM_FONT, &ahem_font); |
| 275 g_ahem_path = new FilePath; | 275 g_ahem_path = new FilePath; |
| 276 if (!file_util::CreateTemporaryFileName(g_ahem_path)) { | 276 if (!file_util::CreateTemporaryFile(g_ahem_path)) { |
| 277 LOG(FATAL) << "failed to create temp ahem font"; | 277 LOG(FATAL) << "failed to create temp ahem font"; |
| 278 } | 278 } |
| 279 if (-1 == file_util::WriteFile(g_ahem_path->ToWStringHack(), ahem_font.data(), | 279 if (-1 == file_util::WriteFile(g_ahem_path->ToWStringHack(), ahem_font.data(), |
| 280 ahem_font.length())) { | 280 ahem_font.length())) { |
| 281 LOG(FATAL) << "failed to write temp ahem font"; | 281 LOG(FATAL) << "failed to write temp ahem font"; |
| 282 } | 282 } |
| 283 if (!FcConfigAppFontAddFile(fontcfg, FilePathAsFcChar(*g_ahem_path))) { | 283 if (!FcConfigAppFontAddFile(fontcfg, FilePathAsFcChar(*g_ahem_path))) { |
| 284 LOG(FATAL) << "Failed to load font " << g_ahem_path->value().c_str(); | 284 LOG(FATAL) << "Failed to load font " << g_ahem_path->value().c_str(); |
| 285 } | 285 } |
| 286 | 286 |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 break; | 690 break; |
| 691 } | 691 } |
| 692 return TestShell::NetResourceProvider(resource_id); | 692 return TestShell::NetResourceProvider(resource_id); |
| 693 } | 693 } |
| 694 | 694 |
| 695 void GetPlugins(bool refresh, std::vector<WebPluginInfo>* plugins) { | 695 void GetPlugins(bool refresh, std::vector<WebPluginInfo>* plugins) { |
| 696 NPAPI::PluginList::Singleton()->GetPlugins(refresh, plugins); | 696 NPAPI::PluginList::Singleton()->GetPlugins(refresh, plugins); |
| 697 } | 697 } |
| 698 | 698 |
| 699 } // namespace webkit_glue | 699 } // namespace webkit_glue |
| OLD | NEW |