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

Unified Diff: chrome/common/extensions/extension_resource.cc

Issue 316013: Loading local resources uses improved fallback algorithm.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/extension_resource.cc
===================================================================
--- chrome/common/extensions/extension_resource.cc (revision 29776)
+++ chrome/common/extensions/extension_resource.cc (working copy)
@@ -37,17 +37,23 @@
// Static version...
FilePath ExtensionResource::GetFilePath(const FilePath& extension_root,
const FilePath& relative_path) {
- // Stat l10n file, and return new path if it exists.
- FilePath l10n_relative_path =
- extension_l10n_util::GetL10nRelativePath(relative_path);
- FilePath full_path;
- if (extension_root.AppendAndResolveRelative(l10n_relative_path, &full_path) &&
- extension_root.IsParent(full_path) &&
- file_util::PathExists(full_path)) {
- return full_path;
+ std::vector<FilePath> l10n_relative_paths;
+ extension_l10n_util::GetL10nRelativePaths(relative_path,
+ &l10n_relative_paths);
+
+ // Stat l10n file(s), and return new path if it exists.
+ for (size_t i = 0; i < l10n_relative_paths.size(); ++i) {
+ FilePath full_path;
+ if (extension_root.AppendAndResolveRelative(l10n_relative_paths[i],
+ &full_path) &&
+ extension_root.IsParent(full_path) &&
+ file_util::PathExists(full_path)) {
+ return full_path;
+ }
}
// Fall back to root resource.
+ FilePath full_path;
if (extension_root.AppendAndResolveRelative(relative_path, &full_path) &&
extension_root.IsParent(full_path)) {
return full_path;
« no previous file with comments | « chrome/browser/extensions/extension_l10n_util_unittest.cc ('k') | chrome/common/extensions/extension_resource_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698