OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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_ENGAGEMENT_IMPORTANT_SITES_UTIL_H_ | 5 #ifndef CHROME_BROWSER_ENGAGEMENT_IMPORTANT_SITES_UTIL_H_ |
6 #define CHROME_BROWSER_ENGAGEMENT_IMPORTANT_SITES_UTIL_H_ | 6 #define CHROME_BROWSER_ENGAGEMENT_IMPORTANT_SITES_UTIL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "url/gurl.h" | 12 #include "url/gurl.h" |
13 | 13 |
14 class Profile; | 14 class Profile; |
15 | 15 |
16 namespace user_prefs { | 16 namespace user_prefs { |
17 class PrefRegistrySyncable; | 17 class PrefRegistrySyncable; |
18 } | 18 } |
19 | 19 |
20 class ImportantSitesUtil { | 20 class ImportantSitesUtil { |
21 public: | 21 public: |
22 struct ImportantDomainInfo { | 22 struct ImportantDomainInfo { |
23 std::string registerable_domain; | 23 std::string registerable_domain; |
24 GURL example_origin; | 24 GURL example_origin; |
25 double engagement_score = 0; | 25 double engagement_score = 0; |
26 int32_t reason_bitfield = 0; | 26 int32_t reason_bitfield = 0; |
27 }; | 27 }; |
28 | 28 |
| 29 // Do not change the values here, as they are used for UMA histograms. |
| 30 enum ImportantReason { |
| 31 ENGAGEMENT = 0, |
| 32 DURABLE = 1, |
| 33 BOOKMARKS = 2, |
| 34 HOME_SCREEN = 3, |
| 35 NOTIFICATIONS = 4, |
| 36 REASON_BOUNDARY |
| 37 }; |
| 38 |
29 static bool IsDialogDisabled(Profile* profile); | 39 static bool IsDialogDisabled(Profile* profile); |
30 | 40 |
31 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 41 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
32 | 42 |
33 // This returns the top |<=max_results| important registrable domains. This | 43 // This returns the top |<=max_results| important registrable domains. This |
34 // uses site engagement and notifications to generate the list. |max_results| | 44 // uses site engagement and notifications to generate the list. |max_results| |
35 // is assumed to be small. | 45 // is assumed to be small. |
36 // See net/base/registry_controlled_domains/registry_controlled_domain.h for | 46 // See net/base/registry_controlled_domains/registry_controlled_domain.h for |
37 // more details on registrable domains and the current list of effective | 47 // more details on registrable domains and the current list of effective |
38 // eTLDs. | 48 // eTLDs. |
(...skipping 18 matching lines...) Expand all Loading... |
57 // the score requirements for the Site Engagement Service, so ONLY call for | 67 // the score requirements for the Site Engagement Service, so ONLY call for |
58 // testing. | 68 // testing. |
59 static void MarkOriginAsImportantForTesting(Profile* profile, | 69 static void MarkOriginAsImportantForTesting(Profile* profile, |
60 const GURL& origin); | 70 const GURL& origin); |
61 | 71 |
62 private: | 72 private: |
63 DISALLOW_IMPLICIT_CONSTRUCTORS(ImportantSitesUtil); | 73 DISALLOW_IMPLICIT_CONSTRUCTORS(ImportantSitesUtil); |
64 }; | 74 }; |
65 | 75 |
66 #endif // CHROME_BROWSER_ENGAGEMENT_IMPORTANT_SITES_UTIL_H_ | 76 #endif // CHROME_BROWSER_ENGAGEMENT_IMPORTANT_SITES_UTIL_H_ |
OLD | NEW |