Chromium Code Reviews| 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 url.GetOrigin(); | |
|
raymes
2015/04/16 01:13:55
nit: remove this line
benwells
2015/04/16 05:15:27
Done.
| |
| 38 } | |
| 39 | |
| 40 int SiteEngagementService::GetScore(const GURL& url) { | |
| 41 return scores_[url.GetOrigin()]; | |
| 42 } | |
| 43 | |
| OLD | NEW |