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

Unified Diff: chrome/browser/extensions/browser_event_router.cc

Issue 11308012: Remove some TabContentses from extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 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/browser_event_router.cc
diff --git a/chrome/browser/extensions/browser_event_router.cc b/chrome/browser/extensions/browser_event_router.cc
index 09e9fc8c7e6a06ba171b1713bb00c935f2aef5b4..b16d6d6659aed1c428837dba6a075cfa22e2550b 100644
--- a/chrome/browser/extensions/browser_event_router.cc
+++ b/chrome/browser/extensions/browser_event_router.cc
@@ -89,8 +89,7 @@ void BrowserEventRouter::Init() {
Browser* browser = *iter;
if (browser->tab_strip_model()) {
for (int i = 0; i < browser->tab_strip_model()->count(); ++i) {
- WebContents* contents =
- chrome::GetTabContentsAt(browser, i)->web_contents();
+ WebContents* contents = chrome::GetWebContentsAt(browser, i);
int tab_id = ExtensionTabUtil::GetTabId(contents);
tab_entries_[tab_id] = TabEntry();
}
@@ -121,8 +120,7 @@ void BrowserEventRouter::RegisterForBrowserNotifications(Browser* browser) {
browser->tab_strip_model()->AddObserver(this);
for (int i = 0; i < browser->tab_strip_model()->count(); ++i) {
- RegisterForTabNotifications(
- chrome::GetTabContentsAt(browser, i)->web_contents());
+ RegisterForTabNotifications(chrome::GetWebContentsAt(browser, i));
}
}
@@ -295,10 +293,10 @@ void BrowserEventRouter::TabSelectionChanged(
for (size_t i = 0; i < new_selection.size(); ++i) {
int index = new_selection[i];
- TabContents* contents = tab_strip_model->GetTabContentsAt(index);
+ WebContents* contents = tab_strip_model->GetWebContentsAt(index);
if (!contents)
break;
- int tab_id = ExtensionTabUtil::GetTabId(contents->web_contents());
+ int tab_id = ExtensionTabUtil::GetTabId(contents);
all->Append(Value::CreateIntegerValue(tab_id));
}
@@ -524,11 +522,11 @@ void BrowserEventRouter::BrowserActionExecuted(
const ExtensionAction& browser_action,
Browser* browser) {
Profile* profile = browser->profile();
- TabContents* tab_contents = NULL;
+ WebContents* web_contents = NULL;
int tab_id = 0;
- if (!ExtensionTabUtil::GetDefaultTab(browser, &tab_contents, &tab_id))
+ if (!ExtensionTabUtil::GetDefaultTab(browser, &web_contents, &tab_id))
return;
- ExtensionActionExecuted(profile, browser_action, tab_contents);
+ ExtensionActionExecuted(profile, browser_action, web_contents);
}
void BrowserEventRouter::PageActionExecuted(Profile* profile,
@@ -538,24 +536,24 @@ void BrowserEventRouter::PageActionExecuted(Profile* profile,
int button) {
DispatchOldPageActionEvent(profile, page_action.extension_id(),
page_action.id(), tab_id, url, button);
- TabContents* tab_contents = NULL;
+ WebContents* web_contents = NULL;
if (!ExtensionTabUtil::GetTabById(tab_id, profile, profile->IsOffTheRecord(),
- NULL, NULL, &tab_contents, NULL)) {
+ NULL, NULL, &web_contents, NULL)) {
return;
}
- ExtensionActionExecuted(profile, page_action, tab_contents);
+ ExtensionActionExecuted(profile, page_action, web_contents);
}
void BrowserEventRouter::ScriptBadgeExecuted(
Profile* profile,
const ExtensionAction& script_badge,
int tab_id) {
- TabContents* tab_contents = NULL;
+ WebContents* web_contents = NULL;
if (!ExtensionTabUtil::GetTabById(tab_id, profile, profile->IsOffTheRecord(),
- NULL, NULL, &tab_contents, NULL)) {
+ NULL, NULL, &web_contents, NULL)) {
return;
}
- ExtensionActionExecuted(profile, script_badge, tab_contents);
+ ExtensionActionExecuted(profile, script_badge, web_contents);
}
void BrowserEventRouter::CommandExecuted(Profile* profile,
@@ -574,7 +572,7 @@ void BrowserEventRouter::CommandExecuted(Profile* profile,
void BrowserEventRouter::ExtensionActionExecuted(
Profile* profile,
const ExtensionAction& extension_action,
- TabContents* tab_contents) {
+ WebContents* web_contents) {
const char* event_name = NULL;
switch (extension_action.action_type()) {
case Extension::ActionInfo::TYPE_BROWSER:
@@ -591,7 +589,7 @@ void BrowserEventRouter::ExtensionActionExecuted(
if (event_name) {
scoped_ptr<ListValue> args(new ListValue());
DictionaryValue* tab_value = ExtensionTabUtil::CreateTabValue(
- tab_contents->web_contents(),
+ web_contents,
ExtensionTabUtil::INCLUDE_PRIVACY_SENSITIVE_FIELDS);
args->Append(tab_value);
« no previous file with comments | « chrome/browser/extensions/browser_event_router.h ('k') | chrome/browser/extensions/extension_devtools_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698