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

Unified Diff: chrome/browser/extensions/api/tabs/execute_code_in_tab_function.cc

Issue 10443105: Take 2 at implementing activeTab. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: empty -> is_empty Created 8 years, 6 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/api/tabs/execute_code_in_tab_function.cc
diff --git a/chrome/browser/extensions/api/tabs/execute_code_in_tab_function.cc b/chrome/browser/extensions/api/tabs/execute_code_in_tab_function.cc
index 9cd9c3f6625f79601d3d3e8ad95b38be55cfd984..cdcbd0dc46e75f049a3ece1632e995af39973195 100644
--- a/chrome/browser/extensions/api/tabs/execute_code_in_tab_function.cc
+++ b/chrome/browser/extensions/api/tabs/execute_code_in_tab_function.cc
@@ -90,7 +90,7 @@ bool ExecuteCodeInTabFunction::RunImpl() {
CHECK(browser);
CHECK(contents);
if (!GetExtension()->CanExecuteScriptOnPage(
- contents->web_contents()->GetURL(), NULL, &error_)) {
+ contents->web_contents()->GetURL(), execute_tab_id_, NULL, &error_)) {
return false;
}
@@ -120,11 +120,8 @@ bool ExecuteCodeInTabFunction::RunImpl() {
return false;
}
- if (!code_string.empty()) {
- if (!Execute(code_string))
- return false;
- return true;
- }
+ if (!code_string.empty())
+ return Execute(code_string);
std::string relative_path;
if (script_info->HasKey(keys::kFileKey)) {
@@ -204,7 +201,8 @@ void ExecuteCodeInTabFunction::LocalizeCSS(
void ExecuteCodeInTabFunction::DidLoadAndLocalizeFile(bool success,
const std::string& data) {
if (success) {
- Execute(data);
+ if (!Execute(data))
+ SendResponse(false);
} else {
#if defined(OS_POSIX)
// TODO(viettrungluu): bug: there's no particular reason the path should be
@@ -227,16 +225,12 @@ bool ExecuteCodeInTabFunction::Execute(const std::string& code_string) {
execute_tab_id_, profile(), include_incognito(), &browser, NULL,
&contents, NULL) && contents && browser;
- if (!success) {
- SendResponse(false);
+ if (!success)
return false;
- }
const extensions::Extension* extension = GetExtension();
- if (!extension) {
- SendResponse(false);
+ if (!extension)
return false;
- }
ScriptExecutor::ScriptType script_type = ScriptExecutor::JAVASCRIPT;
std::string function_name = name();
« no previous file with comments | « chrome/browser/extensions/api/offscreen_tabs/offscreen_tabs_api.cc ('k') | chrome/browser/extensions/api/tabs/tabs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698