OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_SITE_ENGAGEMENT_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_SERVICE_H_ |
6 #define CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_SERVICE_H_ | 6 #define CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_SERVICE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 bool UpdateScoreDict(base::DictionaryValue* score_dict); | 132 bool UpdateScoreDict(base::DictionaryValue* score_dict); |
133 | 133 |
134 private: | 134 private: |
135 FRIEND_TEST_ALL_PREFIXES(SiteEngagementScoreTest, PartiallyEmptyDictionary); | 135 FRIEND_TEST_ALL_PREFIXES(SiteEngagementScoreTest, PartiallyEmptyDictionary); |
136 FRIEND_TEST_ALL_PREFIXES(SiteEngagementScoreTest, PopulatedDictionary); | 136 FRIEND_TEST_ALL_PREFIXES(SiteEngagementScoreTest, PopulatedDictionary); |
137 FRIEND_TEST_ALL_PREFIXES(SiteEngagementScoreTest, Reset); | 137 FRIEND_TEST_ALL_PREFIXES(SiteEngagementScoreTest, Reset); |
138 FRIEND_TEST_ALL_PREFIXES(SiteEngagementScoreTest, FirstDailyEngagementBonus); | 138 FRIEND_TEST_ALL_PREFIXES(SiteEngagementScoreTest, FirstDailyEngagementBonus); |
139 friend class SiteEngagementHelperTest; | 139 friend class SiteEngagementHelperTest; |
140 friend class SiteEngagementScoreTest; | 140 friend class SiteEngagementScoreTest; |
141 friend class SiteEngagementServiceTest; | 141 friend class SiteEngagementServiceTest; |
| 142 friend class ImportantSitesUtilTest; |
142 | 143 |
143 // Array holding the values corresponding to each item in Variation array. | 144 // Array holding the values corresponding to each item in Variation array. |
144 static double param_values[]; | 145 static double param_values[]; |
145 | 146 |
146 // Keys used in the content settings dictionary. | 147 // Keys used in the content settings dictionary. |
147 static const char* kRawScoreKey; | 148 static const char* kRawScoreKey; |
148 static const char* kPointsAddedTodayKey; | 149 static const char* kPointsAddedTodayKey; |
149 static const char* kLastEngagementTimeKey; | 150 static const char* kLastEngagementTimeKey; |
150 static const char* kLastShortcutLaunchTimeKey; | 151 static const char* kLastShortcutLaunchTimeKey; |
151 | 152 |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, GetMedianEngagement); | 282 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, GetMedianEngagement); |
282 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, GetTotalNavigationPoints); | 283 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, GetTotalNavigationPoints); |
283 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, GetTotalUserInputPoints); | 284 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, GetTotalUserInputPoints); |
284 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, LastShortcutLaunch); | 285 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, LastShortcutLaunch); |
285 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, | 286 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, |
286 CleanupOriginsOnHistoryDeletion); | 287 CleanupOriginsOnHistoryDeletion); |
287 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, IsBootstrapped); | 288 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, IsBootstrapped); |
288 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, EngagementLevel); | 289 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, EngagementLevel); |
289 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, ScoreDecayHistograms); | 290 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, ScoreDecayHistograms); |
290 FRIEND_TEST_ALL_PREFIXES(AppBannerSettingsHelperTest, SiteEngagementTrigger); | 291 FRIEND_TEST_ALL_PREFIXES(AppBannerSettingsHelperTest, SiteEngagementTrigger); |
| 292 FRIEND_TEST_ALL_PREFIXES(ImportantSitesUtilTest, NotificationsThenEngagement); |
291 | 293 |
292 // Only used in tests. | 294 // Only used in tests. |
293 SiteEngagementService(Profile* profile, std::unique_ptr<base::Clock> clock); | 295 SiteEngagementService(Profile* profile, std::unique_ptr<base::Clock> clock); |
294 | 296 |
295 // Adds the specified number of points to the given origin, respecting the | 297 // Adds the specified number of points to the given origin, respecting the |
296 // maximum limits for the day and overall. | 298 // maximum limits for the day and overall. |
297 void AddPoints(const GURL& url, double points); | 299 void AddPoints(const GURL& url, double points); |
298 | 300 |
299 // Post startup tasks: cleaning up origins which have decayed to 0, and | 301 // Post startup tasks: cleaning up origins which have decayed to 0, and |
300 // logging UMA statistics. | 302 // logging UMA statistics. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 // origin's engagement score after an hour has elapsed triggers the next | 336 // origin's engagement score after an hour has elapsed triggers the next |
335 // upload. | 337 // upload. |
336 base::Time last_metrics_time_; | 338 base::Time last_metrics_time_; |
337 | 339 |
338 base::WeakPtrFactory<SiteEngagementService> weak_factory_; | 340 base::WeakPtrFactory<SiteEngagementService> weak_factory_; |
339 | 341 |
340 DISALLOW_COPY_AND_ASSIGN(SiteEngagementService); | 342 DISALLOW_COPY_AND_ASSIGN(SiteEngagementService); |
341 }; | 343 }; |
342 | 344 |
343 #endif // CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_SERVICE_H_ | 345 #endif // CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_SERVICE_H_ |
OLD | NEW |