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 "components/security_interstitials/core/controller_client.h" |
| 6 |
| 7 #include "base/prefs/pref_service.h" |
| 8 #include "components/google/core/browser/google_util.h" |
| 9 #include "components/security_interstitials/core/metrics_helper.h" |
| 10 #include "grit/components_strings.h" |
| 11 #include "ui/base/l10n/l10n_util.h" |
| 12 #include "url/gurl.h" |
| 13 |
| 14 namespace security_interstitials { |
| 15 |
| 16 ControllerClient::ControllerClient() {} |
| 17 ControllerClient::~ControllerClient() {} |
| 18 |
| 19 MetricsHelper* ControllerClient::metrics_helper() const { |
| 20 return metrics_helper_.get(); |
| 21 } |
| 22 |
| 23 void ControllerClient::set_metrics_helper( |
| 24 scoped_ptr<MetricsHelper> metrics_helper) { |
| 25 metrics_helper_ = metrics_helper.Pass(); |
| 26 } |
| 27 |
| 28 void ControllerClient::SetReportingPreference(bool report) { |
| 29 GetPrefService()->SetBoolean(GetExtendedReportingPrefName(), report); |
| 30 metrics_helper_->RecordUserInteraction( |
| 31 report ? MetricsHelper::SET_EXTENDED_REPORTING_ENABLED |
| 32 : MetricsHelper::SET_EXTENDED_REPORTING_DISABLED); |
| 33 } |
| 34 |
| 35 void ControllerClient::OpenExtendedReportingPrivacyPolicy() { |
| 36 metrics_helper_->RecordUserInteraction(MetricsHelper::SHOW_PRIVACY_POLICY); |
| 37 GURL privacy_url( |
| 38 l10n_util::GetStringUTF8(IDS_SAFE_BROWSING_PRIVACY_POLICY_URL)); |
| 39 privacy_url = |
| 40 google_util::AppendGoogleLocaleParam(privacy_url, GetApplicationLocale()); |
| 41 OpenUrlInCurrentTab(privacy_url); |
| 42 } |
| 43 |
| 44 } // namespace security_interstitials |
OLD | NEW |