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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 bool UpdateScoreDict(base::DictionaryValue* score_dict); | 120 bool UpdateScoreDict(base::DictionaryValue* score_dict); |
121 | 121 |
122 private: | 122 private: |
123 FRIEND_TEST_ALL_PREFIXES(SiteEngagementScoreTest, PartiallyEmptyDictionary); | 123 FRIEND_TEST_ALL_PREFIXES(SiteEngagementScoreTest, PartiallyEmptyDictionary); |
124 FRIEND_TEST_ALL_PREFIXES(SiteEngagementScoreTest, PopulatedDictionary); | 124 FRIEND_TEST_ALL_PREFIXES(SiteEngagementScoreTest, PopulatedDictionary); |
125 FRIEND_TEST_ALL_PREFIXES(SiteEngagementScoreTest, Reset); | 125 FRIEND_TEST_ALL_PREFIXES(SiteEngagementScoreTest, Reset); |
126 FRIEND_TEST_ALL_PREFIXES(SiteEngagementScoreTest, FirstDailyEngagementBonus); | 126 FRIEND_TEST_ALL_PREFIXES(SiteEngagementScoreTest, FirstDailyEngagementBonus); |
127 friend class SiteEngagementHelperTest; | 127 friend class SiteEngagementHelperTest; |
128 friend class SiteEngagementScoreTest; | 128 friend class SiteEngagementScoreTest; |
129 friend class SiteEngagementServiceTest; | 129 friend class SiteEngagementServiceTest; |
| 130 friend class ImportantSitesUtilTest; |
130 | 131 |
131 // Array holding the values corresponding to each item in Variation array. | 132 // Array holding the values corresponding to each item in Variation array. |
132 static double param_values[]; | 133 static double param_values[]; |
133 | 134 |
134 // Keys used in the content settings dictionary. | 135 // Keys used in the content settings dictionary. |
135 static const char* kRawScoreKey; | 136 static const char* kRawScoreKey; |
136 static const char* kPointsAddedTodayKey; | 137 static const char* kPointsAddedTodayKey; |
137 static const char* kLastEngagementTimeKey; | 138 static const char* kLastEngagementTimeKey; |
138 static const char* kLastShortcutLaunchTimeKey; | 139 static const char* kLastShortcutLaunchTimeKey; |
139 | 140 |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, GetMedianEngagement); | 270 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, GetMedianEngagement); |
270 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, GetTotalNavigationPoints); | 271 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, GetTotalNavigationPoints); |
271 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, GetTotalUserInputPoints); | 272 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, GetTotalUserInputPoints); |
272 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, LastShortcutLaunch); | 273 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, LastShortcutLaunch); |
273 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, | 274 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, |
274 CleanupOriginsOnHistoryDeletion); | 275 CleanupOriginsOnHistoryDeletion); |
275 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, IsBootstrapped); | 276 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, IsBootstrapped); |
276 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, EngagementLevel); | 277 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, EngagementLevel); |
277 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, ScoreDecayHistograms); | 278 FRIEND_TEST_ALL_PREFIXES(SiteEngagementServiceTest, ScoreDecayHistograms); |
278 FRIEND_TEST_ALL_PREFIXES(AppBannerSettingsHelperTest, SiteEngagementTrigger); | 279 FRIEND_TEST_ALL_PREFIXES(AppBannerSettingsHelperTest, SiteEngagementTrigger); |
| 280 FRIEND_TEST_ALL_PREFIXES(ImportantSitesUtilTest, NotificationsThenEngagement); |
279 | 281 |
280 // Only used in tests. | 282 // Only used in tests. |
281 SiteEngagementService(Profile* profile, scoped_ptr<base::Clock> clock); | 283 SiteEngagementService(Profile* profile, scoped_ptr<base::Clock> clock); |
282 | 284 |
283 // Adds the specified number of points to the given origin, respecting the | 285 // Adds the specified number of points to the given origin, respecting the |
284 // maximum limits for the day and overall. | 286 // maximum limits for the day and overall. |
285 void AddPoints(const GURL& url, double points); | 287 void AddPoints(const GURL& url, double points); |
286 | 288 |
287 // Post startup tasks: cleaning up origins which have decayed to 0, and | 289 // Post startup tasks: cleaning up origins which have decayed to 0, and |
288 // logging UMA statistics. | 290 // logging UMA statistics. |
(...skipping 25 matching lines...) Expand all Loading... |
314 // origin's engagement score after an hour has elapsed triggers the next | 316 // origin's engagement score after an hour has elapsed triggers the next |
315 // upload. | 317 // upload. |
316 base::Time last_metrics_time_; | 318 base::Time last_metrics_time_; |
317 | 319 |
318 base::WeakPtrFactory<SiteEngagementService> weak_factory_; | 320 base::WeakPtrFactory<SiteEngagementService> weak_factory_; |
319 | 321 |
320 DISALLOW_COPY_AND_ASSIGN(SiteEngagementService); | 322 DISALLOW_COPY_AND_ASSIGN(SiteEngagementService); |
321 }; | 323 }; |
322 | 324 |
323 #endif // CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_SERVICE_H_ | 325 #endif // CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_SERVICE_H_ |
OLD | NEW |