| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 PathService::Get(ui::FILE_RESOURCES_PAK, &resources_file_path); | 64 PathService::Get(ui::FILE_RESOURCES_PAK, &resources_file_path); |
| 65 return resources_file_path; | 65 return resources_file_path; |
| 66 } | 66 } |
| 67 | 67 |
| 68 // static | 68 // static |
| 69 FilePath ResourceBundle::GetLargeIconResourcesFilePath() { | 69 FilePath ResourceBundle::GetLargeIconResourcesFilePath() { |
| 70 // Not supported. | 70 // Not supported. |
| 71 return FilePath(); | 71 return FilePath(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 // static | |
| 75 FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale) { | |
| 76 FilePath locale_file_path; | |
| 77 PathService::Get(ui::DIR_LOCALES, &locale_file_path); | |
| 78 if (locale_file_path.empty()) | |
| 79 return locale_file_path; | |
| 80 if (app_locale.empty()) | |
| 81 return FilePath(); | |
| 82 locale_file_path = locale_file_path.AppendASCII(app_locale + ".pak"); | |
| 83 if (!file_util::PathExists(locale_file_path)) | |
| 84 return FilePath(); | |
| 85 return locale_file_path; | |
| 86 } | |
| 87 | |
| 88 gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id) { | 74 gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id) { |
| 89 return *GetPixbufImpl(resource_id, false); | 75 return *GetPixbufImpl(resource_id, false); |
| 90 } | 76 } |
| 91 | 77 |
| 92 gfx::Image* ResourceBundle::GetPixbufImpl(int resource_id, bool rtl_enabled) { | 78 gfx::Image* ResourceBundle::GetPixbufImpl(int resource_id, bool rtl_enabled) { |
| 93 // Use the negative |resource_id| for the key for BIDI-aware images. | 79 // Use the negative |resource_id| for the key for BIDI-aware images. |
| 94 int key = rtl_enabled ? -resource_id : resource_id; | 80 int key = rtl_enabled ? -resource_id : resource_id; |
| 95 | 81 |
| 96 // Check to see if the image is already in the cache. | 82 // Check to see if the image is already in the cache. |
| 97 { | 83 { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 123 LOG(WARNING) << "Unable to pixbuf with id " << resource_id; | 109 LOG(WARNING) << "Unable to pixbuf with id " << resource_id; |
| 124 NOTREACHED(); // Want to assert in debug mode. | 110 NOTREACHED(); // Want to assert in debug mode. |
| 125 return GetEmptyImage(); | 111 return GetEmptyImage(); |
| 126 } | 112 } |
| 127 | 113 |
| 128 GdkPixbuf* ResourceBundle::GetRTLEnabledPixbufNamed(int resource_id) { | 114 GdkPixbuf* ResourceBundle::GetRTLEnabledPixbufNamed(int resource_id) { |
| 129 return *GetPixbufImpl(resource_id, true); | 115 return *GetPixbufImpl(resource_id, true); |
| 130 } | 116 } |
| 131 | 117 |
| 132 } // namespace ui | 118 } // namespace ui |
| OLD | NEW |