OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/policy/asynchronous_policy_loader.h" | 5 #include "chrome/browser/policy/asynchronous_policy_loader.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "base/task.h" | 8 #include "base/task.h" |
9 #include "chrome/browser/browser_thread.h" | 9 #include "chrome/browser/browser_thread.h" |
10 | 10 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 PostUpdatePolicyTask(new_policy); | 54 PostUpdatePolicyTask(new_policy); |
55 } | 55 } |
56 } | 56 } |
57 | 57 |
58 void AsynchronousPolicyLoader::PostUpdatePolicyTask( | 58 void AsynchronousPolicyLoader::PostUpdatePolicyTask( |
59 DictionaryValue* new_policy) { | 59 DictionaryValue* new_policy) { |
60 origin_loop_->PostTask(FROM_HERE, new UpdatePolicyTask(this, new_policy)); | 60 origin_loop_->PostTask(FROM_HERE, new UpdatePolicyTask(this, new_policy)); |
61 } | 61 } |
62 | 62 |
63 void AsynchronousPolicyLoader::UpdatePolicy(DictionaryValue* new_policy_raw) { | 63 void AsynchronousPolicyLoader::UpdatePolicy(DictionaryValue* new_policy_raw) { |
| 64 scoped_ptr<DictionaryValue> new_policy(new_policy_raw); |
64 DCHECK(policy_.get()); | 65 DCHECK(policy_.get()); |
65 if (!policy_->Equals(new_policy_raw)) { | 66 if (!policy_->Equals(new_policy.get())) { |
66 policy_.reset(new_policy_raw); | 67 policy_.reset(new_policy.release()); |
67 // TODO(danno): Change the notification between the provider and the | 68 // TODO(danno): Change the notification between the provider and the |
68 // PrefStore into a notification mechanism, removing the need for the | 69 // PrefStore into a notification mechanism, removing the need for the |
69 // WeakPtr for the provider. | 70 // WeakPtr for the provider. |
70 if (provider_) | 71 if (provider_) |
71 provider_->NotifyStoreOfPolicyChange(); | 72 provider_->NotifyStoreOfPolicyChange(); |
72 } | 73 } |
73 } | 74 } |
74 | 75 |
75 } // namespace policy | 76 } // namespace policy |
OLD | NEW |