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 #include "chrome/browser/ui/webui/engagement/site_engagement_ui.h" | 5 #include "chrome/browser/ui/webui/engagement/site_engagement_ui.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 } | 55 } |
56 | 56 |
57 void SetSiteEngagementScoreForOrigin(const GURL& origin, | 57 void SetSiteEngagementScoreForOrigin(const GURL& origin, |
58 double score) override { | 58 double score) override { |
59 if (!origin.is_valid() || score < 0 || | 59 if (!origin.is_valid() || score < 0 || |
60 score > SiteEngagementService::GetMaxPoints() || std::isnan(score)) { | 60 score > SiteEngagementService::GetMaxPoints() || std::isnan(score)) { |
61 return; | 61 return; |
62 } | 62 } |
63 | 63 |
64 SiteEngagementService* service = SiteEngagementService::Get(profile_); | 64 SiteEngagementService* service = SiteEngagementService::Get(profile_); |
65 service->ResetScoreForURL(origin, score); | 65 service->ResetBaseScoreForURL(origin, score); |
66 } | 66 } |
67 | 67 |
68 private: | 68 private: |
69 // The Profile* handed to us in our constructor. | 69 // The Profile* handed to us in our constructor. |
70 Profile* profile_; | 70 Profile* profile_; |
71 | 71 |
72 mojo::Binding<mojom::SiteEngagementUIHandler> binding_; | 72 mojo::Binding<mojom::SiteEngagementUIHandler> binding_; |
73 | 73 |
74 DISALLOW_COPY_AND_ASSIGN(SiteEngagementUIHandlerImpl); | 74 DISALLOW_COPY_AND_ASSIGN(SiteEngagementUIHandlerImpl); |
75 }; | 75 }; |
(...skipping 15 matching lines...) Expand all Loading... |
91 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), source.release()); | 91 content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), source.release()); |
92 } | 92 } |
93 | 93 |
94 SiteEngagementUI::~SiteEngagementUI() {} | 94 SiteEngagementUI::~SiteEngagementUI() {} |
95 | 95 |
96 void SiteEngagementUI::BindUIHandler( | 96 void SiteEngagementUI::BindUIHandler( |
97 mojo::InterfaceRequest<mojom::SiteEngagementUIHandler> request) { | 97 mojo::InterfaceRequest<mojom::SiteEngagementUIHandler> request) { |
98 ui_handler_.reset(new SiteEngagementUIHandlerImpl( | 98 ui_handler_.reset(new SiteEngagementUIHandlerImpl( |
99 Profile::FromWebUI(web_ui()), std::move(request))); | 99 Profile::FromWebUI(web_ui()), std::move(request))); |
100 } | 100 } |
OLD | NEW |