Index: components/suggestions/suggestions_service.cc |
diff --git a/components/suggestions/suggestions_service.cc b/components/suggestions/suggestions_service.cc |
index 181a3d8c8c1865239df5419da5fb104e94db52ea..e9b7906a8241c3c5264579a22a82bd343c66ccfc 100644 |
--- a/components/suggestions/suggestions_service.cc |
+++ b/components/suggestions/suggestions_service.cc |
@@ -304,7 +304,7 @@ void SuggestionsService::OnURLFetchComplete(const net::URLFetcher* source) { |
bool success = request->GetResponseAsString(&suggestions_data); |
DCHECK(success); |
- // Compute suggestions, and dispatch then to requestors. On error still |
+ // Compute suggestions, and dispatch them to requestors. On error still |
// dispatch empty suggestions. |
SuggestionsProfile suggestions; |
if (suggestions_data.empty()) { |
@@ -313,6 +313,11 @@ void SuggestionsService::OnURLFetchComplete(const net::URLFetcher* source) { |
} else if (suggestions.ParseFromString(suggestions_data)) { |
LogResponseState(RESPONSE_VALID); |
thumbnail_manager_->Initialize(suggestions); |
+ |
+ int64 now_usec = (base::Time::NowFromSystemTime() - base::Time::UnixEpoch()) |
+ .ToInternalValue(); |
+ int64 timestamp_usec = now_usec + default_expiry_usec; |
+ SetDefaultExpiryTimestamps(&suggestions, timestamp_usec); |
suggestions_store_->StoreSuggestions(suggestions); |
} else { |
LogResponseState(RESPONSE_INVALID); |
@@ -323,6 +328,18 @@ void SuggestionsService::OnURLFetchComplete(const net::URLFetcher* source) { |
ScheduleBlacklistUpload(true); |
} |
Mathieu
2014/08/04 14:39:10
remove extra new line
gayane -on leave until 09-2017
2014/08/04 16:34:57
Done.
|
+ |
+void SuggestionsService::SetDefaultExpiryTimestamps( |
+ SuggestionsProfile* suggestions, int64 default_timestamp_usec) { |
+ |
Mathieu
2014/08/04 14:39:10
remove extra line
gayane -on leave until 09-2017
2014/08/04 16:34:57
Done.
|
+ for (int i = 0; i < suggestions->suggestions_size(); ++i) { |
+ ChromeSuggestion* suggestion = suggestions->mutable_suggestions(i); |
+ if (!suggestion->has_expiry_ts()){ |
+ suggestion->set_expiry_ts(default_timestamp_usec); |
Mathieu
2014/08/04 14:39:10
indent 2 less
gayane -on leave until 09-2017
2014/08/04 16:34:57
Done.
|
+ } |
+ } |
+} |
+ |
void SuggestionsService::Shutdown() { |
// Cancel pending request and timeout closure, then serve existing requestors |
// from cache. |