Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(279)

Side by Side Diff: app/resource_bundle_linux.cc

Issue 338028: ResourceBundle::GetRawDataResource should fall back to localized resources (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | app/resource_bundle_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "app/resource_bundle.h" 5 #include "app/resource_bundle.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include "app/app_paths.h" 9 #include "app/app_paths.h"
10 #include "app/gfx/font.h" 10 #include "app/gfx/font.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 if (!module->Get(resource_id, &bytes)) 125 if (!module->Get(resource_id, &bytes))
126 return NULL; 126 return NULL;
127 127
128 return new RefCountedStaticMemory( 128 return new RefCountedStaticMemory(
129 reinterpret_cast<const unsigned char*>(bytes.data()), bytes.length()); 129 reinterpret_cast<const unsigned char*>(bytes.data()), bytes.length());
130 } 130 }
131 131
132 base::StringPiece ResourceBundle::GetRawDataResource(int resource_id) { 132 base::StringPiece ResourceBundle::GetRawDataResource(int resource_id) {
133 DCHECK(resources_data_); 133 DCHECK(resources_data_);
134 base::StringPiece data; 134 base::StringPiece data;
135 if (!resources_data_->Get(resource_id, &data)) 135
136 return base::StringPiece(); 136 if (!resources_data_->Get(resource_id, &data)) {
137 if (!locale_resources_data_->Get(resource_id, &data)) {
138 return base::StringPiece();
139 }
140 }
141
137 return data; 142 return data;
138 } 143 }
139 144
140 string16 ResourceBundle::GetLocalizedString(int message_id) { 145 string16 ResourceBundle::GetLocalizedString(int message_id) {
141 // If for some reason we were unable to load a resource dll, return an empty 146 // If for some reason we were unable to load a resource dll, return an empty
142 // string (better than crashing). 147 // string (better than crashing).
143 if (!locale_resources_data_) { 148 if (!locale_resources_data_) {
144 LOG(WARNING) << "locale resources are not loaded"; 149 LOG(WARNING) << "locale resources are not loaded";
145 return string16(); 150 return string16();
146 } 151 }
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 } 218 }
214 } 219 }
215 220
216 GdkPixbuf* ResourceBundle::GetPixbufNamed(int resource_id) { 221 GdkPixbuf* ResourceBundle::GetPixbufNamed(int resource_id) {
217 return GetPixbufImpl(resource_id, false); 222 return GetPixbufImpl(resource_id, false);
218 } 223 }
219 224
220 GdkPixbuf* ResourceBundle::GetRTLEnabledPixbufNamed(int resource_id) { 225 GdkPixbuf* ResourceBundle::GetRTLEnabledPixbufNamed(int resource_id) {
221 return GetPixbufImpl(resource_id, true); 226 return GetPixbufImpl(resource_id, true);
222 } 227 }
OLDNEW
« no previous file with comments | « no previous file | app/resource_bundle_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698