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

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

Issue 10912156: Move SessionID, CaptureVisibleTabFunction to WebContents. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase atop the extension tab helper change Created 8 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.cc
diff --git a/chrome/browser/extensions/api/tabs/tabs.cc b/chrome/browser/extensions/api/tabs/tabs.cc
index d93d3d9c948a5deb1c9805bb70f272d922583ac0..a80f885a7a0ce854fcc80f3c0f641d566cc49fda 100644
--- a/chrome/browser/extensions/api/tabs/tabs.cc
+++ b/chrome/browser/extensions/api/tabs/tabs.cc
@@ -1232,7 +1232,7 @@ bool UpdateTabFunction::RunImpl() {
error_ = keys::kNoSelectedTabError;
return false;
}
- tab_id = SessionID::IdForTab(contents);
+ tab_id = SessionID::IdForTab(contents->web_contents());
} else {
EXTENSION_FUNCTION_VALIDATE(tab_value->GetAsInteger(&tab_id));
}
@@ -1601,8 +1601,7 @@ bool RemoveTabsFunction::RunImpl() {
return true;
}
-bool CaptureVisibleTabFunction::GetTabToCapture(
- WebContents** web_contents, TabContents** tab_contents) {
+bool CaptureVisibleTabFunction::GetTabToCapture(WebContents** web_contents) {
Browser* browser = NULL;
// windowId defaults to "current" window.
int window_id = extension_misc::kCurrentWindowId;
@@ -1619,8 +1618,6 @@ bool CaptureVisibleTabFunction::GetTabToCapture(
return false;
}
- *tab_contents = chrome::GetActiveTabContents(browser);
-
return true;
};
@@ -1632,8 +1629,7 @@ bool CaptureVisibleTabFunction::RunImpl() {
}
WebContents* web_contents = NULL;
- TabContents* tab_contents = NULL;
- if (!GetTabToCapture(&web_contents, &tab_contents))
+ if (!GetTabToCapture(&web_contents))
return false;
image_format_ = FORMAT_JPEG; // Default format is JPEG.
@@ -1669,7 +1665,7 @@ bool CaptureVisibleTabFunction::RunImpl() {
// permission to do this.
if (!GetExtension()->CanCaptureVisiblePage(
web_contents->GetURL(),
- SessionID::IdForTab(tab_contents),
+ SessionID::IdForTab(web_contents),
&error_)) {
return false;
}
@@ -1701,8 +1697,7 @@ void CaptureVisibleTabFunction::CopyFromBackingStoreComplete(
}
WebContents* web_contents = NULL;
- TabContents* tab_contents = NULL;
- if (!GetTabToCapture(&web_contents, &tab_contents)) {
+ if (!GetTabToCapture(&web_contents)) {
error_ = keys::kInternalVisibleTabCaptureError;
SendResponse(false);
return;
@@ -1713,7 +1708,8 @@ void CaptureVisibleTabFunction::CopyFromBackingStoreComplete(
chrome::NOTIFICATION_TAB_SNAPSHOT_TAKEN,
content::Source<WebContents>(web_contents));
AddRef(); // Balanced in CaptureVisibleTabFunction::Observe().
- tab_contents->snapshot_tab_helper()->CaptureSnapshot();
+ TabContents::FromWebContents(web_contents)->snapshot_tab_helper()->
+ CaptureSnapshot();
}
// If a backing store was not available in CaptureVisibleTabFunction::RunImpl,
« no previous file with comments | « chrome/browser/extensions/api/tabs/tabs.h ('k') | chrome/browser/extensions/extension_context_menu_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698