| OLD | NEW | 
|   1 // Copyright 2014 The Chromium Authors. All rights reserved. |   1 // Copyright 2014 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/proxy_policy_provider.h" |   5 #include "components/policy/core/common/proxy_policy_provider.h" | 
|   6  |   6  | 
 |   7 #include <utility> | 
 |   8  | 
|   7 #include "base/logging.h" |   9 #include "base/logging.h" | 
|   8 #include "base/memory/scoped_ptr.h" |  10 #include "base/memory/scoped_ptr.h" | 
|   9 #include "components/policy/core/common/policy_bundle.h" |  11 #include "components/policy/core/common/policy_bundle.h" | 
|  10  |  12  | 
|  11 namespace policy { |  13 namespace policy { | 
|  12  |  14  | 
|  13 ProxyPolicyProvider::ProxyPolicyProvider() : delegate_(NULL) {} |  15 ProxyPolicyProvider::ProxyPolicyProvider() : delegate_(NULL) {} | 
|  14  |  16  | 
|  15 ProxyPolicyProvider::~ProxyPolicyProvider() { |  17 ProxyPolicyProvider::~ProxyPolicyProvider() { | 
|  16   DCHECK(!delegate_); |  18   DCHECK(!delegate_); | 
| (...skipping 24 matching lines...) Expand all  Loading... | 
|  41  |  43  | 
|  42 void ProxyPolicyProvider::RefreshPolicies() { |  44 void ProxyPolicyProvider::RefreshPolicies() { | 
|  43   if (delegate_) { |  45   if (delegate_) { | 
|  44     delegate_->RefreshPolicies(); |  46     delegate_->RefreshPolicies(); | 
|  45   } else { |  47   } else { | 
|  46     // Subtle: if a RefreshPolicies() call comes after Shutdown() then the |  48     // Subtle: if a RefreshPolicies() call comes after Shutdown() then the | 
|  47     // current bundle should be served instead. This also does the right thing |  49     // current bundle should be served instead. This also does the right thing | 
|  48     // if SetDelegate() was never called before. |  50     // if SetDelegate() was never called before. | 
|  49     scoped_ptr<PolicyBundle> bundle(new PolicyBundle()); |  51     scoped_ptr<PolicyBundle> bundle(new PolicyBundle()); | 
|  50     bundle->CopyFrom(policies()); |  52     bundle->CopyFrom(policies()); | 
|  51     UpdatePolicy(bundle.Pass()); |  53     UpdatePolicy(std::move(bundle)); | 
|  52   } |  54   } | 
|  53 } |  55 } | 
|  54  |  56  | 
|  55 void ProxyPolicyProvider::OnUpdatePolicy( |  57 void ProxyPolicyProvider::OnUpdatePolicy( | 
|  56     ConfigurationPolicyProvider* provider) { |  58     ConfigurationPolicyProvider* provider) { | 
|  57   DCHECK_EQ(delegate_, provider); |  59   DCHECK_EQ(delegate_, provider); | 
|  58   scoped_ptr<PolicyBundle> bundle(new PolicyBundle()); |  60   scoped_ptr<PolicyBundle> bundle(new PolicyBundle()); | 
|  59   bundle->CopyFrom(delegate_->policies()); |  61   bundle->CopyFrom(delegate_->policies()); | 
|  60   UpdatePolicy(bundle.Pass()); |  62   UpdatePolicy(std::move(bundle)); | 
|  61 } |  63 } | 
|  62  |  64  | 
|  63 }  // namespace policy |  65 }  // namespace policy | 
| OLD | NEW |