OLD | NEW |
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 bool SortSessionsByRecency(const SyncedSession* s1, const SyncedSession* s2) { | 49 bool SortSessionsByRecency(const SyncedSession* s1, const SyncedSession* s2) { |
50 return s1->modified_time > s2->modified_time; | 50 return s1->modified_time > s2->modified_time; |
51 } | 51 } |
52 | 52 |
53 } // namepace | 53 } // namepace |
54 | 54 |
55 ForeignSessionHandler::ForeignSessionHandler() { | 55 ForeignSessionHandler::ForeignSessionHandler() { |
56 } | 56 } |
57 | 57 |
58 // static | 58 // static |
59 void ForeignSessionHandler::RegisterUserPrefs(PrefService* prefs) { | 59 void ForeignSessionHandler::RegisterUserPrefs(PrefServiceSyncable* prefs) { |
60 prefs->RegisterDictionaryPref(prefs::kNtpCollapsedForeignSessions, | 60 prefs->RegisterDictionaryPref(prefs::kNtpCollapsedForeignSessions, |
61 PrefService::UNSYNCABLE_PREF); | 61 PrefServiceSyncable::UNSYNCABLE_PREF); |
62 } | 62 } |
63 | 63 |
64 // static | 64 // static |
65 void ForeignSessionHandler::OpenForeignSessionTab( | 65 void ForeignSessionHandler::OpenForeignSessionTab( |
66 content::WebUI* web_ui, | 66 content::WebUI* web_ui, |
67 const std::string& session_string_value, | 67 const std::string& session_string_value, |
68 SessionID::id_type window_num, | 68 SessionID::id_type window_num, |
69 SessionID::id_type tab_id, | 69 SessionID::id_type tab_id, |
70 const WindowOpenDisposition& disposition) { | 70 const WindowOpenDisposition& disposition) { |
71 SessionModelAssociator* associator = GetModelAssociator(web_ui); | 71 SessionModelAssociator* associator = GetModelAssociator(web_ui); |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 dictionary->SetString("userVisibleTimestamp", | 429 dictionary->SetString("userVisibleTimestamp", |
430 last_synced < base::TimeDelta::FromMinutes(1) ? | 430 last_synced < base::TimeDelta::FromMinutes(1) ? |
431 l10n_util::GetStringUTF16(IDS_SYNC_TIME_JUST_NOW) : | 431 l10n_util::GetStringUTF16(IDS_SYNC_TIME_JUST_NOW) : |
432 TimeFormat::TimeElapsed(last_synced)); | 432 TimeFormat::TimeElapsed(last_synced)); |
433 dictionary->SetInteger("sessionId", window.window_id.id()); | 433 dictionary->SetInteger("sessionId", window.window_id.id()); |
434 dictionary->Set("tabs", tab_values.release()); | 434 dictionary->Set("tabs", tab_values.release()); |
435 return true; | 435 return true; |
436 } | 436 } |
437 | 437 |
438 } // namespace browser_sync | 438 } // namespace browser_sync |
OLD | NEW |