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

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

Issue 6821045: Connect enrollment screen to cloud policy subsystem. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unit tests... Created 9 years, 8 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/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 SetState(STATE_TOKEN_VALID); 220 SetState(STATE_TOKEN_VALID);
221 else 221 else
222 SetState(STATE_TOKEN_UNAVAILABLE); 222 SetState(STATE_TOKEN_UNAVAILABLE);
223 } 223 }
224 224
225 void CloudPolicyController::FetchToken() { 225 void CloudPolicyController::FetchToken() {
226 std::string username; 226 std::string username;
227 std::string auth_token; 227 std::string auth_token;
228 std::string device_id = identity_strategy_->GetDeviceID(); 228 std::string device_id = identity_strategy_->GetDeviceID();
229 std::string machine_id = identity_strategy_->GetMachineID(); 229 std::string machine_id = identity_strategy_->GetMachineID();
230 std::string machine_model = identity_strategy_->GetMachineModel();
230 em::DeviceRegisterRequest_Type policy_type = 231 em::DeviceRegisterRequest_Type policy_type =
231 identity_strategy_->GetPolicyRegisterType(); 232 identity_strategy_->GetPolicyRegisterType();
232 if (identity_strategy_->GetCredentials(&username, &auth_token) && 233 if (identity_strategy_->GetCredentials(&username, &auth_token) &&
233 CanBeInManagedDomain(username)) { 234 CanBeInManagedDomain(username)) {
234 token_fetcher_->FetchToken(auth_token, device_id, policy_type, machine_id); 235 token_fetcher_->FetchToken(auth_token, device_id, policy_type,
236 machine_id, machine_model);
235 } 237 }
236 } 238 }
237 239
238 void CloudPolicyController::SendPolicyRequest() { 240 void CloudPolicyController::SendPolicyRequest() {
239 backend_.reset(service_->CreateBackend()); 241 backend_.reset(service_->CreateBackend());
240 DCHECK(!identity_strategy_->GetDeviceToken().empty()); 242 DCHECK(!identity_strategy_->GetDeviceToken().empty());
241 em::DevicePolicyRequest policy_request; 243 em::DevicePolicyRequest policy_request;
242 em::PolicyFetchRequest* fetch_request = policy_request.add_request(); 244 em::PolicyFetchRequest* fetch_request = policy_request.add_request();
243 fetch_request->set_signature_type(em::PolicyFetchRequest::SHA1_RSA); 245 fetch_request->set_signature_type(em::PolicyFetchRequest::SHA1_RSA);
244 fetch_request->set_policy_type(identity_strategy_->GetPolicyType()); 246 fetch_request->set_policy_type(identity_strategy_->GetPolicyType());
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 } 367 }
366 368
367 int64 CloudPolicyController::GetRefreshDelay() { 369 int64 CloudPolicyController::GetRefreshDelay() {
368 int64 deviation = (policy_refresh_deviation_factor_percent_ * 370 int64 deviation = (policy_refresh_deviation_factor_percent_ *
369 policy_refresh_rate_ms_) / 100; 371 policy_refresh_rate_ms_) / 100;
370 deviation = std::min(deviation, policy_refresh_deviation_max_ms_); 372 deviation = std::min(deviation, policy_refresh_deviation_max_ms_);
371 return policy_refresh_rate_ms_ - base::RandGenerator(deviation + 1); 373 return policy_refresh_rate_ms_ - base::RandGenerator(deviation + 1);
372 } 374 }
373 375
374 } // namespace policy 376 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/browser_policy_connector.cc ('k') | chrome/browser/policy/cloud_policy_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698