blob: 0a32c7af5b0e7a10bda439633f554f5a5eb7dd06 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
// 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 <utility>
#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 {
const char kBoxChecked[] = "boxchecked";
const char kDisplayCheckBox[] = "displaycheckbox";
const char kOptInLink[] = "optInLink";
const char kPrivacyLinkHtml[] =
"<a id=\"privacy-link\" href=\"\" onclick=\"sendCommand(%d); "
"return false;\" onmousedown=\"return false;\">%s</a>";
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_ = std::move(metrics_helper);
}
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
|