| 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 gfx::FontList::SetDefaultFontDescription( | 71 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 72 l10n_util::GetStringUTF8(IDS_UI_FONT_FAMILY_CROS)); | 72 std::string font_family = base::UTF16ToUTF8( |
| 73 rb.GetLocalizedString(IDS_UI_FONT_FAMILY_CROS)); |
| 74 gfx::FontList::SetDefaultFontDescription(font_family); |
| 73 | 75 |
| 74 // TODO(yukishiino): Remove SetDefaultFontDescription() once the migration to | 76 // TODO(yukishiino): Remove SetDefaultFontDescription() once the migration to |
| 75 // the font list is done. We will no longer need SetDefaultFontDescription() | 77 // the font list is done. We will no longer need SetDefaultFontDescription() |
| 76 // after every client gets started using a FontList instead of a Font. | 78 // after every client gets started using a FontList instead of a Font. |
| 77 gfx::PlatformFontPango::SetDefaultFontDescription( | 79 gfx::PlatformFontPango::SetDefaultFontDescription(font_family); |
| 78 l10n_util::GetStringUTF8(IDS_UI_FONT_FAMILY_CROS)); | |
| 79 #else | 80 #else |
| 80 // Use a single default font as the default font list. | 81 // Use a single default font as the default font list. |
| 81 gfx::FontList::SetDefaultFontDescription(std::string()); | 82 gfx::FontList::SetDefaultFontDescription(std::string()); |
| 82 #endif | 83 #endif |
| 83 } | 84 } |
| 84 | 85 |
| 85 } // namespace | 86 } // namespace |
| 86 | 87 |
| 87 // An ImageSkiaSource that loads bitmaps for the requested scale factor from | 88 // An ImageSkiaSource that loads bitmaps for the requested scale factor from |
| 88 // ResourceBundle on demand for a given |resource_id|. If the bitmap for the | 89 // 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... |
| 798 // static | 799 // static |
| 799 bool ResourceBundle::DecodePNG(const unsigned char* buf, | 800 bool ResourceBundle::DecodePNG(const unsigned char* buf, |
| 800 size_t size, | 801 size_t size, |
| 801 SkBitmap* bitmap, | 802 SkBitmap* bitmap, |
| 802 bool* fell_back_to_1x) { | 803 bool* fell_back_to_1x) { |
| 803 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); | 804 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); |
| 804 return gfx::PNGCodec::Decode(buf, size, bitmap); | 805 return gfx::PNGCodec::Decode(buf, size, bitmap); |
| 805 } | 806 } |
| 806 | 807 |
| 807 } // namespace ui | 808 } // namespace ui |
| OLD | NEW |