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

Side by Side Diff: chrome/browser/policy/cloud_policy_controller.cc

Issue 6727027: Update protobuf definitions for ChromeOS device policy support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 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_policy_controller.h" 5 #include "chrome/browser/policy/cloud_policy_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/rand_util.h" 10 #include "base/rand_util.h"
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 if (identity_strategy_->GetCredentials(&username, &auth_token) && 202 if (identity_strategy_->GetCredentials(&username, &auth_token) &&
203 CanBeInManagedDomain(username)) { 203 CanBeInManagedDomain(username)) {
204 token_fetcher_->FetchToken(auth_token, device_id, policy_type, machine_id); 204 token_fetcher_->FetchToken(auth_token, device_id, policy_type, machine_id);
205 } 205 }
206 } 206 }
207 207
208 void CloudPolicyController::SendPolicyRequest() { 208 void CloudPolicyController::SendPolicyRequest() {
209 DCHECK(!identity_strategy_->GetDeviceToken().empty()); 209 DCHECK(!identity_strategy_->GetDeviceToken().empty());
210 em::DevicePolicyRequest policy_request; 210 em::DevicePolicyRequest policy_request;
211 em::PolicyFetchRequest* fetch_request = policy_request.add_request(); 211 em::PolicyFetchRequest* fetch_request = policy_request.add_request();
212 fetch_request->set_signature_type(em::PolicyFetchRequest::X509); 212 fetch_request->set_signature_type(em::PolicyFetchRequest::SHA1_RSA);
213 fetch_request->set_policy_type(identity_strategy_->GetPolicyType()); 213 fetch_request->set_policy_type(identity_strategy_->GetPolicyType());
214 if (!cache_->is_unmanaged() && 214 if (!cache_->is_unmanaged() &&
215 !cache_->last_policy_refresh_time().is_null()) { 215 !cache_->last_policy_refresh_time().is_null()) {
216 base::TimeDelta timestamp = 216 base::TimeDelta timestamp =
217 cache_->last_policy_refresh_time() - base::Time::UnixEpoch(); 217 cache_->last_policy_refresh_time() - base::Time::UnixEpoch();
218 fetch_request->set_timestamp(timestamp.InMilliseconds()); 218 fetch_request->set_timestamp(timestamp.InMilliseconds());
219 } 219 }
220 220
221 // TODO(gfeher): Remove the following block when the server is migrated. 221 // TODO(gfeher): Remove the following block when the server is migrated.
222 // Set fields for the old protocol. 222 // Set fields for the old protocol.
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 } 298 }
299 299
300 int64 CloudPolicyController::GetRefreshDelay() { 300 int64 CloudPolicyController::GetRefreshDelay() {
301 int64 deviation = (policy_refresh_deviation_factor_percent_ * 301 int64 deviation = (policy_refresh_deviation_factor_percent_ *
302 policy_refresh_rate_ms_) / 100; 302 policy_refresh_rate_ms_) / 100;
303 deviation = std::min(deviation, policy_refresh_deviation_max_ms_); 303 deviation = std::min(deviation, policy_refresh_deviation_max_ms_);
304 return policy_refresh_rate_ms_ - base::RandGenerator(deviation + 1); 304 return policy_refresh_rate_ms_ - base::RandGenerator(deviation + 1);
305 } 305 }
306 306
307 } // namespace policy 307 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698