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

Unified Diff: chrome/browser/ui/android/tab_model/tab_model.cc

Issue 15055003: Do not submit: high level overview patch. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix build. Created 7 years, 7 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/android/tab_model/tab_model.cc
diff --git a/chrome/browser/ui/android/tab_model/tab_model.cc b/chrome/browser/ui/android/tab_model/tab_model.cc
index 9ecf3722826323e598d2d3b35a94519b198c3d51..ba3591bc484bdf751d15420232674da7a440e8dc 100644
--- a/chrome/browser/ui/android/tab_model/tab_model.cc
+++ b/chrome/browser/ui/android/tab_model/tab_model.cc
@@ -8,12 +8,15 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search_engines/search_terms_data.h"
+#include "chrome/browser/sync/glue/synced_tab_delegate.h"
#include "chrome/browser/sync/glue/synced_window_delegate_android.h"
#include "chrome/browser/ui/toolbar/toolbar_model_impl.h"
#include "chrome/common/chrome_notification_types.h"
#include "content/public/browser/notification_service.h"
using content::NotificationService;
+using browser_sync::SyncedTabDelegate;
+using browser_sync::SyncedWindowDelegate;
TabModel::TabModel(Profile* profile)
: profile_(profile),
@@ -36,6 +39,9 @@ TabModel::TabModel(Profile* profile)
content::Source<Profile>(profile_));
registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CREATED,
content::NotificationService::AllSources());
+ registrar_.Add(this,
+ chrome::NOTIFICATION_SESSION_SYNC_ID_GENERATED,
+ content::NotificationService::AllSources());
} else {
is_off_the_record_ = false;
}
@@ -130,6 +136,24 @@ void TabModel::Observe(
profile_ = profile;
}
break;
+ case chrome::NOTIFICATION_SESSION_SYNC_ID_GENERATED: {
+ content::Details<const SyncedTabDelegate> tab(details);
+ const SyncedWindowDelegate* sync_window_delegate =
+ SyncedWindowDelegate::FindSyncedWindowDelegateWithId(
+ tab->GetWindowId().id());
+ if (sync_window_delegate) {
+ const int tab_count = sync_window_delegate->GetTabCount();
+ for (int i = 0; i < tab_count; ++i) {
+ SyncedTabDelegate* sync_tab = sync_window_delegate->GetTabAt(i);
+ // This may seem redundant, but it ensure Sync id is set in java.
+ if (sync_tab && sync_tab->IsTabInMemory() &&
+ sync_tab->GetSyncSessionId() == tab->GetSyncSessionId()) {
+ sync_tab->SetSyncSessionId(tab->GetSyncSessionId());
+ break;
+ }
+ }
+ }
+ } break;
default:
NOTREACHED();
}

Powered by Google App Engine
This is Rietveld 408576698