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 "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "ui/base/layout.h" | 9 #include "ui/base/layout.h" |
10 #include "ui/base/resource/resource_handle.h" | 10 #include "ui/base/resource/resource_handle.h" |
11 #include "ui/base/ui_base_paths.h" | 11 #include "ui/base/ui_base_paths.h" |
12 #include "ui/gfx/image/image.h" | 12 #include "ui/gfx/image/image.h" |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 FilePath GetResourcesPakFilePath(const std::string& pak_name) { | 16 FilePath GetResourcesPakFilePath(const std::string& pak_name) { |
17 FilePath path; | 17 FilePath path; |
18 if (PathService::Get(base::DIR_MODULE, &path)) | 18 if (PathService::Get(base::DIR_MODULE, &path)) |
19 return path.AppendASCII(pak_name.c_str()); | 19 return path.AppendASCII(pak_name.c_str()); |
20 return FilePath(); | 20 return FilePath(); |
21 } | 21 } |
22 | 22 |
23 } // namespace | 23 } // namespace |
24 | 24 |
25 namespace ui { | 25 namespace ui { |
26 | 26 |
27 void ResourceBundle::LoadCommonResources() { | 27 void ResourceBundle::LoadCommonResources() { |
28 AddDataPack(GetResourcesPakFilePath("chrome.pak"), | 28 AddDataPack(GetResourcesPakFilePath("chrome.pak"), |
29 ResourceHandle::kScaleFactor100x); | 29 ResourceHandle::kScaleFactor100x); |
30 AddDataPack(GetResourcesPakFilePath("theme_resources_standard.pak"), | |
31 ResourceHandle::kScaleFactor100x); | |
32 | 30 |
33 if (ui::GetDisplayLayout() == ui::LAYOUT_TOUCH) { | 31 if (ui::GetDisplayLayout() == ui::LAYOUT_TOUCH) { |
| 32 AddDataPack(GetResourcesPakFilePath("theme_resources_touch_1x.pak"), |
| 33 ResourceHandle::kScaleFactor100x); |
34 AddDataPack(GetResourcesPakFilePath("ui_resources_touch.pak"), | 34 AddDataPack(GetResourcesPakFilePath("ui_resources_touch.pak"), |
35 ResourceHandle::kScaleFactor100x); | 35 ResourceHandle::kScaleFactor100x); |
36 } else { | 36 } else { |
| 37 AddDataPack(GetResourcesPakFilePath("theme_resources_standard.pak"), |
| 38 ResourceHandle::kScaleFactor100x); |
37 AddDataPack(GetResourcesPakFilePath("ui_resources_standard.pak"), | 39 AddDataPack(GetResourcesPakFilePath("ui_resources_standard.pak"), |
38 ResourceHandle::kScaleFactor100x); | 40 ResourceHandle::kScaleFactor100x); |
39 } | 41 } |
40 } | 42 } |
41 | 43 |
42 gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id, ImageRTL rtl) { | 44 gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id, ImageRTL rtl) { |
43 // Flipped image is not used on ChromeOS. | 45 // Flipped image is not used on ChromeOS. |
44 DCHECK_EQ(rtl, RTL_DISABLED); | 46 DCHECK_EQ(rtl, RTL_DISABLED); |
45 return GetImageNamed(resource_id); | 47 return GetImageNamed(resource_id); |
46 } | 48 } |
47 | 49 |
48 } // namespace ui | 50 } // namespace ui |
OLD | NEW |