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

Side by Side Diff: components/history/core/browser/visitsegment_database.h

Issue 1924773002: TopSites: filter out non-WebSafe URLs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@topsites_cleanup
Patch Set: add test Created 4 years, 7 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
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 COMPONENTS_HISTORY_CORE_BROWSER_VISITSEGMENT_DATABASE_H_ 5 #ifndef COMPONENTS_HISTORY_CORE_BROWSER_VISITSEGMENT_DATABASE_H_
6 #define COMPONENTS_HISTORY_CORE_BROWSER_VISITSEGMENT_DATABASE_H_ 6 #define COMPONENTS_HISTORY_CORE_BROWSER_VISITSEGMENT_DATABASE_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/callback.h"
sdefresne 2016/05/03 11:18:50 nit: I think you can include "base/callback_forwar
Marc Treib 2016/05/03 11:51:16 Done.
10 #include "base/macros.h" 11 #include "base/macros.h"
11 #include "components/history/core/browser/history_types.h" 12 #include "components/history/core/browser/history_types.h"
12 13
13 namespace sql { 14 namespace sql {
14 class Connection; 15 class Connection;
15 } 16 }
16 17
17 namespace history { 18 namespace history {
18 19
19 class PageUsageData; 20 class PageUsageData;
(...skipping 25 matching lines...) Expand all
45 46
46 // Create a segment for the provided URL ID with the given name. Returns the 47 // Create a segment for the provided URL ID with the given name. Returns the
47 // ID of the newly created segment, or 0 on failure. 48 // ID of the newly created segment, or 0 on failure.
48 SegmentID CreateSegment(URLID url_id, const std::string& segment_name); 49 SegmentID CreateSegment(URLID url_id, const std::string& segment_name);
49 50
50 // Increase the segment visit count by the provided amount. Return true on 51 // Increase the segment visit count by the provided amount. Return true on
51 // success. 52 // success.
52 bool IncreaseSegmentVisitCount(SegmentID segment_id, base::Time ts, 53 bool IncreaseSegmentVisitCount(SegmentID segment_id, base::Time ts,
53 int amount); 54 int amount);
54 55
55 // Computes the segment usage since |from_time|. 56 // Computes the segment usage since |from_time|. If |url_filter| is non-null,
57 // then only URLs for which it returns true will be included.
56 // Returns the highest-scored segments up to |max_result_count|. 58 // Returns the highest-scored segments up to |max_result_count|.
57 std::vector<std::unique_ptr<PageUsageData>> QuerySegmentUsage( 59 std::vector<std::unique_ptr<PageUsageData>> QuerySegmentUsage(
58 base::Time from_time, 60 base::Time from_time,
59 int max_result_count); 61 int max_result_count,
62 const base::Callback<bool(const GURL&)>& url_filter);
60 63
61 // Delete all the segment usage data which is older than the provided time 64 // Delete all the segment usage data which is older than the provided time
62 // stamp. 65 // stamp.
63 bool DeleteSegmentData(base::Time older_than); 66 bool DeleteSegmentData(base::Time older_than);
64 67
65 // Change the presentation id for the segment identified by |segment_id| 68 // Change the presentation id for the segment identified by |segment_id|
66 bool SetSegmentPresentationIndex(SegmentID segment_id, int index); 69 bool SetSegmentPresentationIndex(SegmentID segment_id, int index);
67 70
68 // Delete the segment currently using the provided url for representation. 71 // Delete the segment currently using the provided url for representation.
69 // This will also delete any associated segment usage data. 72 // This will also delete any associated segment usage data.
(...skipping 14 matching lines...) Expand all
84 // presentation table is removed entirely. 87 // presentation table is removed entirely.
85 bool MigratePresentationIndex(); 88 bool MigratePresentationIndex();
86 89
87 private: 90 private:
88 DISALLOW_COPY_AND_ASSIGN(VisitSegmentDatabase); 91 DISALLOW_COPY_AND_ASSIGN(VisitSegmentDatabase);
89 }; 92 };
90 93
91 } // namespace history 94 } // namespace history
92 95
93 #endif // COMPONENTS_HISTORY_CORE_BROWSER_VISITSEGMENT_DATABASE_H_ 96 #endif // COMPONENTS_HISTORY_CORE_BROWSER_VISITSEGMENT_DATABASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698