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