OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ui/base/resource/resource_bundle.h" |
| 6 |
| 7 #include <string> |
| 8 |
| 9 #include "base/file_path.h" |
| 10 #include "base/file_util.h" |
| 11 #include "base/logging.h" |
| 12 #include "base/path_service.h" |
| 13 #include "base/stringprintf.h" |
| 14 |
| 15 // We use a trick where we bundle the resource files in the apk |
| 16 // as fake shared libraries. We should stop doing this as soon as either the |
| 17 // resource files come pre-installed on the platform or there is a supported |
| 18 // way to include additional files in the APK that get unpacked at install |
| 19 // time. |
| 20 |
| 21 namespace ui { |
| 22 |
| 23 // static |
| 24 FilePath ResourceBundle::GetResourcesFilePath() { |
| 25 FilePath data_path; |
| 26 PathService::Get(base::DIR_MODULE, &data_path); |
| 27 DCHECK(!data_path.empty()); |
| 28 return data_path.Append("lib_chrome.pak.so"); |
| 29 } |
| 30 |
| 31 // static |
| 32 FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale) { |
| 33 FilePath locale_path; |
| 34 PathService::Get(base::DIR_MODULE, &locale_path); |
| 35 DCHECK(!locale_path.empty()); |
| 36 const std::string locale_name = |
| 37 StringPrintf("lib_%s.pak.so", app_locale.c_str()); |
| 38 locale_path = locale_path.Append(locale_name); |
| 39 if (!file_util::PathExists(locale_path)) |
| 40 return FilePath(); |
| 41 return locale_path; |
| 42 } |
| 43 |
| 44 gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id) { |
| 45 return GetImageNamed(resource_id); |
| 46 } |
| 47 |
| 48 // static |
| 49 FilePath ResourceBundle::GetLargeIconResourcesFilePath() { |
| 50 // Not supported. |
| 51 return FilePath(); |
| 52 } |
| 53 |
| 54 } |
OLD | NEW |