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

Unified Diff: chrome/browser/ui/webui/ntp/foreign_session_handler.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: rebase 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
« no previous file with comments | « chrome/browser/ui/webui/ntp/foreign_session_handler.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/ntp/foreign_session_handler.cc
diff --git a/chrome/browser/ui/webui/ntp/foreign_session_handler.cc b/chrome/browser/ui/webui/ntp/foreign_session_handler.cc
index 21672924dc8c88c6dfca01b40dc02cc44e1205cc..9b151ed2f8c39a5694aaf405bbe05a44f710c441 100644
--- a/chrome/browser/ui/webui/ntp/foreign_session_handler.cc
+++ b/chrome/browser/ui/webui/ntp/foreign_session_handler.cc
@@ -71,14 +71,14 @@ void ForeignSessionHandler::OpenForeignSessionTab(
SessionID::id_type window_num,
SessionID::id_type tab_id,
const WindowOpenDisposition& disposition) {
- SessionModelAssociator* associator = GetModelAssociator(web_ui);
- if (!associator)
+ OpenTabsUIDelegate* open_tabs = GetOpenTabsUIDelegate(web_ui);
+ if (!open_tabs)
return;
// We don't actually care about |window_num|, this is just a sanity check.
DCHECK_LT(kInvalidId, window_num);
const SessionTab* tab;
- if (!associator->GetForeignTab(session_string_value, tab_id, &tab)) {
+ if (!open_tabs->GetForeignTab(session_string_value, tab_id, &tab)) {
LOG(ERROR) << "Failed to load foreign tab.";
return;
}
@@ -95,15 +95,15 @@ void ForeignSessionHandler::OpenForeignSessionWindows(
content::WebUI* web_ui,
const std::string& session_string_value,
SessionID::id_type window_num) {
- SessionModelAssociator* associator = GetModelAssociator(web_ui);
- if (!associator)
+ OpenTabsUIDelegate* open_tabs = GetOpenTabsUIDelegate(web_ui);
+ if (!open_tabs)
return;
std::vector<const SessionWindow*> windows;
// Note: we don't own the ForeignSessions themselves.
- if (!associator->GetForeignSession(session_string_value, &windows)) {
+ if (!open_tabs->GetForeignSession(session_string_value, &windows)) {
LOG(ERROR) << "ForeignSessionHandler failed to get session data from"
- "SessionModelAssociator.";
+ "OpenTabsUIDelegate.";
return;
}
std::vector<const SessionWindow*>::const_iterator iter_begin =
@@ -147,15 +147,15 @@ bool ForeignSessionHandler::SessionTabToValue(
}
// static
-SessionModelAssociator* ForeignSessionHandler::GetModelAssociator(
+OpenTabsUIDelegate* ForeignSessionHandler::GetOpenTabsUIDelegate(
content::WebUI* web_ui) {
Profile* profile = Profile::FromWebUI(web_ui);
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 service->GetSessionModelAssociator();
+ return service->GetOpenTabsUIDelegate();
return NULL;
}
@@ -226,11 +226,11 @@ string16 ForeignSessionHandler::FormatSessionTime(const base::Time& time) {
}
void ForeignSessionHandler::HandleGetForeignSessions(const ListValue* args) {
- SessionModelAssociator* associator = GetModelAssociator(web_ui());
+ OpenTabsUIDelegate* open_tabs = GetOpenTabsUIDelegate(web_ui());
std::vector<const SyncedSession*> sessions;
ListValue session_list;
- if (associator && associator->GetAllForeignSessions(&sessions)) {
+ if (open_tabs && open_tabs->GetAllForeignSessions(&sessions)) {
// Sort sessions from most recent to least recent.
std::sort(sessions.begin(), sessions.end(), SortSessionsByRecency);
@@ -339,9 +339,9 @@ void ForeignSessionHandler::HandleDeleteForeignSession(const ListValue* args) {
return;
}
- SessionModelAssociator* associator = GetModelAssociator(web_ui());
- if (associator)
- associator->DeleteForeignSession(session_tag);
+ OpenTabsUIDelegate* open_tabs = GetOpenTabsUIDelegate(web_ui());
+ if (open_tabs)
+ open_tabs->DeleteForeignSession(session_tag);
}
void ForeignSessionHandler::HandleSetForeignSessionCollapsed(
« no previous file with comments | « chrome/browser/ui/webui/ntp/foreign_session_handler.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698