OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "components/policy/core/common/policy_service_impl.h" | 5 #include "components/policy/core/common/policy_service_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
11 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
13 #include "base/thread_task_runner_handle.h" | 13 #include "base/thread_task_runner_handle.h" |
14 #include "base/values.h" | 14 #include "base/values.h" |
15 #include "components/policy/core/common/policy_bundle.h" | 15 #include "components/policy/core/common/policy_bundle.h" |
16 #include "components/policy/core/common/policy_map.h" | 16 #include "components/policy/core/common/policy_map.h" |
17 #include "components/policy/core/common/policy_types.h" | |
17 #include "policy/policy_constants.h" | 18 #include "policy/policy_constants.h" |
18 | 19 |
19 namespace policy { | 20 namespace policy { |
20 | 21 |
21 typedef PolicyServiceImpl::Providers::const_iterator Iterator; | 22 typedef PolicyServiceImpl::Providers::const_iterator Iterator; |
22 | 23 |
23 namespace { | 24 namespace { |
24 | 25 |
25 const char* kProxyPolicies[] = { | 26 const char* kProxyPolicies[] = { |
26 key::kProxyMode, | 27 key::kProxyMode, |
(...skipping 30 matching lines...) Expand all Loading... | |
57 } | 58 } |
58 } | 59 } |
59 // Sets the new |proxy_settings| if kProxySettings isn't set yet, or if the | 60 // Sets the new |proxy_settings| if kProxySettings isn't set yet, or if the |
60 // new priority is higher. | 61 // new priority is higher. |
61 const PolicyMap::Entry* existing = policies->Get(key::kProxySettings); | 62 const PolicyMap::Entry* existing = policies->Get(key::kProxySettings); |
62 if (!proxy_settings->empty() && | 63 if (!proxy_settings->empty() && |
63 (!existing || current_priority.has_higher_priority_than(*existing))) { | 64 (!existing || current_priority.has_higher_priority_than(*existing))) { |
64 policies->Set(key::kProxySettings, | 65 policies->Set(key::kProxySettings, |
65 current_priority.level, | 66 current_priority.level, |
66 current_priority.scope, | 67 current_priority.scope, |
68 POLICY_SOURCE_BUILT_IN, | |
bartfab (slow)
2015/09/16 15:58:41
Nit: As discussed offline, it is probably better t
fhorschig
2015/09/17 11:20:42
Done.
| |
67 proxy_settings.release(), | 69 proxy_settings.release(), |
68 NULL); | 70 NULL); |
69 } | 71 } |
70 } | 72 } |
71 | 73 |
72 } // namespace | 74 } // namespace |
73 | 75 |
74 PolicyServiceImpl::PolicyServiceImpl(const Providers& providers) | 76 PolicyServiceImpl::PolicyServiceImpl(const Providers& providers) |
75 : update_task_ptr_factory_(this) { | 77 : update_task_ptr_factory_(this) { |
76 for (int domain = 0; domain < POLICY_DOMAIN_SIZE; ++domain) | 78 for (int domain = 0; domain < POLICY_DOMAIN_SIZE; ++domain) |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
273 if (refresh_pending_.empty() && !refresh_callbacks_.empty()) { | 275 if (refresh_pending_.empty() && !refresh_callbacks_.empty()) { |
274 std::vector<base::Closure> callbacks; | 276 std::vector<base::Closure> callbacks; |
275 callbacks.swap(refresh_callbacks_); | 277 callbacks.swap(refresh_callbacks_); |
276 std::vector<base::Closure>::iterator it; | 278 std::vector<base::Closure>::iterator it; |
277 for (it = callbacks.begin(); it != callbacks.end(); ++it) | 279 for (it = callbacks.begin(); it != callbacks.end(); ++it) |
278 it->Run(); | 280 it->Run(); |
279 } | 281 } |
280 } | 282 } |
281 | 283 |
282 } // namespace policy | 284 } // namespace policy |
OLD | NEW |