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

Side by Side Diff: chrome/browser/ui/webui/ntp/foreign_session_handler.cc

Issue 10696087: [Sync] Move ModelType and related classes to 'syncer' namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix indent, and remove some redundant using declarations Created 8 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/webui/ntp/foreign_session_handler.h" 5 #include "chrome/browser/ui/webui/ntp/foreign_session_handler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 if (service && service->ShouldPushChanges()) 120 if (service && service->ShouldPushChanges())
121 return service->GetSessionModelAssociator(); 121 return service->GetSessionModelAssociator();
122 122
123 return NULL; 123 return NULL;
124 } 124 }
125 125
126 bool ForeignSessionHandler::IsTabSyncEnabled() { 126 bool ForeignSessionHandler::IsTabSyncEnabled() {
127 Profile* profile = Profile::FromWebUI(web_ui()); 127 Profile* profile = Profile::FromWebUI(web_ui());
128 ProfileSyncService* service = 128 ProfileSyncService* service =
129 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile); 129 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile);
130 return service && service->GetPreferredDataTypes().Has(syncable::SESSIONS); 130 return service && service->GetPreferredDataTypes().Has(syncer::SESSIONS);
131 } 131 }
132 132
133 string16 ForeignSessionHandler::FormatSessionTime(const base::Time& time) { 133 string16 ForeignSessionHandler::FormatSessionTime(const base::Time& time) {
134 // Return a time like "1 hour ago", "2 days ago", etc. 134 // Return a time like "1 hour ago", "2 days ago", etc.
135 return TimeFormat::TimeElapsed(base::Time::Now() - time); 135 return TimeFormat::TimeElapsed(base::Time::Now() - time);
136 } 136 }
137 137
138 void ForeignSessionHandler::HandleGetForeignSessions(const ListValue* args) { 138 void ForeignSessionHandler::HandleGetForeignSessions(const ListValue* args) {
139 SessionModelAssociator* associator = GetModelAssociator(); 139 SessionModelAssociator* associator = GetModelAssociator();
140 std::vector<const SyncedSession*> sessions; 140 std::vector<const SyncedSession*> sessions;
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 dictionary->SetString("userVisibleTimestamp", 343 dictionary->SetString("userVisibleTimestamp",
344 last_synced < base::TimeDelta::FromMinutes(1) ? 344 last_synced < base::TimeDelta::FromMinutes(1) ?
345 l10n_util::GetStringUTF16(IDS_SYNC_TIME_JUST_NOW) : 345 l10n_util::GetStringUTF16(IDS_SYNC_TIME_JUST_NOW) :
346 TimeFormat::TimeElapsed(last_synced)); 346 TimeFormat::TimeElapsed(last_synced));
347 dictionary->SetInteger("sessionId", window.window_id.id()); 347 dictionary->SetInteger("sessionId", window.window_id.id());
348 dictionary->Set("tabs", tab_values.release()); 348 dictionary->Set("tabs", tab_values.release());
349 return true; 349 return true;
350 } 350 }
351 351
352 } // namespace browser_sync 352 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698