| 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> |
| 9 |
| 8 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| 9 #include "base/macros.h" | 11 #include "base/macros.h" |
| 10 #include "base/time/default_clock.h" | 12 #include "base/time/default_clock.h" |
| 11 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 12 #include "components/keyed_service/core/keyed_service.h" | 14 #include "components/keyed_service/core/keyed_service.h" |
| 13 | 15 |
| 14 namespace base { | 16 namespace base { |
| 15 class DictionaryValue; | 17 class DictionaryValue; |
| 16 } | 18 } |
| 17 | 19 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 public SiteEngagementScoreProvider { | 109 public SiteEngagementScoreProvider { |
| 108 public: | 110 public: |
| 109 static SiteEngagementService* Get(Profile* profile); | 111 static SiteEngagementService* Get(Profile* profile); |
| 110 | 112 |
| 111 // Returns whether or not the SiteEngagementService is enabled. | 113 // Returns whether or not the SiteEngagementService is enabled. |
| 112 static bool IsEnabled(); | 114 static bool IsEnabled(); |
| 113 | 115 |
| 114 explicit SiteEngagementService(Profile* profile); | 116 explicit SiteEngagementService(Profile* profile); |
| 115 ~SiteEngagementService() override; | 117 ~SiteEngagementService() override; |
| 116 | 118 |
| 119 // Returns a map of all stored origins and their engagement scores. |
| 120 std::map<GURL, int> GetScoreMap(); |
| 121 |
| 117 // Update the karma score of the origin matching |url| for user navigation. | 122 // Update the karma score of the origin matching |url| for user navigation. |
| 118 void HandleNavigation(const GURL& url); | 123 void HandleNavigation(const GURL& url); |
| 119 | 124 |
| 120 // Overridden from SiteEngagementScoreProvider: | 125 // Overridden from SiteEngagementScoreProvider: |
| 121 int GetScore(const GURL& url) override; | 126 int GetScore(const GURL& url) override; |
| 122 int GetTotalEngagementPoints() override; | 127 int GetTotalEngagementPoints() override; |
| 123 | 128 |
| 124 private: | 129 private: |
| 125 Profile* profile_; | 130 Profile* profile_; |
| 126 | 131 |
| 127 // The clock used to vend times. | 132 // The clock used to vend times. |
| 128 base::DefaultClock clock_; | 133 base::DefaultClock clock_; |
| 129 | 134 |
| 130 DISALLOW_COPY_AND_ASSIGN(SiteEngagementService); | 135 DISALLOW_COPY_AND_ASSIGN(SiteEngagementService); |
| 131 }; | 136 }; |
| 132 | 137 |
| 133 #endif // CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_SERVICE_H_ | 138 #endif // CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_SERVICE_H_ |
| OLD | NEW |