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

Unified Diff: components/history/core/browser/web_history_service.cc

Issue 2621143004: Fix the end time bound in WebHistoryService to match the API (Closed)
Patch Set: Addressed comments. Created 3 years, 11 months 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/history/core/browser/web_history_service.cc
diff --git a/components/history/core/browser/web_history_service.cc b/components/history/core/browser/web_history_service.cc
index c74348c04e7640aedadaaab46623015dddf5b4d3..e90d3b884e4f452b39c1a37daa4231c09bd5b34c 100644
--- a/components/history/core/browser/web_history_service.cc
+++ b/components/history/core/browser/web_history_service.cc
@@ -275,11 +275,15 @@ GURL GetQueryUrl(const base::string16& text_query,
url = net::AppendQueryParameter(url, "titles", "1");
// Take |begin_time|, |end_time|, and |max_count| from the original query
- // options, and convert them to the equivalent URL parameters.
+ // options, and convert them to the equivalent URL parameters. Note that
+ // QueryOptions uses exclusive |end_time| while the history.google.com API
+ // uses it inclusively, so we subtract 1us during conversion.
base::Time end_time =
- std::min(base::Time::FromInternalValue(options.EffectiveEndTime()),
- base::Time::Now());
+ options.end_time.is_null()
+ ? base::Time::Now()
+ : std::min(options.end_time - base::TimeDelta::FromMicroseconds(1),
+ base::Time::Now());
url = net::AppendQueryParameter(url, "max", ServerTimeString(end_time));
if (!options.begin_time.is_null()) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698