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

Unified Diff: chrome/browser/ui/sync/tab_contents_synced_tab_delegate.cc

Issue 11030004: Switch TabContentsSyncedTabDelegate to use WebContentsUserData. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase, added TODO 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/ui/sync/tab_contents_synced_tab_delegate.cc
diff --git a/chrome/browser/ui/sync/tab_contents_synced_tab_delegate.cc b/chrome/browser/ui/sync/tab_contents_synced_tab_delegate.cc
index 2e9992e4a8ea2fa41f15fc13a98d402e71aea494..2b3563e8346e97b5160c87828304536b1c5c23cb 100644
--- a/chrome/browser/ui/sync/tab_contents_synced_tab_delegate.cc
+++ b/chrome/browser/ui/sync/tab_contents_synced_tab_delegate.cc
@@ -16,61 +16,62 @@
using content::NavigationEntry;
+DEFINE_WEB_CONTENTS_USER_DATA_KEY(TabContentsSyncedTabDelegate)
+
TabContentsSyncedTabDelegate::TabContentsSyncedTabDelegate(
- TabContents* tab_contents)
- : tab_contents_(tab_contents) {}
+ content::WebContents* web_contents)
+ : web_contents_(web_contents) {}
TabContentsSyncedTabDelegate::~TabContentsSyncedTabDelegate() {}
SessionID::id_type TabContentsSyncedTabDelegate::GetWindowId() const {
- return SessionTabHelper::FromWebContents(tab_contents_->web_contents())->
- window_id().id();
+ return SessionTabHelper::FromWebContents(web_contents_)->window_id().id();
}
SessionID::id_type TabContentsSyncedTabDelegate::GetSessionId() const {
- return SessionTabHelper::FromWebContents(tab_contents_->web_contents())->
- session_id().id();
+ return SessionTabHelper::FromWebContents(web_contents_)->session_id().id();
}
bool TabContentsSyncedTabDelegate::IsBeingDestroyed() const {
- return tab_contents_->in_destructor();
+ // TODO(avi): Switch to just the web contents call when the
+ // SessionChangeProcessor is switched to NOTIFICATION_WEB_CONTENTS_DESTROYED
+ // from NOTIFICATION_TAB_CONTENTS_DESTROYED.
+ TabContents* tab_contents = TabContents::FromWebContents(web_contents_);
+ return tab_contents->in_destructor() || web_contents_->IsBeingDestroyed();
}
Profile* TabContentsSyncedTabDelegate::profile() const {
- return tab_contents_->profile();
+ return Profile::FromBrowserContext(web_contents_->GetBrowserContext());
}
std::string TabContentsSyncedTabDelegate::GetExtensionAppId() const {
const scoped_refptr<const extensions::Extension> extension_app(
- extensions::TabHelper::FromWebContents(
- tab_contents_->web_contents())->extension_app());
+ extensions::TabHelper::FromWebContents(web_contents_)->extension_app());
return (extension_app.get() ? extension_app->id() : "");
}
int TabContentsSyncedTabDelegate::GetCurrentEntryIndex() const {
- return tab_contents_->web_contents()->GetController().GetCurrentEntryIndex();
+ return web_contents_->GetController().GetCurrentEntryIndex();
}
int TabContentsSyncedTabDelegate::GetEntryCount() const {
- return tab_contents_->web_contents()->GetController().GetEntryCount();
+ return web_contents_->GetController().GetEntryCount();
}
int TabContentsSyncedTabDelegate::GetPendingEntryIndex() const {
- return tab_contents_->web_contents()->GetController().GetPendingEntryIndex();
+ return web_contents_->GetController().GetPendingEntryIndex();
}
NavigationEntry* TabContentsSyncedTabDelegate::GetPendingEntry() const {
- return
- tab_contents_->web_contents()->GetController().GetPendingEntry();
+ return web_contents_->GetController().GetPendingEntry();
}
-NavigationEntry* TabContentsSyncedTabDelegate::GetEntryAtIndex(int i)
- const {
- return tab_contents_->web_contents()->GetController().GetEntryAtIndex(i);
+NavigationEntry* TabContentsSyncedTabDelegate::GetEntryAtIndex(int i) const {
+ return web_contents_->GetController().GetEntryAtIndex(i);
}
NavigationEntry* TabContentsSyncedTabDelegate::GetActiveEntry() const {
- return tab_contents_->web_contents()->GetController().GetActiveEntry();
+ return web_contents_->GetController().GetActiveEntry();
}
bool TabContentsSyncedTabDelegate::IsPinned() const {
« no previous file with comments | « chrome/browser/ui/sync/tab_contents_synced_tab_delegate.h ('k') | chrome/browser/ui/tab_contents/tab_contents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698