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 |
74 gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id) { | 88 gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id) { |
75 return *GetPixbufImpl(resource_id, false); | 89 return *GetPixbufImpl(resource_id, false); |
76 } | 90 } |
77 | 91 |
78 gfx::Image* ResourceBundle::GetPixbufImpl(int resource_id, bool rtl_enabled) { | 92 gfx::Image* ResourceBundle::GetPixbufImpl(int resource_id, bool rtl_enabled) { |
79 // Use the negative |resource_id| for the key for BIDI-aware images. | 93 // Use the negative |resource_id| for the key for BIDI-aware images. |
80 int key = rtl_enabled ? -resource_id : resource_id; | 94 int key = rtl_enabled ? -resource_id : resource_id; |
81 | 95 |
82 // Check to see if the image is already in the cache. | 96 // Check to see if the image is already in the cache. |
83 { | 97 { |
(...skipping 25 matching lines...) Expand all Loading... |
109 LOG(WARNING) << "Unable to pixbuf with id " << resource_id; | 123 LOG(WARNING) << "Unable to pixbuf with id " << resource_id; |
110 NOTREACHED(); // Want to assert in debug mode. | 124 NOTREACHED(); // Want to assert in debug mode. |
111 return GetEmptyImage(); | 125 return GetEmptyImage(); |
112 } | 126 } |
113 | 127 |
114 GdkPixbuf* ResourceBundle::GetRTLEnabledPixbufNamed(int resource_id) { | 128 GdkPixbuf* ResourceBundle::GetRTLEnabledPixbufNamed(int resource_id) { |
115 return *GetPixbufImpl(resource_id, true); | 129 return *GetPixbufImpl(resource_id, true); |
116 } | 130 } |
117 | 131 |
118 } // namespace ui | 132 } // namespace ui |
OLD | NEW |