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

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

Issue 16105012: Unrevert "[Sync] Split GetPreferredTypes into GetActiveType..."" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adjust mock Created 7 years, 6 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 10
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 default: 211 default:
212 NOTREACHED(); 212 NOTREACHED();
213 } 213 }
214 } 214 }
215 215
216 216
217 bool ForeignSessionHandler::IsTabSyncEnabled() { 217 bool ForeignSessionHandler::IsTabSyncEnabled() {
218 Profile* profile = Profile::FromWebUI(web_ui()); 218 Profile* profile = Profile::FromWebUI(web_ui());
219 ProfileSyncService* service = 219 ProfileSyncService* service =
220 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile); 220 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile);
221 return service && service->GetPreferredDataTypes().Has(syncer::PROXY_TABS); 221 return service && service->GetActiveDataTypes().Has(syncer::PROXY_TABS);
222 } 222 }
223 223
224 string16 ForeignSessionHandler::FormatSessionTime(const base::Time& time) { 224 string16 ForeignSessionHandler::FormatSessionTime(const base::Time& time) {
225 // Return a time like "1 hour ago", "2 days ago", etc. 225 // Return a time like "1 hour ago", "2 days ago", etc.
226 base::Time now = base::Time::Now(); 226 base::Time now = base::Time::Now();
227 // TimeElapsed does not support negative TimeDelta values, so then we use 0. 227 // TimeElapsed does not support negative TimeDelta values, so then we use 0.
228 return TimeFormat::TimeElapsed(now < time ? base::TimeDelta() : now - time); 228 return TimeFormat::TimeElapsed(now < time ? base::TimeDelta() : now - time);
229 } 229 }
230 230
231 void ForeignSessionHandler::HandleGetForeignSessions(const ListValue* args) { 231 void ForeignSessionHandler::HandleGetForeignSessions(const ListValue* args) {
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 dictionary->SetString("userVisibleTimestamp", 405 dictionary->SetString("userVisibleTimestamp",
406 last_synced < base::TimeDelta::FromMinutes(1) ? 406 last_synced < base::TimeDelta::FromMinutes(1) ?
407 l10n_util::GetStringUTF16(IDS_SYNC_TIME_JUST_NOW) : 407 l10n_util::GetStringUTF16(IDS_SYNC_TIME_JUST_NOW) :
408 TimeFormat::TimeElapsed(last_synced)); 408 TimeFormat::TimeElapsed(last_synced));
409 dictionary->SetInteger("sessionId", window.window_id.id()); 409 dictionary->SetInteger("sessionId", window.window_id.id());
410 dictionary->Set("tabs", tab_values.release()); 410 dictionary->Set("tabs", tab_values.release());
411 return true; 411 return true;
412 } 412 }
413 413
414 } // namespace browser_sync 414 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync_file_system/sync_file_system_service.cc ('k') | chrome/browser/ui/webui/sync_setup_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698