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

Unified Diff: chrome/browser/extensions/user_script_master.cc

Issue 256022: Loads local resources from current locale subtree if available, if not it fal... (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
« no previous file with comments | « chrome/browser/extensions/image_loading_tracker.cc ('k') | chrome/browser/gtk/location_bar_view_gtk.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/user_script_master.cc
===================================================================
--- chrome/browser/extensions/user_script_master.cc (revision 28272)
+++ chrome/browser/extensions/user_script_master.cc (working copy)
@@ -136,20 +136,20 @@
static bool LoadScriptContent(UserScript::File* script_file) {
std::string content;
- if (!file_util::ReadFileToString(script_file->path(), &content)) {
- LOG(WARNING) << "Failed to load user script file: "
- << script_file->path().value();
+ FilePath path = script_file->resource().GetFilePath();
+ if (path.empty() || !file_util::ReadFileToString(path, &content)) {
+ LOG(WARNING) << "Failed to load user script file: " << path.value();
return false;
}
script_file->set_content(content);
- LOG(INFO) << "Loaded user script file: " << script_file->path().value();
+ LOG(INFO) << "Loaded user script file: " << path.value();
return true;
}
void UserScriptMaster::ScriptReloader::LoadScriptsFromDirectory(
const FilePath& script_dir, UserScriptList* result) {
- // Clear the list. We will populate it with the scrips found in script_dir.
+ // Clear the list. We will populate it with the scripts found in script_dir.
result->clear();
// Find all the scripts in |script_dir|.
@@ -168,7 +168,8 @@
// Push single js file in this UserScript.
GURL url(std::string(chrome::kUserScriptScheme) + ":/" +
net::FilePathToFileURL(file).ExtractFileName());
- user_script.js_scripts().push_back(UserScript::File(file, url));
+ ExtensionResource resource(script_dir, file.BaseName());
+ user_script.js_scripts().push_back(UserScript::File(resource, url));
UserScript::File& script_file = user_script.js_scripts().back();
if (!LoadScriptContent(&script_file))
result->pop_back();
« no previous file with comments | « chrome/browser/extensions/image_loading_tracker.cc ('k') | chrome/browser/gtk/location_bar_view_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698