| 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 |
| 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" |
| 16 #include "base/prefs/scoped_user_pref_update.h" | 16 #include "base/prefs/scoped_user_pref_update.h" |
| 17 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
| 18 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
| 19 #include "base/values.h" | 19 #include "base/values.h" |
| 20 #include "chrome/browser/chrome_notification_types.h" | 20 #include "chrome/browser/chrome_notification_types.h" |
| 21 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
| 22 #include "chrome/browser/sessions/session_restore.h" | 22 #include "chrome/browser/sessions/session_restore.h" |
| 23 #include "chrome/browser/sync/profile_sync_service.h" | 23 #include "chrome/browser/sync/profile_sync_service.h" |
| 24 #include "chrome/browser/sync/profile_sync_service_factory.h" | 24 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 25 #include "chrome/browser/ui/host_desktop.h" | 25 #include "chrome/browser/ui/host_desktop.h" |
| 26 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" | 26 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" |
| 27 #include "chrome/common/pref_names.h" | 27 #include "chrome/common/pref_names.h" |
| 28 #include "chrome/common/url_constants.h" | 28 #include "chrome/common/url_constants.h" |
| 29 #include "chrome/grit/generated_resources.h" |
| 29 #include "components/pref_registry/pref_registry_syncable.h" | 30 #include "components/pref_registry/pref_registry_syncable.h" |
| 30 #include "content/public/browser/notification_service.h" | 31 #include "content/public/browser/notification_service.h" |
| 31 #include "content/public/browser/notification_source.h" | 32 #include "content/public/browser/notification_source.h" |
| 32 #include "content/public/browser/url_data_source.h" | 33 #include "content/public/browser/url_data_source.h" |
| 33 #include "content/public/browser/web_contents.h" | 34 #include "content/public/browser/web_contents.h" |
| 34 #include "content/public/browser/web_ui.h" | 35 #include "content/public/browser/web_ui.h" |
| 35 #include "grit/generated_resources.h" | |
| 36 #include "ui/base/l10n/l10n_util.h" | 36 #include "ui/base/l10n/l10n_util.h" |
| 37 #include "ui/base/l10n/time_format.h" | 37 #include "ui/base/l10n/time_format.h" |
| 38 #include "ui/base/webui/web_ui_util.h" | 38 #include "ui/base/webui/web_ui_util.h" |
| 39 | 39 |
| 40 namespace browser_sync { | 40 namespace browser_sync { |
| 41 | 41 |
| 42 // Maximum number of sessions we're going to display on the NTP | 42 // Maximum number of sessions we're going to display on the NTP |
| 43 static const size_t kMaxSessionsToShow = 10; | 43 static const size_t kMaxSessionsToShow = 10; |
| 44 | 44 |
| 45 namespace { | 45 namespace { |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 last_synced < base::TimeDelta::FromMinutes(1) ? | 409 last_synced < base::TimeDelta::FromMinutes(1) ? |
| 410 l10n_util::GetStringUTF16(IDS_SYNC_TIME_JUST_NOW) : | 410 l10n_util::GetStringUTF16(IDS_SYNC_TIME_JUST_NOW) : |
| 411 ui::TimeFormat::Simple(ui::TimeFormat::FORMAT_ELAPSED, | 411 ui::TimeFormat::Simple(ui::TimeFormat::FORMAT_ELAPSED, |
| 412 ui::TimeFormat::LENGTH_SHORT, last_synced)); | 412 ui::TimeFormat::LENGTH_SHORT, last_synced)); |
| 413 dictionary->SetInteger("sessionId", window.window_id.id()); | 413 dictionary->SetInteger("sessionId", window.window_id.id()); |
| 414 dictionary->Set("tabs", tab_values.release()); | 414 dictionary->Set("tabs", tab_values.release()); |
| 415 return true; | 415 return true; |
| 416 } | 416 } |
| 417 | 417 |
| 418 } // namespace browser_sync | 418 } // namespace browser_sync |
| OLD | NEW |