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

Unified Diff: chrome/browser/android/foreign_session_helper.cc

Issue 74653002: sync: Add --enable-sync-sessions-v2 and necessary plumbing to use SessionsSyncManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup components factory Created 7 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/android/foreign_session_helper.cc
diff --git a/chrome/browser/android/foreign_session_helper.cc b/chrome/browser/android/foreign_session_helper.cc
index 58a46759c461a3bd14e4c85c498af3c61311e520..4180aa6ebf3d9477d9b5a5e32a61b80535d02773 100644
--- a/chrome/browser/android/foreign_session_helper.cc
+++ b/chrome/browser/android/foreign_session_helper.cc
@@ -13,7 +13,7 @@
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/profiles/profile_android.h"
#include "chrome/browser/sessions/session_restore.h"
-#include "chrome/browser/sync/glue/session_model_associator.h"
+#include "chrome/browser/sync/open_tabs_ui_delegate.h"
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/browser/ui/android/tab_model/tab_model.h"
@@ -30,20 +30,20 @@ using base::android::AttachCurrentThread;
using base::android::ConvertUTF16ToJavaString;
using base::android::ConvertUTF8ToJavaString;
using base::android::ConvertJavaStringToUTF8;
-using browser_sync::SessionModelAssociator;
+using browser_sync::OpenTabsUIDelegate;
using browser_sync::SyncedSession;
namespace {
-SessionModelAssociator* GetSessionModelAssociator(Profile* profile) {
+OpenTabsUIDelegate* GetOpenTabsUIDelegate(Profile* profile) {
ProfileSyncService* service = ProfileSyncServiceFactory::GetInstance()->
GetForProfile(profile);
- // Only return the associator if it exists and it is done syncing sessions.
+ // Only return the delegate if it exists and it is done syncing sessions.
if (!service || !service->ShouldPushChanges())
return NULL;
- return service->GetSessionModelAssociator();
+ return service->GetOpenTabsUIDelegate();
}
bool ShouldSkipTab(const SessionTab& session_tab) {
@@ -200,12 +200,12 @@ void ForeignSessionHelper::Observe(
jboolean ForeignSessionHelper::GetForeignSessions(JNIEnv* env,
jobject obj,
jobject result) {
- SessionModelAssociator* associator = GetSessionModelAssociator(profile_);
- if (!associator)
+ OpenTabsUIDelegate* open_tabs = GetOpenTabsUIDelegate(profile_);
+ if (!open_tabs)
return false;
std::vector<const browser_sync::SyncedSession*> sessions;
- if (!associator->GetAllForeignSessions(&sessions))
+ if (!open_tabs->GetAllForeignSessions(&sessions))
return false;
// Use a pref to keep track of sessions that were collapsed by the user.
@@ -253,16 +253,16 @@ jboolean ForeignSessionHelper::OpenForeignSessionTabOld(JNIEnv* env,
jobject obj,
jstring session_tag,
jint session_tab_id) {
- SessionModelAssociator* associator = GetSessionModelAssociator(profile_);
- if (!associator) {
- LOG(ERROR) << "Null SessionModelAssociator returned.";
+ OpenTabsUIDelegate* open_tabs = GetOpenTabsUIDelegate(profile_);
+ if (!open_tabs) {
+ LOG(ERROR) << "Null OpenTabsUIDelegate returned.";
return false;
}
const SessionTab* session_tab;
- if (!associator->GetForeignTab(ConvertJavaStringToUTF8(env, session_tag),
- session_tab_id, &session_tab)) {
+ if (!open_tabs->GetForeignTab(ConvertJavaStringToUTF8(env, session_tag),
+ session_tab_id, &session_tab)) {
LOG(ERROR) << "Failed to load foreign tab.";
return false;
}
@@ -298,17 +298,17 @@ jboolean ForeignSessionHelper::OpenForeignSessionTab(JNIEnv* env,
jstring session_tag,
jint session_tab_id,
jint j_disposition) {
- SessionModelAssociator* associator = GetSessionModelAssociator(profile_);
- if (!associator) {
- LOG(ERROR) << "Null SessionModelAssociator returned.";
+ OpenTabsUIDelegate* open_tabs = GetOpenTabsUIDelegate(profile_);
+ if (!open_tabs) {
+ LOG(ERROR) << "Null OpenTabsUIDelegate returned.";
return false;
}
const SessionTab* session_tab;
- if (!associator->GetForeignTab(ConvertJavaStringToUTF8(env, session_tag),
- session_tab_id,
- &session_tab)) {
+ if (!open_tabs->GetForeignTab(ConvertJavaStringToUTF8(env, session_tag),
+ session_tab_id,
+ &session_tab)) {
LOG(ERROR) << "Failed to load foreign tab.";
return false;
}
@@ -336,9 +336,9 @@ jboolean ForeignSessionHelper::OpenForeignSessionTab(JNIEnv* env,
void ForeignSessionHelper::DeleteForeignSession(JNIEnv* env, jobject obj,
jstring session_tag) {
- SessionModelAssociator* associator = GetSessionModelAssociator(profile_);
- if (associator)
- associator->DeleteForeignSession(ConvertJavaStringToUTF8(env, session_tag));
+ OpenTabsUIDelegate* open_tabs = GetOpenTabsUIDelegate(profile_);
+ if (open_tabs)
+ open_tabs->DeleteForeignSession(ConvertJavaStringToUTF8(env, session_tag));
}
// static

Powered by Google App Engine
This is Rietveld 408576698