| 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 #include "ui/base/ui_base_paths.h" |
| 14 #include "ui/base/resource/resource_handle.h" | 15 #include "ui/base/resource/resource_handle.h" |
| 15 | 16 |
| 16 namespace { | |
| 17 | |
| 18 FilePath GetResourcesPakFilePath(const std::string& pak_name) { | |
| 19 FilePath path; | |
| 20 if (PathService::Get(base::DIR_ANDROID_APP_DATA, &path)) | |
| 21 return path.AppendASCII("paks").AppendASCII(pak_name.c_str()); | |
| 22 | |
| 23 // Return just the name of the pack file. | |
| 24 return FilePath(pak_name.c_str()); | |
| 25 } | |
| 26 | |
| 27 } // namespace | |
| 28 | |
| 29 namespace ui { | 17 namespace ui { |
| 30 | 18 |
| 31 void ResourceBundle::LoadCommonResources() { | 19 void ResourceBundle::LoadCommonResources() { |
| 32 AddDataPackFromPath(GetResourcesPakFilePath("chrome.pak"), | 20 FilePath path; |
| 21 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &path); |
| 22 AddDataPackFromPath(path.AppendASCII("chrome.pak"), |
| 33 SCALE_FACTOR_100P); | 23 SCALE_FACTOR_100P); |
| 34 AddDataPackFromPath(GetResourcesPakFilePath( | 24 AddDataPackFromPath(path.AppendASCII("theme_resources_100_percent.pak"), |
| 35 "theme_resources_100_percent.pak"), | |
| 36 SCALE_FACTOR_100P); | 25 SCALE_FACTOR_100P); |
| 37 AddDataPackFromPath(GetResourcesPakFilePath( | 26 AddDataPackFromPath(path.AppendASCII("ui_resources_100_percent.pak"), |
| 38 "ui_resources_100_percent.pak"), | |
| 39 SCALE_FACTOR_100P); | 27 SCALE_FACTOR_100P); |
| 40 } | 28 } |
| 41 | 29 |
| 42 gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id, ImageRTL rtl) { | 30 gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id, ImageRTL rtl) { |
| 43 // Flipped image is not used on Android. | 31 // Flipped image is not used on Android. |
| 44 DCHECK_EQ(rtl, RTL_DISABLED); | 32 DCHECK_EQ(rtl, RTL_DISABLED); |
| 45 return GetImageNamed(resource_id); | 33 return GetImageNamed(resource_id); |
| 46 } | 34 } |
| 47 | 35 |
| 48 } | 36 } |
| OLD | NEW |