OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "android_webview/browser/aw_browser_policy_connector.h" | 5 #include "android_webview/browser/aw_browser_policy_connector.h" |
6 | 6 |
7 #include "android_webview/browser/aw_browser_context.h" | 7 #include "android_webview/browser/aw_browser_context.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/memory/ptr_util.h" |
9 #include "components/policy/core/browser/android/android_combined_policy_provide
r.h" | 10 #include "components/policy/core/browser/android/android_combined_policy_provide
r.h" |
10 #include "components/policy/core/browser/configuration_policy_handler_list.h" | 11 #include "components/policy/core/browser/configuration_policy_handler_list.h" |
11 #include "components/policy/core/browser/url_blacklist_policy_handler.h" | 12 #include "components/policy/core/browser/url_blacklist_policy_handler.h" |
12 #include "components/policy/core/common/policy_pref_names.h" | 13 #include "components/policy/core/common/policy_pref_names.h" |
13 #include "net/url_request/url_request_context_getter.h" | 14 #include "net/url_request/url_request_context_getter.h" |
14 #include "policy/policy_constants.h" | 15 #include "policy/policy_constants.h" |
15 | 16 |
16 namespace android_webview { | 17 namespace android_webview { |
17 | 18 |
18 namespace { | 19 namespace { |
19 | 20 |
20 // Callback only used in ChromeOS. No-op here. | 21 // Callback only used in ChromeOS. No-op here. |
21 void PopulatePolicyHandlerParameters( | 22 void PopulatePolicyHandlerParameters( |
22 policy::PolicyHandlerParameters* parameters) {} | 23 policy::PolicyHandlerParameters* parameters) {} |
23 | 24 |
24 // Used to check if a policy is deprecated. Currently bypasses that check. | 25 // Used to check if a policy is deprecated. Currently bypasses that check. |
25 const policy::PolicyDetails* GetChromePolicyDetails(const std::string& policy) { | 26 const policy::PolicyDetails* GetChromePolicyDetails(const std::string& policy) { |
26 return nullptr; | 27 return nullptr; |
27 } | 28 } |
28 | 29 |
29 // Factory for the handlers that will be responsible for converting the policies | 30 // Factory for the handlers that will be responsible for converting the policies |
30 // to the associated preferences. | 31 // to the associated preferences. |
31 scoped_ptr<policy::ConfigurationPolicyHandlerList> BuildHandlerList( | 32 std::unique_ptr<policy::ConfigurationPolicyHandlerList> BuildHandlerList( |
32 const policy::Schema& chrome_schema) { | 33 const policy::Schema& chrome_schema) { |
33 scoped_ptr<policy::ConfigurationPolicyHandlerList> handlers( | 34 std::unique_ptr<policy::ConfigurationPolicyHandlerList> handlers( |
34 new policy::ConfigurationPolicyHandlerList( | 35 new policy::ConfigurationPolicyHandlerList( |
35 base::Bind(&PopulatePolicyHandlerParameters), | 36 base::Bind(&PopulatePolicyHandlerParameters), |
36 base::Bind(&GetChromePolicyDetails))); | 37 base::Bind(&GetChromePolicyDetails))); |
37 | 38 |
38 // URL Filtering | 39 // URL Filtering |
39 handlers->AddHandler(make_scoped_ptr(new policy::SimplePolicyHandler( | 40 handlers->AddHandler(base::WrapUnique(new policy::SimplePolicyHandler( |
40 policy::key::kURLWhitelist, policy::policy_prefs::kUrlWhitelist, | 41 policy::key::kURLWhitelist, policy::policy_prefs::kUrlWhitelist, |
41 base::Value::TYPE_LIST))); | 42 base::Value::TYPE_LIST))); |
42 handlers->AddHandler( | 43 handlers->AddHandler( |
43 make_scoped_ptr(new policy::URLBlacklistPolicyHandler())); | 44 base::WrapUnique(new policy::URLBlacklistPolicyHandler())); |
44 | 45 |
45 // HTTP Negotiate authentication | 46 // HTTP Negotiate authentication |
46 handlers->AddHandler(make_scoped_ptr(new policy::SimplePolicyHandler( | 47 handlers->AddHandler(base::WrapUnique(new policy::SimplePolicyHandler( |
47 policy::key::kAuthServerWhitelist, prefs::kAuthServerWhitelist, | 48 policy::key::kAuthServerWhitelist, prefs::kAuthServerWhitelist, |
48 base::Value::TYPE_STRING))); | 49 base::Value::TYPE_STRING))); |
49 handlers->AddHandler(make_scoped_ptr(new policy::SimplePolicyHandler( | 50 handlers->AddHandler(base::WrapUnique(new policy::SimplePolicyHandler( |
50 policy::key::kAuthAndroidNegotiateAccountType, | 51 policy::key::kAuthAndroidNegotiateAccountType, |
51 prefs::kAuthAndroidNegotiateAccountType, base::Value::TYPE_STRING))); | 52 prefs::kAuthAndroidNegotiateAccountType, base::Value::TYPE_STRING))); |
52 | 53 |
53 return handlers; | 54 return handlers; |
54 } | 55 } |
55 | 56 |
56 } // namespace | 57 } // namespace |
57 | 58 |
58 AwBrowserPolicyConnector::AwBrowserPolicyConnector() | 59 AwBrowserPolicyConnector::AwBrowserPolicyConnector() |
59 : BrowserPolicyConnectorBase(base::Bind(&BuildHandlerList)) { | 60 : BrowserPolicyConnectorBase(base::Bind(&BuildHandlerList)) { |
60 SetPlatformPolicyProvider(make_scoped_ptr( | 61 SetPlatformPolicyProvider(base::WrapUnique( |
61 new policy::android::AndroidCombinedPolicyProvider(GetSchemaRegistry()))); | 62 new policy::android::AndroidCombinedPolicyProvider(GetSchemaRegistry()))); |
62 InitPolicyProviders(); | 63 InitPolicyProviders(); |
63 } | 64 } |
64 | 65 |
65 AwBrowserPolicyConnector::~AwBrowserPolicyConnector() {} | 66 AwBrowserPolicyConnector::~AwBrowserPolicyConnector() {} |
66 | 67 |
67 } // namespace android_webview | 68 } // namespace android_webview |
OLD | NEW |