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

Unified Diff: chrome/browser/extensions/execute_code_in_tab_function.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
Index: chrome/browser/extensions/execute_code_in_tab_function.cc
===================================================================
--- chrome/browser/extensions/execute_code_in_tab_function.cc (revision 28272)
+++ chrome/browser/extensions/execute_code_in_tab_function.cc (working copy)
@@ -7,7 +7,7 @@
#include "chrome/browser/browser.h"
#include "chrome/browser/extensions/extension_tabs_module.h"
#include "chrome/browser/extensions/extension_tabs_module_constants.h"
-#include "chrome/browser/net/file_reader.h"
+#include "chrome/browser/extensions/file_reader.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_error_utils.h"
@@ -80,15 +80,15 @@
if (script_info->HasKey(kFileKey)) {
if (!script_info->GetString(kFileKey, &relative_path))
return false;
- file_path_ = GetExtension()->GetResourcePath(relative_path);
+ resource_ = GetExtension()->GetResource(relative_path);
}
- if (file_path_.empty()) {
+ if (resource_.extension_root().empty() || resource_.relative_path().empty()) {
error_ = keys::kNoCodeOrFileToExecuteError;
return false;
}
scoped_refptr<FileReader> file_reader(new FileReader(
- file_path_, NewCallback(this, &ExecuteCodeInTabFunction::DidLoadFile)));
+ resource_, NewCallback(this, &ExecuteCodeInTabFunction::DidLoadFile)));
file_reader->Start();
AddRef(); // Keep us alive until DidLoadFile is called.
@@ -102,10 +102,10 @@
} else {
#if defined(OS_POSIX)
error_ = ExtensionErrorUtils::FormatErrorMessage(keys::kLoadFileError,
- file_path_.value());
+ resource_.relative_path().value());
#elif defined(OS_WIN)
error_ = ExtensionErrorUtils::FormatErrorMessage(keys::kLoadFileError,
- WideToUTF8(file_path_.value()));
+ WideToUTF8(resource_.relative_path().value()));
#endif // OS_WIN
SendResponse(false);
}

Powered by Google App Engine
This is Rietveld 408576698