Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(958)

Side by Side Diff: chrome/browser/policy/cloud/cloud_policy_service.cc

Issue 19733003: Implement cloud policy invalidations using the invalidation service framework. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "chrome/browser/policy/cloud/cloud_policy_service.h" 5 #include "chrome/browser/policy/cloud/cloud_policy_service.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "chrome/browser/policy/proto/cloud/device_management_backend.pb.h" 8 #include "chrome/browser/policy/proto/cloud/device_management_backend.pb.h"
9 9
10 namespace em = enterprise_management; 10 namespace em = enterprise_management;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 void CloudPolicyService::OnPolicyFetched(CloudPolicyClient* client) { 61 void CloudPolicyService::OnPolicyFetched(CloudPolicyClient* client) {
62 if (client_->status() != DM_STATUS_SUCCESS) { 62 if (client_->status() != DM_STATUS_SUCCESS) {
63 RefreshCompleted(false); 63 RefreshCompleted(false);
64 return; 64 return;
65 } 65 }
66 66
67 const em::PolicyFetchResponse* policy = client_->GetPolicyFor(policy_ns_key_); 67 const em::PolicyFetchResponse* policy = client_->GetPolicyFor(policy_ns_key_);
68 if (policy) { 68 if (policy) {
69 if (refresh_state_ != REFRESH_NONE) 69 if (refresh_state_ != REFRESH_NONE)
70 refresh_state_ = REFRESH_POLICY_STORE; 70 refresh_state_ = REFRESH_POLICY_STORE;
71 store_->Store(*policy); 71 store_->Store(*policy, client->fetched_invalidation_version());
72 } else { 72 } else {
73 RefreshCompleted(false); 73 RefreshCompleted(false);
74 } 74 }
75 } 75 }
76 76
77 void CloudPolicyService::OnRegistrationStateChanged(CloudPolicyClient* client) { 77 void CloudPolicyService::OnRegistrationStateChanged(CloudPolicyClient* client) {
78 } 78 }
79 79
80 void CloudPolicyService::OnClientError(CloudPolicyClient* client) { 80 void CloudPolicyService::OnClientError(CloudPolicyClient* client) {
81 if (refresh_state_ == REFRESH_POLICY_FETCH) 81 if (refresh_state_ == REFRESH_POLICY_FETCH)
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 151
152 void CloudPolicyService::AddObserver(Observer* observer) { 152 void CloudPolicyService::AddObserver(Observer* observer) {
153 observers_.AddObserver(observer); 153 observers_.AddObserver(observer);
154 } 154 }
155 155
156 void CloudPolicyService::RemoveObserver(Observer* observer) { 156 void CloudPolicyService::RemoveObserver(Observer* observer) {
157 observers_.RemoveObserver(observer); 157 observers_.RemoveObserver(observer);
158 } 158 }
159 159
160 } // namespace policy 160 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698