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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 // Must call InitSharedInstance before this function. | 82 // Must call InitSharedInstance before this function. |
83 CHECK(g_shared_instance_ != NULL); | 83 CHECK(g_shared_instance_ != NULL); |
84 return *g_shared_instance_; | 84 return *g_shared_instance_; |
85 } | 85 } |
86 | 86 |
87 // static | 87 // static |
88 bool ResourceBundle::LocaleDataPakExists(const std::string& locale) { | 88 bool ResourceBundle::LocaleDataPakExists(const std::string& locale) { |
89 return !GetLocaleFilePath(locale).empty(); | 89 return !GetLocaleFilePath(locale).empty(); |
90 } | 90 } |
91 | 91 |
92 void ResourceBundle::AddDataPack(const FilePath& path) { | 92 void ResourceBundle::AddDataPack(const FilePath& path, float scale_factor) { |
93 scoped_ptr<DataPack> data_pack(new DataPack()); | 93 scoped_ptr<DataPack> data_pack(new DataPack()); |
94 if (data_pack->Load(path)) { | 94 if (data_pack->Load(path)) { |
| 95 data_pack->set_scale_factor(scale_factor); |
95 data_packs_.push_back(data_pack.release()); | 96 data_packs_.push_back(data_pack.release()); |
96 } else { | 97 } else { |
97 LOG(ERROR) << "Failed to load " << path.value() | 98 LOG(ERROR) << "Failed to load " << path.value() |
98 << "\nSome features may not be available."; | 99 << "\nSome features may not be available."; |
99 } | 100 } |
100 } | 101 } |
101 | 102 |
102 #if !defined(OS_MACOSX) | 103 #if !defined(OS_MACOSX) |
103 // static | 104 // static |
104 FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale) { | 105 FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale) { |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 SkBitmap* bitmap = new SkBitmap(); | 404 SkBitmap* bitmap = new SkBitmap(); |
404 bitmap->setConfig(SkBitmap::kARGB_8888_Config, 32, 32); | 405 bitmap->setConfig(SkBitmap::kARGB_8888_Config, 32, 32); |
405 bitmap->allocPixels(); | 406 bitmap->allocPixels(); |
406 bitmap->eraseARGB(255, 255, 0, 0); | 407 bitmap->eraseARGB(255, 255, 0, 0); |
407 empty_image = new gfx::Image(bitmap); | 408 empty_image = new gfx::Image(bitmap); |
408 } | 409 } |
409 return empty_image; | 410 return empty_image; |
410 } | 411 } |
411 | 412 |
412 } // namespace ui | 413 } // namespace ui |
OLD | NEW |