OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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" | |
6 | |
7 #include <string> | |
8 | |
9 #include "base/file_util.h" | |
10 #include "base/files/file_path.h" | |
11 #include "base/logging.h" | 5 #include "base/logging.h" |
12 #include "base/path_service.h" | 6 #include "base/path_service.h" |
13 #include "base/strings/stringprintf.h" | 7 #include "ui/base/resource/resource_bundle.h" |
14 #include "ui/base/resource/resource_handle.h" | 8 #include "ui/base/resource/resource_handle.h" |
15 #include "ui/base/ui_base_paths.h" | 9 |
| 10 namespace { |
| 11 |
| 12 base::FilePath GetResourcesPakFilePath(const std::string& pak_name) { |
| 13 base::FilePath path; |
| 14 if (PathService::Get(base::DIR_MODULE, &path)) |
| 15 return path.AppendASCII(pak_name.c_str()); |
| 16 |
| 17 // Return just the name of the pack file. |
| 18 return base::FilePath(pak_name.c_str()); |
| 19 } |
| 20 |
| 21 } // namespace |
16 | 22 |
17 namespace ui { | 23 namespace ui { |
18 | 24 |
19 void ResourceBundle::LoadCommonResources() { | 25 void ResourceBundle::LoadCommonResources() { |
20 base::FilePath path; | 26 AddDataPackFromPath(GetResourcesPakFilePath("cast_shell.pak"), |
21 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &path); | |
22 AddDataPackFromPath(path.AppendASCII("chrome_100_percent.pak"), | |
23 SCALE_FACTOR_100P); | 27 SCALE_FACTOR_100P); |
24 } | 28 } |
25 | 29 |
26 gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id, ImageRTL rtl) { | 30 gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id, ImageRTL rtl) { |
27 // Flipped image is not used on Android. | 31 // Flipped image is not used on Chromecast. |
28 DCHECK_EQ(rtl, RTL_DISABLED); | 32 DCHECK_EQ(rtl, RTL_DISABLED); |
29 return GetImageNamed(resource_id); | 33 return GetImageNamed(resource_id); |
30 } | 34 } |
31 | 35 |
32 } | 36 } // namespace ui |
OLD | NEW |