Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / android_webview / browser / aw_browser_policy_connector.cc
blobf0e03eaa8df75d5713c3715d64f9a2926751094e
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.
5 #include "android_webview/browser/aw_browser_policy_connector.h"
7 #include "base/bind.h"
8 #include "components/policy/core/browser/android/android_combined_policy_provider.h"
9 #include "components/policy/core/browser/configuration_policy_handler_list.h"
10 #include "components/policy/core/browser/url_blacklist_policy_handler.h"
11 #include "components/policy/core/common/policy_pref_names.h"
12 #include "net/url_request/url_request_context_getter.h"
13 #include "policy/policy_constants.h"
15 namespace android_webview {
17 namespace {
19 // Callback only used in ChromeOS. No-op here.
20 void PopulatePolicyHandlerParameters(
21 policy::PolicyHandlerParameters* parameters) {}
23 // Used to check if a policy is deprecated. Currently bypasses that check.
24 const policy::PolicyDetails* GetChromePolicyDetails(const std::string& policy) {
25 return nullptr;
28 // Factory for the handlers that will be responsible for converting the policies
29 // to the associated preferences.
30 scoped_ptr<policy::ConfigurationPolicyHandlerList> BuildHandlerList(
31 const policy::Schema& chrome_schema) {
32 scoped_ptr<policy::ConfigurationPolicyHandlerList> handlers(
33 new policy::ConfigurationPolicyHandlerList(
34 base::Bind(&PopulatePolicyHandlerParameters),
35 base::Bind(&GetChromePolicyDetails)));
37 handlers->AddHandler(make_scoped_ptr(new policy::SimplePolicyHandler(
38 policy::key::kURLWhitelist, policy::policy_prefs::kUrlWhitelist,
39 base::Value::TYPE_LIST)));
41 handlers->AddHandler(
42 make_scoped_ptr(new policy::URLBlacklistPolicyHandler()));
43 return handlers.Pass();
46 } // namespace
48 AwBrowserPolicyConnector::AwBrowserPolicyConnector()
49 : BrowserPolicyConnectorBase(base::Bind(&BuildHandlerList)) {
50 SetPlatformPolicyProvider(make_scoped_ptr(
51 new policy::android::AndroidCombinedPolicyProvider(GetSchemaRegistry())));
52 InitPolicyProviders();
55 AwBrowserPolicyConnector::~AwBrowserPolicyConnector() {}
57 } // namespace android_webview