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 <string> | 7 #include <string> |
8 | 8 |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
13 #include "base/stringprintf.h" | 13 #include "base/stringprintf.h" |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 FilePath GetResourcesPakFilePath(const std::string& pak_name) { | 17 FilePath GetResourcesPakFilePath(const std::string& pak_name) { |
18 FilePath path; | 18 FilePath path; |
19 PathService::Get(base::DIR_ANDROID_APP_DATA, &path); | 19 PathService::Get(base::DIR_ANDROID_APP_DATA, &path); |
20 DCHECK(!path.empty()); | 20 DCHECK(!path.empty()); |
21 return path.AppendASCII("paks").AppendASCII(pak_name.c_str()); | 21 return path.AppendASCII("paks").AppendASCII(pak_name.c_str()); |
22 } | 22 } |
23 | 23 |
24 } // namespace | 24 } // namespace |
25 | 25 |
26 namespace ui { | 26 namespace ui { |
27 | 27 |
28 void ResourceBundle::LoadCommonResources() { | 28 void ResourceBundle::LoadCommonResources() { |
29 AddDataPack(GetResourcesPakFilePath("chrome.pak")); | 29 AddDataPack(GetResourcesPakFilePath("chrome.pak"), 1.0); |
30 AddDataPack(GetResourcesPakFilePath("theme_resources_standard.pak")); | 30 AddDataPack(GetResourcesPakFilePath("theme_resources_standard.pak"), 1.0); |
31 AddDataPack(GetResourcesPakFilePath("ui_resources_standard.pak")); | 31 AddDataPack(GetResourcesPakFilePath("ui_resources_standard.pak"), 1.0); |
32 } | 32 } |
33 | 33 |
34 gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id, ImageRTL rtl) { | 34 gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id, ImageRTL rtl) { |
35 // Flipped image is not used on Android. | 35 // Flipped image is not used on Android. |
36 DCHECK_EQ(rtl, RTL_DISABLED); | 36 DCHECK_EQ(rtl, RTL_DISABLED); |
37 return GetImageNamed(resource_id); | 37 return GetImageNamed(resource_id); |
38 } | 38 } |
39 | 39 |
40 } | 40 } |
OLD | NEW |