summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/user_script_master.cc
diff options
context:
space:
mode:
authormad@chromium.org <mad@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-20 15:27:21 +0000
committermad@chromium.org <mad@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-20 15:27:21 +0000
commit9194b3fc91953bb1472d8671d2322ac5616ee0b4 (patch)
treed9d60fc09ec8dc5ad6fb65499ad5bcce1d06de0f /chrome/browser/extensions/user_script_master.cc
parenta4dc33f2e485e586cc3fb03142c2800249fe9ced (diff)
downloadchromium_src-9194b3fc91953bb1472d8671d2322ac5616ee0b4.zip
chromium_src-9194b3fc91953bb1472d8671d2322ac5616ee0b4.tar.gz
chromium_src-9194b3fc91953bb1472d8671d2322ac5616ee0b4.tar.bz2
Minimize dependency of user scripts.
And made some minor lint fixes and code refactoring on the way, based on CR comments of previous attempt. BUG=none TEST=Make sure that the extension resources can still be properly localized and that they also load correctly when they are not localized. Review URL: http://codereview.chromium.org/267051 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29512 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/user_script_master.cc')
-rw-r--r--chrome/browser/extensions/user_script_master.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/chrome/browser/extensions/user_script_master.cc b/chrome/browser/extensions/user_script_master.cc
index f58a9e6..024de80 100644
--- a/chrome/browser/extensions/user_script_master.cc
+++ b/chrome/browser/extensions/user_script_master.cc
@@ -136,7 +136,8 @@ void UserScriptMaster::ScriptReloader::NotifyMaster(
static bool LoadScriptContent(UserScript::File* script_file) {
std::string content;
- FilePath path = script_file->resource().GetFilePath();
+ const FilePath& path = ExtensionResource::GetFilePath(
+ script_file->extension_root(), script_file->relative_path());
if (path.empty() || !file_util::ReadFileToString(path, &content)) {
LOG(WARNING) << "Failed to load user script file: " << path.value();
return false;
@@ -168,8 +169,8 @@ void UserScriptMaster::ScriptReloader::LoadScriptsFromDirectory(
// Push single js file in this UserScript.
GURL url(std::string(chrome::kUserScriptScheme) + ":/" +
net::FilePathToFileURL(file).ExtractFileName());
- ExtensionResource resource(script_dir, file.BaseName());
- user_script.js_scripts().push_back(UserScript::File(resource, url));
+ user_script.js_scripts().push_back(UserScript::File(
+ script_dir, file.BaseName(), url));
UserScript::File& script_file = user_script.js_scripts().back();
if (!LoadScriptContent(&script_file))
result->pop_back();