OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/login/enrollment/enterprise_enrollment_helper_
impl.h" | 5 #include "chrome/browser/chromeos/login/enrollment/enterprise_enrollment_helper_
impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 break; | 371 break; |
372 case policy::EnrollmentStatus::STATUS_ROBOT_REFRESH_STORE_FAILED: | 372 case policy::EnrollmentStatus::STATUS_ROBOT_REFRESH_STORE_FAILED: |
373 UMA(policy::kMetricEnrollmentRobotRefreshTokenStoreFailed); | 373 UMA(policy::kMetricEnrollmentRobotRefreshTokenStoreFailed); |
374 break; | 374 break; |
375 case policy::EnrollmentStatus::STATUS_STORE_TOKEN_AND_ID_FAILED: | 375 case policy::EnrollmentStatus::STATUS_STORE_TOKEN_AND_ID_FAILED: |
376 // This error should not happen for enterprise enrollment, it only affects | 376 // This error should not happen for enterprise enrollment, it only affects |
377 // consumer enrollment. | 377 // consumer enrollment. |
378 UMA(policy::kMetricEnrollmentStoreTokenAndIdFailed); | 378 UMA(policy::kMetricEnrollmentStoreTokenAndIdFailed); |
379 NOTREACHED(); | 379 NOTREACHED(); |
380 break; | 380 break; |
| 381 case policy::EnrollmentStatus::STATUS_DEVICE_NAMING_FAILED: |
| 382 UMA(policy::kMetricEnrollmentDeviceNamingFailed); |
| 383 break; |
381 } | 384 } |
382 } | 385 } |
383 | 386 |
384 void EnterpriseEnrollmentHelperImpl::UMA(policy::MetricEnrollment sample) { | 387 void EnterpriseEnrollmentHelperImpl::UMA(policy::MetricEnrollment sample) { |
385 EnrollmentUMA(sample, enrollment_config_.mode); | 388 EnrollmentUMA(sample, enrollment_config_.mode); |
386 } | 389 } |
387 | 390 |
388 void EnterpriseEnrollmentHelperImpl::OnBrowsingDataRemoverDone() { | 391 void EnterpriseEnrollmentHelperImpl::OnBrowsingDataRemoverDone() { |
389 browsing_data_remover_->RemoveObserver(this); | 392 browsing_data_remover_->RemoveObserver(this); |
390 | 393 |
391 // BrowsingDataRemover deletes itself. | 394 // BrowsingDataRemover deletes itself. |
392 browsing_data_remover_ = nullptr; | 395 browsing_data_remover_ = nullptr; |
393 | 396 |
394 auth_data_cleared_ = true; | 397 auth_data_cleared_ = true; |
395 | 398 |
396 std::vector<base::Closure> callbacks_to_run; | 399 std::vector<base::Closure> callbacks_to_run; |
397 callbacks_to_run.swap(auth_clear_callbacks_); | 400 callbacks_to_run.swap(auth_clear_callbacks_); |
398 for (std::vector<base::Closure>::iterator callback(callbacks_to_run.begin()); | 401 for (std::vector<base::Closure>::iterator callback(callbacks_to_run.begin()); |
399 callback != callbacks_to_run.end(); | 402 callback != callbacks_to_run.end(); |
400 ++callback) { | 403 ++callback) { |
401 callback->Run(); | 404 callback->Run(); |
402 } | 405 } |
403 } | 406 } |
404 | 407 |
| 408 const std::string& EnterpriseEnrollmentHelperImpl::GetOAuthToken() { |
| 409 DCHECK(oauth_fetchers_.size() > 0); |
| 410 return oauth_fetchers_[0]->oauth2_access_token(); |
| 411 } |
| 412 |
405 } // namespace chromeos | 413 } // namespace chromeos |
OLD | NEW |