OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/engagement/site_engagement_service.h" |
| 6 |
| 7 #include <algorithm> |
| 8 |
| 9 #include "base/command_line.h" |
| 10 #include "chrome/browser/engagement/site_engagement_helper.h" |
| 11 #include "chrome/browser/engagement/site_engagement_service_factory.h" |
| 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/common/chrome_switches.h" |
| 14 #include "url/gurl.h" |
| 15 |
| 16 // static |
| 17 SiteEngagementService* SiteEngagementService::Get(Profile* profile) { |
| 18 return SiteEngagementServiceFactory::GetForProfile(profile); |
| 19 } |
| 20 |
| 21 // static |
| 22 bool SiteEngagementService::IsEnabled() { |
| 23 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 24 switches::kEnableSiteEngagementService); |
| 25 } |
| 26 |
| 27 SiteEngagementService::SiteEngagementService(Profile* profile) |
| 28 : profile_(profile) { |
| 29 } |
| 30 |
| 31 SiteEngagementService::~SiteEngagementService() { |
| 32 } |
| 33 |
| 34 void SiteEngagementService::HandleNavigation(const GURL& url) { |
| 35 GURL origin = url.GetOrigin(); |
| 36 scores_[origin] = scores_[origin] + 1; |
| 37 } |
| 38 |
| 39 int SiteEngagementService::GetScore(const GURL& url) { |
| 40 return scores_[url.GetOrigin()]; |
| 41 } |
| 42 |
OLD | NEW |