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

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

Issue 4694008: Make pink's TabContentsWrapper change compile on Windows.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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/extension_browser_event_router.cc
===================================================================
--- chrome/browser/extensions/extension_browser_event_router.cc (revision 66453)
+++ chrome/browser/extensions/extension_browser_event_router.cc (working copy)
@@ -13,6 +13,8 @@
#include "chrome/browser/profile.h"
#include "chrome/browser/tab_contents/navigation_entry.h"
#include "chrome/browser/tab_contents/tab_contents.h"
+#include "chrome/browser/tab_contents_wrapper.h"
+#include "chrome/browser/tab_contents_wrapper.h"
#include "chrome/browser/tabs/tab_strip_model.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/common/extensions/extension_constants.h"
@@ -137,7 +139,7 @@
Browser* browser = *iter;
if (browser->tabstrip_model()) {
for (int i = 0; i < browser->tabstrip_model()->count(); ++i) {
- TabContents* contents = browser->tabstrip_model()->GetTabContentsAt(i);
+ TabContents* contents = browser->GetTabContentsAt(i);
int tab_id = ExtensionTabUtil::GetTabId(contents);
tab_entries_[tab_id] = TabEntry();
}
@@ -171,8 +173,7 @@
if (browser->tabstrip_model()) {
for (int i = 0; i < browser->tabstrip_model()->count(); ++i)
- RegisterForTabNotifications(
- browser->tabstrip_model()->GetTabContentsAt(i));
+ RegisterForTabNotifications(browser->GetTabContentsAt(i));
}
}
@@ -265,15 +266,15 @@
RegisterForTabNotifications(contents);
}
-void ExtensionBrowserEventRouter::TabInsertedAt(TabContents* contents,
+void ExtensionBrowserEventRouter::TabInsertedAt(TabContentsWrapper* contents,
int index,
bool foreground) {
// If tab is new, send created event.
- int tab_id = ExtensionTabUtil::GetTabId(contents);
- if (!GetTabEntry(contents)) {
+ int tab_id = ExtensionTabUtil::GetTabId(contents->tab_contents());
+ if (!GetTabEntry(contents->tab_contents())) {
tab_entries_[tab_id] = TabEntry();
- TabCreatedAt(contents, index, foreground);
+ TabCreatedAt(contents->tab_contents(), index, foreground);
return;
}
@@ -282,7 +283,7 @@
DictionaryValue* object_args = new DictionaryValue();
object_args->Set(tab_keys::kNewWindowIdKey, Value::CreateIntegerValue(
- ExtensionTabUtil::GetWindowIdOfTab(contents)));
+ ExtensionTabUtil::GetWindowIdOfTab(contents->tab_contents())));
object_args->Set(tab_keys::kNewPositionKey, Value::CreateIntegerValue(
index));
args.Append(object_args);
@@ -293,19 +294,20 @@
DispatchEvent(contents->profile(), events::kOnTabAttached, json_args);
}
-void ExtensionBrowserEventRouter::TabDetachedAt(TabContents* contents,
+void ExtensionBrowserEventRouter::TabDetachedAt(TabContentsWrapper* contents,
int index) {
- if (!GetTabEntry(contents)) {
+ if (!GetTabEntry(contents->tab_contents())) {
// The tab was removed. Don't send detach event.
return;
}
ListValue args;
- args.Append(Value::CreateIntegerValue(ExtensionTabUtil::GetTabId(contents)));
+ args.Append(Value::CreateIntegerValue(
+ ExtensionTabUtil::GetTabId(contents->tab_contents())));
DictionaryValue* object_args = new DictionaryValue();
object_args->Set(tab_keys::kOldWindowIdKey, Value::CreateIntegerValue(
- ExtensionTabUtil::GetWindowIdOfTab(contents)));
+ ExtensionTabUtil::GetWindowIdOfTab(contents->tab_contents())));
object_args->Set(tab_keys::kOldPositionKey, Value::CreateIntegerValue(
index));
args.Append(object_args);
@@ -317,9 +319,9 @@
}
void ExtensionBrowserEventRouter::TabClosingAt(TabStripModel* tab_strip_model,
- TabContents* contents,
+ TabContentsWrapper* contents,
int index) {
- int tab_id = ExtensionTabUtil::GetTabId(contents);
+ int tab_id = ExtensionTabUtil::GetTabId(contents->tab_contents());
ListValue args;
args.Append(Value::CreateIntegerValue(tab_id));
@@ -337,20 +339,21 @@
int removed_count = tab_entries_.erase(tab_id);
DCHECK_GT(removed_count, 0);
- UnregisterForTabNotifications(contents);
+ UnregisterForTabNotifications(contents->tab_contents());
}
-void ExtensionBrowserEventRouter::TabSelectedAt(TabContents* old_contents,
- TabContents* new_contents,
- int index,
- bool user_gesture) {
+void ExtensionBrowserEventRouter::TabSelectedAt(
+ TabContentsWrapper* old_contents,
+ TabContentsWrapper* new_contents,
+ int index,
+ bool user_gesture) {
ListValue args;
args.Append(Value::CreateIntegerValue(
- ExtensionTabUtil::GetTabId(new_contents)));
+ ExtensionTabUtil::GetTabId(new_contents->tab_contents())));
DictionaryValue* object_args = new DictionaryValue();
object_args->Set(tab_keys::kWindowIdKey, Value::CreateIntegerValue(
- ExtensionTabUtil::GetWindowIdOfTab(new_contents)));
+ ExtensionTabUtil::GetWindowIdOfTab(new_contents->tab_contents())));
args.Append(object_args);
std::string json_args;
@@ -360,15 +363,16 @@
json_args);
}
-void ExtensionBrowserEventRouter::TabMoved(TabContents* contents,
+void ExtensionBrowserEventRouter::TabMoved(TabContentsWrapper* contents,
int from_index,
int to_index) {
ListValue args;
- args.Append(Value::CreateIntegerValue(ExtensionTabUtil::GetTabId(contents)));
+ args.Append(Value::CreateIntegerValue(
+ ExtensionTabUtil::GetTabId(contents->tab_contents())));
DictionaryValue* object_args = new DictionaryValue();
object_args->Set(tab_keys::kWindowIdKey, Value::CreateIntegerValue(
- ExtensionTabUtil::GetWindowIdOfTab(contents)));
+ ExtensionTabUtil::GetWindowIdOfTab(contents->tab_contents())));
object_args->Set(tab_keys::kFromIndexKey, Value::CreateIntegerValue(
from_index));
object_args->Set(tab_keys::kToIndexKey, Value::CreateIntegerValue(
@@ -456,29 +460,32 @@
}
}
-void ExtensionBrowserEventRouter::TabChangedAt(TabContents* contents,
+void ExtensionBrowserEventRouter::TabChangedAt(TabContentsWrapper* contents,
int index,
TabChangeType change_type) {
- TabUpdated(contents, false);
+ TabUpdated(contents->tab_contents(), false);
}
-void ExtensionBrowserEventRouter::TabReplacedAt(TabContents* old_contents,
- TabContents* new_contents,
- int index) {
- UnregisterForTabNotifications(old_contents);
- RegisterForTabNotifications(new_contents);
+void ExtensionBrowserEventRouter::TabReplacedAt(
+ TabContentsWrapper* old_contents,
+ TabContentsWrapper* new_contents,
+ int index) {
+ UnregisterForTabNotifications(old_contents->tab_contents());
+ RegisterForTabNotifications(new_contents->tab_contents());
}
-void ExtensionBrowserEventRouter::TabPinnedStateChanged(TabContents* contents,
- int index) {
+void ExtensionBrowserEventRouter::TabPinnedStateChanged(
+ TabContentsWrapper* contents,
+ int index) {
TabStripModel* tab_strip = NULL;
int tab_index;
- if (ExtensionTabUtil::GetTabStripModel(contents, &tab_strip, &tab_index)) {
+ if (ExtensionTabUtil::GetTabStripModel(
+ contents->tab_contents(), &tab_strip, &tab_index)) {
DictionaryValue* changed_properties = new DictionaryValue();
changed_properties->SetBoolean(tab_keys::kPinnedKey,
tab_strip->IsTabPinned(tab_index));
- DispatchTabUpdatedEvent(contents, changed_properties);
+ DispatchTabUpdatedEvent(contents->tab_contents(), changed_properties);
}
}
@@ -515,21 +522,21 @@
int button) {
DispatchOldPageActionEvent(profile, extension_id, page_action_id, tab_id, url,
button);
- TabContents* tab_contents = NULL;
+ TabContentsWrapper* tab_contents = NULL;
if (!ExtensionTabUtil::GetTabById(tab_id, profile, profile->IsOffTheRecord(),
NULL, NULL, &tab_contents, NULL)) {
return;
}
DispatchEventWithTab(profile, extension_id, "pageAction.onClicked",
- tab_contents);
+ tab_contents->tab_contents());
}
void ExtensionBrowserEventRouter::BrowserActionExecuted(
Profile* profile, const std::string& extension_id, Browser* browser) {
- TabContents* tab_contents = NULL;
+ TabContentsWrapper* tab_contents = NULL;
int tab_id = 0;
if (!ExtensionTabUtil::GetDefaultTab(browser, &tab_contents, &tab_id))
return;
DispatchEventWithTab(profile, extension_id, "browserAction.onClicked",
- tab_contents);
+ tab_contents->tab_contents());
}

Powered by Google App Engine
This is Rietveld 408576698