OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/base/resource/resource_bundle.h" | 5 #include "ui/base/resource/resource_bundle.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 // PNG-related constants. | 61 // PNG-related constants. |
62 const unsigned char kPngMagic[8] = { 0x89, 'P', 'N', 'G', 13, 10, 26, 10 }; | 62 const unsigned char kPngMagic[8] = { 0x89, 'P', 'N', 'G', 13, 10, 26, 10 }; |
63 const size_t kPngChunkMetadataSize = 12; // length, type, crc32 | 63 const size_t kPngChunkMetadataSize = 12; // length, type, crc32 |
64 const unsigned char kPngScaleChunkType[4] = { 'c', 's', 'C', 'l' }; | 64 const unsigned char kPngScaleChunkType[4] = { 'c', 's', 'C', 'l' }; |
65 const unsigned char kPngDataChunkType[4] = { 'I', 'D', 'A', 'T' }; | 65 const unsigned char kPngDataChunkType[4] = { 'I', 'D', 'A', 'T' }; |
66 | 66 |
67 ResourceBundle* g_shared_instance_ = NULL; | 67 ResourceBundle* g_shared_instance_ = NULL; |
68 | 68 |
69 void InitDefaultFontList() { | 69 void InitDefaultFontList() { |
70 #if defined(OS_CHROMEOS) | 70 #if defined(OS_CHROMEOS) |
71 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 71 gfx::FontList::SetDefaultFontDescription( |
72 std::string font_family = base::UTF16ToUTF8( | 72 l10n_util::GetStringUTF8(IDS_UI_FONT_FAMILY_CROS)); |
73 rb.GetLocalizedString(IDS_UI_FONT_FAMILY_CROS)); | |
74 gfx::FontList::SetDefaultFontDescription(font_family); | |
75 | 73 |
76 // TODO(yukishiino): Remove SetDefaultFontDescription() once the migration to | 74 // TODO(yukishiino): Remove SetDefaultFontDescription() once the migration to |
77 // the font list is done. We will no longer need SetDefaultFontDescription() | 75 // the font list is done. We will no longer need SetDefaultFontDescription() |
78 // after every client gets started using a FontList instead of a Font. | 76 // after every client gets started using a FontList instead of a Font. |
79 gfx::PlatformFontPango::SetDefaultFontDescription(font_family); | 77 gfx::PlatformFontPango::SetDefaultFontDescription( |
| 78 l10n_util::GetStringUTF8(IDS_UI_FONT_FAMILY_CROS)); |
80 #else | 79 #else |
81 // Use a single default font as the default font list. | 80 // Use a single default font as the default font list. |
82 gfx::FontList::SetDefaultFontDescription(std::string()); | 81 gfx::FontList::SetDefaultFontDescription(std::string()); |
83 #endif | 82 #endif |
84 } | 83 } |
85 | 84 |
86 } // namespace | 85 } // namespace |
87 | 86 |
88 // An ImageSkiaSource that loads bitmaps for the requested scale factor from | 87 // An ImageSkiaSource that loads bitmaps for the requested scale factor from |
89 // ResourceBundle on demand for a given |resource_id|. If the bitmap for the | 88 // ResourceBundle on demand for a given |resource_id|. If the bitmap for the |
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 // static | 798 // static |
800 bool ResourceBundle::DecodePNG(const unsigned char* buf, | 799 bool ResourceBundle::DecodePNG(const unsigned char* buf, |
801 size_t size, | 800 size_t size, |
802 SkBitmap* bitmap, | 801 SkBitmap* bitmap, |
803 bool* fell_back_to_1x) { | 802 bool* fell_back_to_1x) { |
804 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); | 803 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); |
805 return gfx::PNGCodec::Decode(buf, size, bitmap); | 804 return gfx::PNGCodec::Decode(buf, size, bitmap); |
806 } | 805 } |
807 | 806 |
808 } // namespace ui | 807 } // namespace ui |
OLD | NEW |