Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(236)

Unified Diff: components/security_interstitials/core/controller_client.cc

Issue 1462353002: Create security_interstitials::ControllerClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits for estark Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/security_interstitials/core/controller_client.cc
diff --git a/components/security_interstitials/core/controller_client.cc b/components/security_interstitials/core/controller_client.cc
new file mode 100644
index 0000000000000000000000000000000000000000..7be4d84a60bca5370a15fd7019262b9108f94f05
--- /dev/null
+++ b/components/security_interstitials/core/controller_client.cc
@@ -0,0 +1,44 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/security_interstitials/core/controller_client.h"
+
+#include "base/prefs/pref_service.h"
+#include "components/google/core/browser/google_util.h"
+#include "components/security_interstitials/core/metrics_helper.h"
+#include "grit/components_strings.h"
+#include "ui/base/l10n/l10n_util.h"
+#include "url/gurl.h"
+
+namespace security_interstitials {
+
+ControllerClient::ControllerClient() {}
+ControllerClient::~ControllerClient() {}
+
+MetricsHelper* ControllerClient::metrics_helper() const {
+ return metrics_helper_.get();
+}
+
+void ControllerClient::set_metrics_helper(
+ scoped_ptr<MetricsHelper> metrics_helper) {
+ metrics_helper_ = metrics_helper.Pass();
+}
+
+void ControllerClient::SetReportingPreference(bool report) {
+ GetPrefService()->SetBoolean(GetExtendedReportingPrefName(), report);
+ metrics_helper_->RecordUserInteraction(
+ report ? MetricsHelper::SET_EXTENDED_REPORTING_ENABLED
+ : MetricsHelper::SET_EXTENDED_REPORTING_DISABLED);
+}
+
+void ControllerClient::OpenExtendedReportingPrivacyPolicy() {
+ metrics_helper_->RecordUserInteraction(MetricsHelper::SHOW_PRIVACY_POLICY);
+ GURL privacy_url(
+ l10n_util::GetStringUTF8(IDS_SAFE_BROWSING_PRIVACY_POLICY_URL));
+ privacy_url =
+ google_util::AppendGoogleLocaleParam(privacy_url, GetApplicationLocale());
+ OpenUrlInCurrentTab(privacy_url);
+}
+
+} // namespace security_interstitials

Powered by Google App Engine
This is Rietveld 408576698