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

Unified Diff: chrome/browser/sync/sessions/sync_sessions_web_contents_router.cc

Issue 2824063002: [sync] Instantiate the platform appropriate SyncedTabDelegate (Closed)
Patch Set: Created 3 years, 8 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/sessions/sync_sessions_web_contents_router.cc
diff --git a/chrome/browser/sync/sessions/sync_sessions_web_contents_router.cc b/chrome/browser/sync/sessions/sync_sessions_web_contents_router.cc
index 16df901089b99aa068213e784987ea7a07725492..cc5ecea9384ddd638c5c96be25352ec1b5bd32e4 100644
--- a/chrome/browser/sync/sessions/sync_sessions_web_contents_router.cc
+++ b/chrome/browser/sync/sessions/sync_sessions_web_contents_router.cc
@@ -8,6 +8,8 @@
#include "chrome/browser/profiles/profile.h"
#if !defined(OS_ANDROID)
#include "chrome/browser/sync/sessions/browser_list_router_helper.h"
+#else
+#include "chrome/browser/android/tab_android.h"
#endif // !defined(OS_ANDROID)
#include "chrome/browser/ui/sync/tab_contents_synced_tab_delegate.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
@@ -16,6 +18,22 @@
namespace sync_sessions {
+namespace {
+
+SyncedTabDelegate* GetSyncedTabDelegateFromWebContents(
+ content::WebContents* web_contents) {
+#if defined(OS_ANDROID)
+ TabAndroid* tab = TabAndroid::FromWebContents(web_contents);
+ return tab ? tab->GetSyncedTabDelegate() : nullptr;
+#else
+ SyncedTabDelegate* delegate =
+ TabContentsSyncedTabDelegate::FromWebContents(web_contents);
+ return delegate;
+#endif
+}
+
+} // namespace
+
SyncSessionsWebContentsRouter::SyncSessionsWebContentsRouter(Profile* profile) {
history::HistoryService* history_service =
HistoryServiceFactory::GetForProfile(profile,
@@ -37,7 +55,7 @@ void SyncSessionsWebContentsRouter::NotifyTabModified(
content::WebContents* web_contents) {
if (handler_ && web_contents) {
SyncedTabDelegate* delegate =
- TabContentsSyncedTabDelegate::FromWebContents(web_contents);
+ GetSyncedTabDelegateFromWebContents(web_contents);
if (delegate)
handler_->OnLocalTabModified(delegate);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698