| OLD | NEW |
| 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/chromeos/policy/auto_enrollment_client.h" | 5 #include "chrome/browser/chromeos/policy/auto_enrollment_client.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/guid.h" | 10 #include "base/guid.h" |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 int net_error, | 369 int net_error, |
| 370 const enterprise_management::DeviceManagementResponse& response) { | 370 const enterprise_management::DeviceManagementResponse& response) { |
| 371 bool progress = false; | 371 bool progress = false; |
| 372 if (!response.has_device_state_retrieval_response()) { | 372 if (!response.has_device_state_retrieval_response()) { |
| 373 LOG(ERROR) << "Server failed to provide auto-enrollment response."; | 373 LOG(ERROR) << "Server failed to provide auto-enrollment response."; |
| 374 } else { | 374 } else { |
| 375 const em::DeviceStateRetrievalResponse& state_response = | 375 const em::DeviceStateRetrievalResponse& state_response = |
| 376 response.device_state_retrieval_response(); | 376 response.device_state_retrieval_response(); |
| 377 { | 377 { |
| 378 DictionaryPrefUpdate dict(local_state_, prefs::kServerBackedDeviceState); | 378 DictionaryPrefUpdate dict(local_state_, prefs::kServerBackedDeviceState); |
| 379 UpdateDict(dict.Get(), | 379 UpdateDict(dict.Get(), kDeviceStateManagementDomain, |
| 380 kDeviceStateManagementDomain, | |
| 381 state_response.has_management_domain(), | 380 state_response.has_management_domain(), |
| 382 new base::StringValue(state_response.management_domain())); | 381 new base::Value(state_response.management_domain())); |
| 383 | 382 |
| 384 std::string restore_mode = | 383 std::string restore_mode = |
| 385 ConvertRestoreMode(state_response.restore_mode()); | 384 ConvertRestoreMode(state_response.restore_mode()); |
| 386 UpdateDict(dict.Get(), | 385 UpdateDict(dict.Get(), kDeviceStateRestoreMode, !restore_mode.empty(), |
| 387 kDeviceStateRestoreMode, | 386 new base::Value(restore_mode)); |
| 388 !restore_mode.empty(), | |
| 389 new base::StringValue(restore_mode)); | |
| 390 | 387 |
| 391 UpdateDict(dict.Get(), | 388 UpdateDict(dict.Get(), kDeviceStateDisabledMessage, |
| 392 kDeviceStateDisabledMessage, | |
| 393 state_response.has_disabled_state(), | 389 state_response.has_disabled_state(), |
| 394 new base::StringValue( | 390 new base::Value(state_response.disabled_state().message())); |
| 395 state_response.disabled_state().message())); | |
| 396 | 391 |
| 397 // Logging as "WARNING" to make sure it's preserved in the logs. | 392 // Logging as "WARNING" to make sure it's preserved in the logs. |
| 398 LOG(WARNING) << "Restore mode: " << restore_mode; | 393 LOG(WARNING) << "Restore mode: " << restore_mode; |
| 399 } | 394 } |
| 400 local_state_->CommitPendingWrite(); | 395 local_state_->CommitPendingWrite(); |
| 401 device_state_available_ = true; | 396 device_state_available_ = true; |
| 402 progress = true; | 397 progress = true; |
| 403 } | 398 } |
| 404 | 399 |
| 405 return progress; | 400 return progress; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 430 base::TimeDelta delta = kZero; | 425 base::TimeDelta delta = kZero; |
| 431 if (!time_extra_start_.is_null()) | 426 if (!time_extra_start_.is_null()) |
| 432 delta = now - time_extra_start_; | 427 delta = now - time_extra_start_; |
| 433 // This samples |kZero| when there was no need for extra time, so that we can | 428 // This samples |kZero| when there was no need for extra time, so that we can |
| 434 // measure the ratio of users that succeeded without needing a delay to the | 429 // measure the ratio of users that succeeded without needing a delay to the |
| 435 // total users going through OOBE. | 430 // total users going through OOBE. |
| 436 UMA_HISTOGRAM_CUSTOM_TIMES(kUMAExtraTime, delta, kMin, kMax, kBuckets); | 431 UMA_HISTOGRAM_CUSTOM_TIMES(kUMAExtraTime, delta, kMin, kMax, kBuckets); |
| 437 } | 432 } |
| 438 | 433 |
| 439 } // namespace policy | 434 } // namespace policy |
| OLD | NEW |