Commit 17031f42 authored by Marc Treib's avatar Marc Treib Committed by Commit Bot

Cleanup: remove components/browser_sync_strings.grdp

The strings in there were referenced in only two places:
1) ForeignSessionHandler (which powers chrome://history/syncedTabs) sent
   them to JS, but the JS side never used them.
2) about_sync_util.cc (which powers chrome://sync-internals) used them,
   but nothing else on chrome://sync-internals is localized, so it's
   better to just inline non-localized strings there.

Bug: none
Cq-Include-Trybots: luci.chromium.try:closure_compilation
Change-Id: Ide4a2efe563f57c9d0afaa51722dece0dac50d7e
Reviewed-on: https://chromium-review.googlesource.com/1118233Reviewed-by: default avatarcalamity <calamity@chromium.org>
Reviewed-by: default avatarSylvain Defresne <sdefresne@chromium.org>
Reviewed-by: default avatarMikel Astiz <mastiz@chromium.org>
Commit-Queue: Marc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#571896}
parent 0d89d1e8
...@@ -54,7 +54,6 @@ let ForeignSessionTab; ...@@ -54,7 +54,6 @@ let ForeignSessionTab;
* The type of the foreign session tab object. This definition is based on * The type of the foreign session tab object. This definition is based on
* chrome/browser/ui/webui/foreign_session_handler.cc: * chrome/browser/ui/webui/foreign_session_handler.cc:
* @typedef {{timestamp: number, * @typedef {{timestamp: number,
* userVisibleTimestamp: string,
* sessionId: number, * sessionId: number,
* tabs: Array<ForeignSessionTab>}} * tabs: Array<ForeignSessionTab>}}
*/ */
......
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
#include "content/public/browser/url_data_source.h" #include "content/public/browser/url_data_source.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h" #include "content/public/browser/web_ui.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/l10n/time_format.h" #include "ui/base/l10n/time_format.h"
#include "ui/base/webui/web_ui_util.h" #include "ui/base/webui/web_ui_util.h"
...@@ -111,15 +110,6 @@ std::unique_ptr<base::DictionaryValue> BuildWindowData( ...@@ -111,15 +110,6 @@ std::unique_ptr<base::DictionaryValue> BuildWindowData(
// Please update it whenever you add or remove any keys here. // Please update it whenever you add or remove any keys here.
dictionary->SetString("type", "window"); dictionary->SetString("type", "window");
dictionary->SetDouble("timestamp", modification_time.ToInternalValue()); dictionary->SetDouble("timestamp", modification_time.ToInternalValue());
const base::TimeDelta last_synced = base::Time::Now() - modification_time;
// If clock skew leads to a future time, or we last synced less than a minute
// ago, output "Just now".
dictionary->SetString(
"userVisibleTimestamp",
last_synced < base::TimeDelta::FromMinutes(1)
? l10n_util::GetStringUTF16(IDS_SYNC_TIME_JUST_NOW)
: ui::TimeFormat::Simple(ui::TimeFormat::FORMAT_ELAPSED,
ui::TimeFormat::LENGTH_SHORT, last_synced));
dictionary->SetInteger("sessionId", window_id.id()); dictionary->SetInteger("sessionId", window_id.id());
return dictionary; return dictionary;
......
...@@ -187,5 +187,5 @@ function createWindow(tabUrls) { ...@@ -187,5 +187,5 @@ function createWindow(tabUrls) {
return {sessionId: 456, timestamp: 0, title: tabUrl, url: tabUrl}; return {sessionId: 456, timestamp: 0, title: tabUrl, url: tabUrl};
}); });
return {tabs: tabs, sessionId: '123', userVisibleTimestamp: 'A while ago'}; return {tabs: tabs, sessionId: '123'};
} }
<?xml version="1.0" encoding="utf-8"?>
<grit-part>
<!-- Sync time strings -->
<message name="IDS_SYNC_TIME_NEVER" desc="Indicates that the first sync has never completed.">
Never
</message>
<message name="IDS_SYNC_TIME_JUST_NOW" desc="Indicates that a sync cycle just finished.">
Just now
</message>
</grit-part>
...@@ -186,7 +186,6 @@ ...@@ -186,7 +186,6 @@
<part file="autofill_strings.grdp" /> <part file="autofill_strings.grdp" />
<part file="bookmark_bar_strings.grdp" /> <part file="bookmark_bar_strings.grdp" />
<part file="bookmark_component_strings.grdp" /> <part file="bookmark_component_strings.grdp" />
<part file="browser_sync_strings.grdp" />
<part file="browsing_data_strings.grdp" /> <part file="browsing_data_strings.grdp" />
<part file="components_settings_strings.grdp" /> <part file="components_settings_strings.grdp" />
<part file="crash_strings.grdp" /> <part file="crash_strings.grdp" />
......
...@@ -8,11 +8,11 @@ ...@@ -8,11 +8,11 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "base/i18n/time_formatting.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/values.h" #include "base/values.h"
#include "components/strings/grit/components_strings.h"
#include "components/sync/driver/sync_service.h" #include "components/sync/driver/sync_service.h"
#include "components/sync/driver/sync_token_status.h" #include "components/sync/driver/sync_token_status.h"
#include "components/sync/engine/cycle/sync_cycle_snapshot.h" #include "components/sync/engine/cycle/sync_cycle_snapshot.h"
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
#include "components/sync/engine/sync_string_conversions.h" #include "components/sync/engine/sync_string_conversions.h"
#include "components/sync/model/time.h" #include "components/sync/model/time.h"
#include "components/sync/protocol/proto_enum_conversions.h" #include "components/sync/protocol/proto_enum_conversions.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/l10n/time_format.h"
#include "url/gurl.h" #include "url/gurl.h"
namespace syncer { namespace syncer {
...@@ -201,26 +199,31 @@ std::string GetVersionString(version_info::Channel channel) { ...@@ -201,26 +199,31 @@ std::string GetVersionString(version_info::Channel channel) {
} }
std::string GetTimeStr(base::Time time, const std::string& default_msg) { std::string GetTimeStr(base::Time time, const std::string& default_msg) {
std::string time_str;
if (time.is_null()) if (time.is_null())
time_str = default_msg; return default_msg;
else return GetTimeDebugString(time);
time_str = GetTimeDebugString(time); }
return time_str;
// Analogous to GetTimeDebugString from components/sync/base/time.h. Consider
// moving it there if more places need this.
std::string GetTimeDeltaDebugString(base::TimeDelta t) {
base::string16 result;
if (!base::TimeDurationFormat(t, base::DURATION_WIDTH_WIDE, &result)) {
return "Invalid TimeDelta?!";
}
return base::UTF16ToUTF8(result);
} }
std::string GetLastSyncedTimeString(base::Time last_synced_time) { std::string GetLastSyncedTimeString(base::Time last_synced_time) {
if (last_synced_time.is_null()) if (last_synced_time.is_null())
return l10n_util::GetStringUTF8(IDS_SYNC_TIME_NEVER); return "Never";
base::TimeDelta time_since_last_sync = base::Time::Now() - last_synced_time; base::TimeDelta time_since_last_sync = base::Time::Now() - last_synced_time;
if (time_since_last_sync < base::TimeDelta::FromMinutes(1)) if (time_since_last_sync < base::TimeDelta::FromMinutes(1))
return l10n_util::GetStringUTF8(IDS_SYNC_TIME_JUST_NOW); return "Just now";
return base::UTF16ToUTF8(ui::TimeFormat::Simple( return GetTimeDeltaDebugString(time_since_last_sync) + " ago";
ui::TimeFormat::FORMAT_ELAPSED, ui::TimeFormat::LENGTH_SHORT,
time_since_last_sync));
} }
std::string GetConnectionStatus(const SyncTokenStatus& status) { std::string GetConnectionStatus(const SyncTokenStatus& status) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment