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

Side by Side Diff: chrome/browser/ui/webui/ntp/suggestions_source_top_sites.h

Issue 351053003: Port HistoryService::QueryFilteredURLs to CancelableRequestTracker (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_WEBUI_NTP_SUGGESTIONS_SOURCE_TOP_SITES_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_NTP_SUGGESTIONS_SOURCE_TOP_SITES_H_
6 #define CHROME_BROWSER_UI_WEBUI_NTP_SUGGESTIONS_SOURCE_TOP_SITES_H_ 6 #define CHROME_BROWSER_UI_WEBUI_NTP_SUGGESTIONS_SOURCE_TOP_SITES_H_
7 7
8 #include <deque> 8 #include <deque>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "chrome/browser/common/cancelable_request.h" 11 #include "base/task/cancelable_task_tracker.h"
12 #include "chrome/browser/history/history_types.h" 12 #include "chrome/browser/history/history_types.h"
13 #include "chrome/browser/history/visit_filter.h" 13 #include "chrome/browser/history/visit_filter.h"
14 #include "chrome/browser/ui/webui/ntp/suggestions_source.h" 14 #include "chrome/browser/ui/webui/ntp/suggestions_source.h"
15 15
16 class SuggestionsCombiner; 16 class SuggestionsCombiner;
17 class Profile; 17 class Profile;
18 18
19 namespace base { 19 namespace base {
20 class DictionaryValue; 20 class DictionaryValue;
21 } 21 }
22 22
23 // A SuggestionsSource that uses the local TopSites database to provide 23 // A SuggestionsSource that uses the local TopSites database to provide
24 // suggestions. 24 // suggestions.
25 class SuggestionsSourceTopSites : public SuggestionsSource { 25 class SuggestionsSourceTopSites : public SuggestionsSource {
26 public: 26 public:
27 SuggestionsSourceTopSites(); 27 SuggestionsSourceTopSites();
28 virtual ~SuggestionsSourceTopSites(); 28 virtual ~SuggestionsSourceTopSites();
29 29
30 protected: 30 protected:
31 // SuggestionsSource overrides: 31 // SuggestionsSource overrides:
32 virtual void SetDebug(bool enable) OVERRIDE; 32 virtual void SetDebug(bool enable) OVERRIDE;
33 virtual int GetWeight() OVERRIDE; 33 virtual int GetWeight() OVERRIDE;
34 virtual int GetItemCount() OVERRIDE; 34 virtual int GetItemCount() OVERRIDE;
35 virtual base::DictionaryValue* PopItem() OVERRIDE; 35 virtual base::DictionaryValue* PopItem() OVERRIDE;
36 virtual void FetchItems(Profile* profile) OVERRIDE; 36 virtual void FetchItems(Profile* profile) OVERRIDE;
37 virtual void SetCombiner(SuggestionsCombiner* combiner) OVERRIDE; 37 virtual void SetCombiner(SuggestionsCombiner* combiner) OVERRIDE;
38 38
39 void OnSuggestionsUrlsAvailable( 39 void OnSuggestionsUrlsAvailable(const history::FilteredURLList* data);
40 CancelableRequestProvider::Handle handle,
41 const history::FilteredURLList& data);
42 40
43 private: 41 private:
44 42
45 // Gets the sorting order from the command-line arguments. Defaults to 43 // Gets the sorting order from the command-line arguments. Defaults to
46 // |ORDER_BY_RECENCY| if there are no command-line argument specifying a 44 // |ORDER_BY_RECENCY| if there are no command-line argument specifying a
47 // sorting order. 45 // sorting order.
48 static history::VisitFilter::SortingOrder GetSortingOrder(); 46 static history::VisitFilter::SortingOrder GetSortingOrder();
49 47
50 // Gets the filter width from the command-line arguments. Defaults to one 48 // Gets the filter width from the command-line arguments. Defaults to one
51 // hour if there are no command-line argument setting the filter width. 49 // hour if there are no command-line argument setting the filter width.
52 static base::TimeDelta GetFilterWidth(); 50 static base::TimeDelta GetFilterWidth();
53 51
54 // Our combiner. 52 // Our combiner.
55 SuggestionsCombiner* combiner_; 53 SuggestionsCombiner* combiner_;
56 54
57 // Keep the results of the db query here. 55 // Keep the results of the db query here.
58 std::deque<base::DictionaryValue*> items_; 56 std::deque<base::DictionaryValue*> items_;
59 57
60 // Whether the source should provide additional debug information or not. 58 // Whether the source should provide additional debug information or not.
61 bool debug_; 59 bool debug_;
62 60
63 CancelableRequestConsumer history_consumer_; 61 base::CancelableTaskTracker history_tracker_;
64 62
65 DISALLOW_COPY_AND_ASSIGN(SuggestionsSourceTopSites); 63 DISALLOW_COPY_AND_ASSIGN(SuggestionsSourceTopSites);
66 }; 64 };
67 65
68 #endif // CHROME_BROWSER_UI_WEBUI_NTP_SUGGESTIONS_SOURCE_TOP_SITES_H_ 66 #endif // CHROME_BROWSER_UI_WEBUI_NTP_SUGGESTIONS_SOURCE_TOP_SITES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698