Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1089)

Unified Diff: components/search_engines/template_url_data_util.cc

Issue 2498053002: Add field to monitor last visited time for each search engine (Closed)
Patch Set: Remove sync operations of last_visited field. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/search_engines/template_url_data_util.cc
diff --git a/components/search_engines/template_url_data_util.cc b/components/search_engines/template_url_data_util.cc
index 77ad25fd96a71e8695c6704659b1c318e1b62309..dc06c4ee58dd72d1e258c6deb72e9d056f00c8ad 100644
--- a/components/search_engines/template_url_data_util.cc
+++ b/components/search_engines/template_url_data_util.cc
@@ -67,8 +67,10 @@ std::unique_ptr<TemplateURLData> TemplateURLDataFromDictionary(
std::string date_created_str;
std::string last_modified_str;
+ std::string last_visited_str;
dict.GetString(DefaultSearchManager::kDateCreated, &date_created_str);
dict.GetString(DefaultSearchManager::kLastModified, &last_modified_str);
+ dict.GetString(DefaultSearchManager::kLastVisited, &last_visited_str);
int64_t date_created = 0;
if (base::StringToInt64(date_created_str, &date_created)) {
@@ -76,10 +78,15 @@ std::unique_ptr<TemplateURLData> TemplateURLDataFromDictionary(
}
int64_t last_modified = 0;
- if (base::StringToInt64(date_created_str, &last_modified)) {
+ if (base::StringToInt64(last_modified_str, &last_modified)) {
Peter Kasting 2016/12/01 07:38:24 Woah, this looks like it was a flat-out existing b
ltian 2016/12/01 10:02:58 Yeah, this is the reason caused the problem that t
result->last_modified = base::Time::FromInternalValue(last_modified);
}
+ int64_t last_visited = 0;
+ if (base::StringToInt64(last_visited_str, &last_visited)) {
Peter Kasting 2016/12/01 07:38:24 Nit: This file is inconsistent about whether it us
ltian 2016/12/01 10:02:58 Done.
+ result->last_visited = base::Time::FromInternalValue(last_visited);
+ }
+
dict.GetInteger(DefaultSearchManager::kUsageCount, &result->usage_count);
const base::ListValue* alternate_urls = nullptr;
@@ -147,6 +154,9 @@ std::unique_ptr<base::DictionaryValue> TemplateURLDataToDictionary(
url_dict->SetString(
DefaultSearchManager::kLastModified,
base::Int64ToString(data.last_modified.ToInternalValue()));
+ url_dict->SetString(
+ DefaultSearchManager::kLastVisited,
+ base::Int64ToString(data.last_visited.ToInternalValue()));
url_dict->SetInteger(DefaultSearchManager::kUsageCount, data.usage_count);
auto alternate_urls = base::MakeUnique<base::ListValue>();

Powered by Google App Engine
This is Rietveld 408576698