forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebui_allowlist_provider.cc
57 lines (47 loc) · 1.97 KB
/
webui_allowlist_provider.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 2020 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 "ui/webui/webui_allowlist_provider.h"
#include "components/content_settings/core/common/content_settings_pattern.h"
#include "ui/webui/webui_allowlist.h"
WebUIAllowlistProvider::WebUIAllowlistProvider(WebUIAllowlist* allowlist)
: allowlist_(allowlist) {
DCHECK(allowlist_);
allowlist_->SetWebUIAllowlistProvider(this);
}
WebUIAllowlistProvider::~WebUIAllowlistProvider() = default;
std::unique_ptr<content_settings::RuleIterator>
WebUIAllowlistProvider::GetRuleIterator(
ContentSettingsType content_type,
const content_settings::ResourceIdentifier& /*resource_identifier*/,
bool incognito) const {
if (!allowlist_)
return nullptr;
return allowlist_->GetRuleIterator(content_type);
}
void WebUIAllowlistProvider::NotifyContentSettingChange(
const ContentSettingsPattern& primary_pattern,
const ContentSettingsPattern& secondary_pattern,
ContentSettingsType content_type) {
NotifyObservers(primary_pattern, secondary_pattern, content_type,
/*resource_identifier*/ std::string());
}
bool WebUIAllowlistProvider::SetWebsiteSetting(
const ContentSettingsPattern& primary_pattern,
const ContentSettingsPattern& secondary_pattern,
ContentSettingsType content_type,
const content_settings::ResourceIdentifier& /*resource_identifier*/,
std::unique_ptr<base::Value>&& value,
const content_settings::ContentSettingConstraints& constraints) {
// WebUIAllowlistProvider doesn't support settings Website settings.
return false;
}
void WebUIAllowlistProvider::ClearAllContentSettingsRules(
ContentSettingsType content_type) {
// WebUIAllowlistProvider doesn't support changing content settings directly.
}
void WebUIAllowlistProvider::ShutdownOnUIThread() {
RemoveAllObservers();
allowlist_->ResetWebUIAllowlistProvider();
allowlist_ = nullptr;
}