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

Unified Diff: chrome/browser/ui/webui/browsing_history_handler.h

Issue 2464323004: Fix grouped history query range for months. (Closed)
Patch Set: 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: chrome/browser/ui/webui/browsing_history_handler.h
diff --git a/chrome/browser/ui/webui/browsing_history_handler.h b/chrome/browser/ui/webui/browsing_history_handler.h
index 2ad459a0d770fe49e45613b29868ee1d8fae8965..4b155b7310fa498a391532548372d4707d9e191c 100644
--- a/chrome/browser/ui/webui/browsing_history_handler.h
+++ b/chrome/browser/ui/webui/browsing_history_handler.h
@@ -17,6 +17,7 @@
#include "base/scoped_observer.h"
#include "base/strings/string16.h"
#include "base/task/cancelable_task_tracker.h"
+#include "base/time/clock.h"
#include "base/timer/timer.h"
#include "base/values.h"
#include "components/history/core/browser/history_service_observer.h"
@@ -66,10 +67,15 @@ class BrowsingHistoryHandler : public content::WebUIMessageHandler,
COMBINED_ENTRY
};
- HistoryEntry(EntryType type, const GURL& url, const base::string16& title,
- base::Time time, const std::string& client_id,
- bool is_search_result, const base::string16& snippet,
- bool blocked_visit);
+ HistoryEntry(EntryType type,
+ const GURL& url,
+ const base::string16& title,
+ base::Time time,
+ const std::string& client_id,
+ bool is_search_result,
+ const base::string16& snippet,
+ bool blocked_visit,
+ base::Clock* clock);
HistoryEntry();
HistoryEntry(const HistoryEntry& other);
virtual ~HistoryEntry();
@@ -113,6 +119,8 @@ class BrowsingHistoryHandler : public content::WebUIMessageHandler,
// Whether this entry was blocked when it was attempted.
bool blocked_visit;
+
+ base::Clock* clock;
Dan Beam 2016/11/10 03:31:34 can you note that this is a weak ref?
calamity 2016/11/10 07:16:27 Done.
};
BrowsingHistoryHandler();
@@ -149,7 +157,14 @@ class BrowsingHistoryHandler : public content::WebUIMessageHandler,
const history::QueryOptions& options,
history::QueryResults* results);
Dan Beam 2016/11/10 03:31:34 can you mention that this is basically just for te
calamity 2016/11/10 07:16:27 Done.
+ void set_clock(std::unique_ptr<base::Clock> clock) {
+ clock_ = std::move(clock);
+ }
+
private:
+ FRIEND_TEST_ALL_PREFIXES(BrowsingHistoryHandlerTest, SetQueryTimeInWeeks);
+ FRIEND_TEST_ALL_PREFIXES(BrowsingHistoryHandlerTest, SetQueryTimeInMonths);
+
// The range for which to return results:
// - ALLTIME: allows access to all the results in a paginated way.
// - WEEK: the last 7 days.
@@ -258,6 +273,9 @@ class BrowsingHistoryHandler : public content::WebUIMessageHandler,
// Whether there are other forms of browsing history on the history server.
bool has_other_forms_of_browsing_history_;
+ // The clock used to vend times.
+ std::unique_ptr<base::Clock> clock_;
+
base::WeakPtrFactory<BrowsingHistoryHandler> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(BrowsingHistoryHandler);

Powered by Google App Engine
This is Rietveld 408576698