| 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 | 10 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 bool SortSessionsByRecency(const SyncedSession* s1, const SyncedSession* s2) { | 51 bool SortSessionsByRecency(const SyncedSession* s1, const SyncedSession* s2) { |
| 52 return s1->modified_time > s2->modified_time; | 52 return s1->modified_time > s2->modified_time; |
| 53 } | 53 } |
| 54 | 54 |
| 55 } // namepace | 55 } // namepace |
| 56 | 56 |
| 57 ForeignSessionHandler::ForeignSessionHandler() { | 57 ForeignSessionHandler::ForeignSessionHandler() { |
| 58 } | 58 } |
| 59 | 59 |
| 60 // static | 60 // static |
| 61 void ForeignSessionHandler::RegisterUserPrefs(PrefRegistrySyncable* registry) { | 61 void ForeignSessionHandler::RegisterUserPrefs( |
| 62 registry->RegisterDictionaryPref(prefs::kNtpCollapsedForeignSessions, | 62 user_prefs::PrefRegistrySyncable* registry) { |
| 63 PrefRegistrySyncable::UNSYNCABLE_PREF); | 63 registry->RegisterDictionaryPref( |
| 64 prefs::kNtpCollapsedForeignSessions, |
| 65 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 64 } | 66 } |
| 65 | 67 |
| 66 // static | 68 // static |
| 67 void ForeignSessionHandler::OpenForeignSessionTab( | 69 void ForeignSessionHandler::OpenForeignSessionTab( |
| 68 content::WebUI* web_ui, | 70 content::WebUI* web_ui, |
| 69 const std::string& session_string_value, | 71 const std::string& session_string_value, |
| 70 SessionID::id_type window_num, | 72 SessionID::id_type window_num, |
| 71 SessionID::id_type tab_id, | 73 SessionID::id_type tab_id, |
| 72 const WindowOpenDisposition& disposition) { | 74 const WindowOpenDisposition& disposition) { |
| 73 SessionModelAssociator* associator = GetModelAssociator(web_ui); | 75 SessionModelAssociator* associator = GetModelAssociator(web_ui); |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 dictionary->SetString("userVisibleTimestamp", | 405 dictionary->SetString("userVisibleTimestamp", |
| 404 last_synced < base::TimeDelta::FromMinutes(1) ? | 406 last_synced < base::TimeDelta::FromMinutes(1) ? |
| 405 l10n_util::GetStringUTF16(IDS_SYNC_TIME_JUST_NOW) : | 407 l10n_util::GetStringUTF16(IDS_SYNC_TIME_JUST_NOW) : |
| 406 TimeFormat::TimeElapsed(last_synced)); | 408 TimeFormat::TimeElapsed(last_synced)); |
| 407 dictionary->SetInteger("sessionId", window.window_id.id()); | 409 dictionary->SetInteger("sessionId", window.window_id.id()); |
| 408 dictionary->Set("tabs", tab_values.release()); | 410 dictionary->Set("tabs", tab_values.release()); |
| 409 return true; | 411 return true; |
| 410 } | 412 } |
| 411 | 413 |
| 412 } // namespace browser_sync | 414 } // namespace browser_sync |
| OLD | NEW |