Index: components/search_engines/template_url_service.cc |
diff --git a/components/search_engines/template_url_service.cc b/components/search_engines/template_url_service.cc |
index 5efc50df69b55bdbf1e17f31fa4201d59d861d2d..6626074c08c161812f4628a7e778d63176e7bbb2 100644 |
--- a/components/search_engines/template_url_service.cc |
+++ b/components/search_engines/template_url_service.cc |
@@ -724,6 +724,13 @@ void TemplateURLService::RepairPrepopulatedSearchEngines() { |
} |
} |
+void TemplateURLService::UpdateTemplateURLVisitTime(TemplateURL* url) { |
+ TemplateURLData data(url->data()); |
+ data.last_visited = clock_->Now(); |
+ if(UpdateNoNotify(url, TemplateURL(data))) |
Peter Kasting
2016/11/21 03:35:08
Nit: There must be a space between "if" and "("; s
ltian
2016/11/28 22:08:02
Done.
|
+ NotifyObservers(); |
Peter Kasting
2016/11/21 03:35:08
Nit: There are at least a couple other places that
ltian
2016/11/28 22:08:02
There are only two places simply doing "if (Update
Peter Kasting
2016/11/28 22:20:24
Hmm, I see four, plus the one you're adding:
http
ltian
2016/11/30 00:22:18
Do you mean my update function also needs to call
Peter Kasting
2016/11/30 00:39:37
No. The caller would do that. Your function woul
Peter Kasting
2016/12/01 07:38:24
Note: This whole conversation was about the Update
|
+} |
+ |
void TemplateURLService::AddObserver(TemplateURLServiceObserver* observer) { |
model_observers_.AddObserver(observer); |
} |
@@ -1265,6 +1272,7 @@ syncer::SyncData TemplateURLService::CreateSyncDataFromTemplateURL( |
if (!turl.image_url_post_params().empty()) |
se_specifics->set_image_url_post_params(turl.image_url_post_params()); |
se_specifics->set_last_modified(turl.last_modified().ToInternalValue()); |
+ se_specifics->set_last_visited(turl.last_visited().ToInternalValue()); |
Peter Kasting
2016/11/21 03:35:08
I'm confused. I thought you weren't going to sync
ltian
2016/11/28 22:08:02
For sync part, there are operations for UPDATE and
Peter Kasting
2016/11/28 22:20:24
How would the app crash? Can you say more?
I am
ltian
2016/11/30 00:22:18
So for current code, the |last_visited| will be se
Peter Kasting
2016/11/30 00:39:37
I would leave it as whatever the default value pro
|
se_specifics->set_sync_guid(turl.sync_guid()); |
for (size_t i = 0; i < turl.alternate_urls().size(); ++i) |
se_specifics->add_alternate_urls(turl.alternate_urls()[i]); |
@@ -1338,6 +1346,11 @@ TemplateURLService::CreateTemplateURLFromTemplateURLAndSyncData( |
bool deduped = DeDupeEncodings(&data.input_encodings); |
data.date_created = base::Time::FromInternalValue(specifics.date_created()); |
data.last_modified = base::Time::FromInternalValue(specifics.last_modified()); |
+ // TODO(ltian): sync separtely for this field. |
+ // Now if existing_turl is existed, keep last_visited locally without sync. |
+ if(existing_turl == nullptr) { |
+ data.last_visited = base::Time::FromInternalValue(specifics.last_visited()); |
+ } |
data.prepopulate_id = specifics.prepopulate_id(); |
data.sync_guid = specifics.sync_guid(); |
data.alternate_urls.clear(); |