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

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

Issue 543873002: Add ChromeExtensionFunctionDetails (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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/tabs_api.cc
diff --git a/chrome/browser/extensions/api/tabs/tabs_api.cc b/chrome/browser/extensions/api/tabs/tabs_api.cc
index 11ec2538c6922940bffa69cc308d47f54afcf2dd..41138a889f0b4187e546813de29f259d65c95db0 100644
--- a/chrome/browser/extensions/api/tabs/tabs_api.cc
+++ b/chrome/browser/extensions/api/tabs/tabs_api.cc
@@ -1633,7 +1633,7 @@ void TabsDetectLanguageFunction::GotLanguage(const std::string& language) {
}
ExecuteCodeInTabFunction::ExecuteCodeInTabFunction()
- : execute_tab_id_(-1) {
+ : chrome_details_(this), execute_tab_id_(-1) {
}
ExecuteCodeInTabFunction::~ExecuteCodeInTabFunction() {}
@@ -1654,7 +1654,7 @@ bool ExecuteCodeInTabFunction::CanExecuteScriptOnPage() {
// tab in the current window.
CHECK_GE(execute_tab_id_, 0);
if (!GetTabById(execute_tab_id_,
- GetProfile(),
+ chrome_details_.GetProfile(),
include_incognito(),
NULL,
NULL,
@@ -1687,7 +1687,7 @@ ScriptExecutor* ExecuteCodeInTabFunction::GetScriptExecutor() {
content::WebContents* contents = NULL;
bool success = GetTabById(execute_tab_id_,
- GetProfile(),
+ chrome_details_.GetProfile(),
include_incognito(),
&browser,
NULL,
@@ -1710,19 +1710,6 @@ const GURL& ExecuteCodeInTabFunction::GetWebViewSrc() const {
return GURL::EmptyGURL();
}
-bool TabsExecuteScriptFunction::ShouldInsertCSS() const {
- return false;
-}
-
-void TabsExecuteScriptFunction::OnExecuteCodeFinished(
- const std::string& error,
- const GURL& on_url,
- const base::ListValue& result) {
- if (error.empty())
- SetResult(result.DeepCopy());
- ExecuteCodeInTabFunction::OnExecuteCodeFinished(error, on_url, result);
-}
-
bool ExecuteCodeInTabFunction::Init() {
scheib 2014/09/05 03:17:22 Thanks for fixing other member's order to match de
Ken Rockot(use gerrit already) 2014/09/05 16:47:39 Done.
if (details_.get())
return true;
@@ -1743,7 +1730,7 @@ bool ExecuteCodeInTabFunction::Init() {
// If the tab ID wasn't given then it needs to be converted to the
// currently active tab's ID.
if (tab_id == -1) {
- Browser* browser = GetCurrentBrowser();
+ Browser* browser = chrome_details_.GetCurrentBrowser();
if (!browser)
return false;
content::WebContents* web_contents = NULL;
@@ -1756,6 +1743,19 @@ bool ExecuteCodeInTabFunction::Init() {
return true;
}
+bool TabsExecuteScriptFunction::ShouldInsertCSS() const {
+ return false;
+}
+
+void TabsExecuteScriptFunction::OnExecuteCodeFinished(
+ const std::string& error,
+ const GURL& on_url,
+ const base::ListValue& result) {
+ if (error.empty())
+ SetResult(result.DeepCopy());
+ ExecuteCodeInTabFunction::OnExecuteCodeFinished(error, on_url, result);
+}
+
bool TabsInsertCSSFunction::ShouldInsertCSS() const {
return true;
}

Powered by Google App Engine
This is Rietveld 408576698