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/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 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
13 #include "base/i18n/time_formatting.h" | 13 #include "base/i18n/time_formatting.h" |
14 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
15 #include "base/prefs/pref_service.h" | 15 #include "base/prefs/pref_service.h" |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
273 new base::DictionaryValue()); | 273 new base::DictionaryValue()); |
274 if (SessionWindowToValue(*window, window_data.get())) | 274 if (SessionWindowToValue(*window, window_data.get())) |
275 window_list->Append(window_data.release()); | 275 window_list->Append(window_data.release()); |
276 } | 276 } |
277 | 277 |
278 session_data->Set("windows", window_list.release()); | 278 session_data->Set("windows", window_list.release()); |
279 session_list.Append(session_data.release()); | 279 session_list.Append(session_data.release()); |
280 } | 280 } |
281 } | 281 } |
282 base::FundamentalValue tab_sync_enabled(IsTabSyncEnabled()); | 282 base::FundamentalValue tab_sync_enabled(IsTabSyncEnabled()); |
283 web_ui()->CallJavascriptFunction("ntp.setForeignSessions", | 283 web_ui()->CallJavascriptFunction("ntp.setForeignSessions", |
Evan Stade
2015/05/18 18:02:15
s/ntp/somethingelse
Dan Beam
2015/05/18 18:24:23
Done.
| |
284 session_list, | 284 session_list, |
285 tab_sync_enabled); | 285 tab_sync_enabled); |
286 } | 286 } |
287 | 287 |
288 void ForeignSessionHandler::HandleOpenForeignSession( | 288 void ForeignSessionHandler::HandleOpenForeignSession( |
289 const base::ListValue* args) { | 289 const base::ListValue* args) { |
290 size_t num_args = args->GetSize(); | 290 size_t num_args = args->GetSize(); |
291 // Expect either 1 or 8 args. For restoring an entire session, only | 291 // Expect either 1 or 8 args. For restoring an entire session, only |
292 // one argument is required -- the session tag. To restore a tab, | 292 // one argument is required -- the session tag. To restore a tab, |
293 // the additional args required are the window id, the tab id, | 293 // the additional args required are the window id, the tab id, |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
414 last_synced < base::TimeDelta::FromMinutes(1) ? | 414 last_synced < base::TimeDelta::FromMinutes(1) ? |
415 l10n_util::GetStringUTF16(IDS_SYNC_TIME_JUST_NOW) : | 415 l10n_util::GetStringUTF16(IDS_SYNC_TIME_JUST_NOW) : |
416 ui::TimeFormat::Simple(ui::TimeFormat::FORMAT_ELAPSED, | 416 ui::TimeFormat::Simple(ui::TimeFormat::FORMAT_ELAPSED, |
417 ui::TimeFormat::LENGTH_SHORT, last_synced)); | 417 ui::TimeFormat::LENGTH_SHORT, last_synced)); |
418 dictionary->SetInteger("sessionId", window.window_id.id()); | 418 dictionary->SetInteger("sessionId", window.window_id.id()); |
419 dictionary->Set("tabs", tab_values.release()); | 419 dictionary->Set("tabs", tab_values.release()); |
420 return true; | 420 return true; |
421 } | 421 } |
422 | 422 |
423 } // namespace browser_sync | 423 } // namespace browser_sync |
OLD | NEW |