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

Unified Diff: chrome/browser/sync/glue/session_change_processor.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
« no previous file with comments | « no previous file | chrome/browser/sync/glue/synced_tab_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/glue/session_change_processor.cc
diff --git a/chrome/browser/sync/glue/session_change_processor.cc b/chrome/browser/sync/glue/session_change_processor.cc
index a79c5d10db5f76f8b2811bac6a4548b98a7ef18d..2d883d0a759f5d294ecf06a556263c01511b1e91 100644
--- a/chrome/browser/sync/glue/session_change_processor.cc
+++ b/chrome/browser/sync/glue/session_change_processor.cc
@@ -45,11 +45,8 @@ static const char kNTPOpenTabSyncURL[] = "chrome://newtab/#open_tabs";
// from a NavigationController, if it exists. Returns |NULL| otherwise.
SyncedTabDelegate* ExtractSyncedTabDelegate(
const content::NotificationSource& source) {
- TabContents* tab = TabContents::FromWebContents(
+ return TabContentsSyncedTabDelegate::FromWebContents(
content::Source<NavigationController>(source).ptr()->GetWebContents());
- if (!tab)
- return NULL;
- return tab->synced_tab_delegate();
}
} // namespace
@@ -111,9 +108,9 @@ void SessionChangeProcessor::Observe(
}
case chrome::NOTIFICATION_TAB_PARENTED: {
- TabContents* tab_contents = TabContents::FromWebContents(
- content::Source<WebContents>(source).ptr());
- SyncedTabDelegate* tab = tab_contents->synced_tab_delegate();
+ WebContents* web_contents = content::Source<WebContents>(source).ptr();
+ SyncedTabDelegate* tab =
+ TabContentsSyncedTabDelegate::FromWebContents(web_contents);
if (!tab || tab->profile() != profile_) {
return;
}
@@ -123,12 +120,9 @@ void SessionChangeProcessor::Observe(
}
case content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME: {
- TabContents* tab_contents = TabContents::FromWebContents(
- content::Source<WebContents>(source).ptr());
- if (!tab_contents) {
- return;
- }
- SyncedTabDelegate* tab = tab_contents->synced_tab_delegate();
+ WebContents* web_contents = content::Source<WebContents>(source).ptr();
+ SyncedTabDelegate* tab =
+ TabContentsSyncedTabDelegate::FromWebContents(web_contents);
if (!tab || tab->profile() != profile_) {
return;
}
@@ -139,7 +133,8 @@ void SessionChangeProcessor::Observe(
case chrome::NOTIFICATION_TAB_CONTENTS_DESTROYED: {
TabContents* tab_contents = content::Source<TabContents>(source).ptr();
- SyncedTabDelegate* tab = tab_contents->synced_tab_delegate();
+ SyncedTabDelegate* tab = TabContentsSyncedTabDelegate::FromWebContents(
+ tab_contents->web_contents());
if (!tab || tab->profile() != profile_)
return;
modified_tabs.push_back(tab);
@@ -186,9 +181,9 @@ void SessionChangeProcessor::Observe(
return;
}
if (extension_tab_helper->extension_app()) {
- TabContents* tab_contents =
- TabContents::FromWebContents(extension_tab_helper->web_contents());
- modified_tabs.push_back(tab_contents->synced_tab_delegate());
+ SyncedTabDelegate* tab = TabContentsSyncedTabDelegate::FromWebContents(
+ extension_tab_helper->web_contents());
+ modified_tabs.push_back(tab);
}
DVLOG(1) << "Received TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED "
<< "for profile " << profile_;
« no previous file with comments | « no previous file | chrome/browser/sync/glue/synced_tab_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698