OLD | NEW |
| (Empty) |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_ANDROID_PREFERENCES_IMPORTANT_SITES_UTIL_H_ | |
6 #define CHROME_BROWSER_ANDROID_PREFERENCES_IMPORTANT_SITES_UTIL_H_ | |
7 | |
8 #include <string> | |
9 #include <vector> | |
10 | |
11 #include "base/macros.h" | |
12 #include "url/gurl.h" | |
13 | |
14 class Profile; | |
15 | |
16 class ImportantSitesUtil { | |
17 public: | |
18 struct ImportantDomainInfo { | |
19 std::string registerable_domain; | |
20 GURL example_origin; | |
21 double engagement_score = 0; | |
22 int32_t reason_bitfield = 0; | |
23 }; | |
24 | |
25 // This returns the top |<=max_results| important registrable domains. This | |
26 // uses site engagement and notifications to generate the list. |max_results| | |
27 // is assumed to be small. | |
28 // See net/base/registry_controlled_domains/registry_controlled_domain.h for | |
29 // more details on registrable domains and the current list of effective | |
30 // eTLDs. | |
31 static std::vector<ImportantDomainInfo> GetImportantRegisterableDomains( | |
32 Profile* profile, | |
33 size_t max_results); | |
34 | |
35 // Record the sites that the user chose to blacklist from clearing (in the | |
36 // Clear Browsing Dialog) and the sites they ignored. The blacklisted sites | |
37 // are NOT cleared as they are 'blacklisted' from the clear operation. | |
38 // This records metrics for blacklisted and ignored sites and removes any | |
39 // 'ignored' sites from our important sites list if they were ignored 3 times | |
40 // in a row. | |
41 static void RecordBlacklistedAndIgnoredImportantSites( | |
42 Profile* profile, | |
43 const std::vector<std::string>& blacklisted_sites, | |
44 const std::vector<int32_t>& blacklisted_sites_reason_bitfield, | |
45 const std::vector<std::string>& ignored_sites, | |
46 const std::vector<int32_t>& ignored_sites_reason_bitfield); | |
47 | |
48 // This marks the given origin as important for testing. | |
49 static void MarkOriginAsImportantForTesting(Profile* profile, | |
50 const GURL& origin); | |
51 | |
52 private: | |
53 DISALLOW_IMPLICIT_CONSTRUCTORS(ImportantSitesUtil); | |
54 }; | |
55 | |
56 #endif // CHROME_BROWSER_ANDROID_PREFERENCES_IMPORTANT_SITES_UTIL_H_ | |
OLD | NEW |