forked from Pissandshittium/pissandshittium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcast_content_settings_client.cc
57 lines (44 loc) · 1.67 KB
/
cast_content_settings_client.cc
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
54
55
56
57
// Copyright 2021 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 "chromecast/renderer/cast_content_settings_client.h"
#include "base/metrics/user_metrics.h"
#include "content/public/renderer/render_frame.h"
#include "third_party/blink/public/platform/web_url.h"
#include "third_party/blink/public/web/web_local_frame.h"
namespace {
void ReportRendererFeatureUse(const std::string& app_id,
const std::string& feature_name) {
std::string action = "Cast.Platform.RendererFeatureUse.";
action.append(feature_name);
action.append(".");
action.append(app_id);
base::RecordComputedAction(action);
}
} // namespace
namespace chromecast {
CastContentSettingsClient::CastContentSettingsClient(
content::RenderFrame* render_frame,
const std::string& app_id)
: content::RenderFrameObserver(render_frame), app_id_(app_id) {
render_frame->GetWebFrame()->SetContentSettingsClient(this);
}
CastContentSettingsClient::~CastContentSettingsClient() {}
bool CastContentSettingsClient::AllowRunningInsecureContent(
bool enabled_per_settings,
const blink::WebURL& url) {
ReportRendererFeatureUse(app_id_, "ActiveInsecureContent");
return true;
}
void CastContentSettingsClient::PassiveInsecureContentFound(
const blink::WebURL&) {
ReportRendererFeatureUse(app_id_, "PassiveInsecureContent");
}
bool CastContentSettingsClient::ShouldAutoupgradeMixedContent() {
ReportRendererFeatureUse(app_id_, "DisableAutoUpgradeMixedContent");
return false;
}
void CastContentSettingsClient::OnDestruct() {
delete this;
}
} // namespace chromecast