Home | History | Annotate | Download | only in policy
      1 // Copyright (c) 2011 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.
      4 
      5 #include "base/values.h"
      6 #include "chrome/browser/policy/configuration_policy_store_interface.h"
      7 
      8 namespace {
      9 
     10 using namespace policy;
     11 
     12 bool IsProxyPolicy(ConfigurationPolicyType policy) {
     13   return policy == kPolicyProxyMode ||
     14          policy == kPolicyProxyServerMode ||
     15          policy == kPolicyProxyServer ||
     16          policy == kPolicyProxyPacUrl ||
     17          policy == kPolicyProxyBypassList;
     18 }
     19 
     20 } // namespace
     21 
     22 namespace policy {
     23 
     24 void ObservingPolicyStoreInterface::Apply(ConfigurationPolicyType policy,
     25                                           Value* value) {
     26   next_->Apply(policy, value);
     27 
     28   if (IsProxyPolicy(policy))
     29       proxy_policy_applied_ = true;
     30 }
     31 
     32 void FilteringPolicyStoreInterface::Apply(ConfigurationPolicyType policy,
     33                                           Value* value) {
     34   // Apply() takes ownership of |value|.
     35   if (IsProxyPolicy(policy) && apply_proxy_policies_)
     36     next_->Apply(policy, value);
     37   else
     38     delete value;
     39 }
     40 
     41 } // namespace policy
     42