| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/arc/arc_auth_service.h" | 5 #include "chrome/browser/chromeos/arc/arc_auth_service.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "ash/common/shelf/shelf_delegate.h" | 9 #include "ash/common/shelf/shelf_delegate.h" |
| 10 #include "ash/common/wm_shell.h" | 10 #include "ash/common/wm_shell.h" |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 } | 447 } |
| 448 | 448 |
| 449 void ArcAuthService::OnContextPrepared( | 449 void ArcAuthService::OnContextPrepared( |
| 450 net::URLRequestContextGetter* request_context_getter) { | 450 net::URLRequestContextGetter* request_context_getter) { |
| 451 if (!support_host_) | 451 if (!support_host_) |
| 452 return; | 452 return; |
| 453 | 453 |
| 454 if (request_context_getter) { | 454 if (request_context_getter) { |
| 455 support_host_->ShowLso(); | 455 support_host_->ShowLso(); |
| 456 } else { | 456 } else { |
| 457 UpdateOptInCancelUMA(OptInCancelReason::NETWORK_ERROR); |
| 457 support_host_->ShowError(ArcSupportHost::Error::SIGN_IN_NETWORK_ERROR, | 458 support_host_->ShowError(ArcSupportHost::Error::SIGN_IN_NETWORK_ERROR, |
| 458 false); | 459 false); |
| 459 } | 460 } |
| 460 } | 461 } |
| 461 | 462 |
| 462 void ArcAuthService::OnRobotAuthCodeFetched( | 463 void ArcAuthService::OnRobotAuthCodeFetched( |
| 463 const std::string& robot_auth_code) { | 464 const std::string& robot_auth_code) { |
| 464 // We fetching robot auth code for ARC kiosk only. | 465 // We fetching robot auth code for ARC kiosk only. |
| 465 DCHECK(IsArcKioskMode()); | 466 DCHECK(IsArcKioskMode()); |
| 466 | 467 |
| (...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1104 preference_handler_->EnableLocationService(is_location_service_enabled); | 1105 preference_handler_->EnableLocationService(is_location_service_enabled); |
| 1105 support_host_->ShowArcLoading(); | 1106 support_host_->ShowArcLoading(); |
| 1106 StartArcAndroidManagementCheck(); | 1107 StartArcAndroidManagementCheck(); |
| 1107 } | 1108 } |
| 1108 | 1109 |
| 1109 void ArcAuthService::OnAuthSucceeded(const std::string& auth_code) { | 1110 void ArcAuthService::OnAuthSucceeded(const std::string& auth_code) { |
| 1110 DCHECK(support_host_); | 1111 DCHECK(support_host_); |
| 1111 OnAuthCodeObtained(auth_code); | 1112 OnAuthCodeObtained(auth_code); |
| 1112 } | 1113 } |
| 1113 | 1114 |
| 1115 void ArcAuthService::OnAuthFailed() { |
| 1116 // Don't report via callback. Extension is already showing more detailed |
| 1117 // information. Update only UMA here. |
| 1118 UpdateOptInCancelUMA(OptInCancelReason::NETWORK_ERROR); |
| 1119 } |
| 1120 |
| 1114 void ArcAuthService::OnRetryClicked() { | 1121 void ArcAuthService::OnRetryClicked() { |
| 1115 DCHECK(support_host_); | 1122 DCHECK(support_host_); |
| 1116 | 1123 |
| 1117 UpdateOptInActionUMA(OptInActionType::RETRY); | 1124 UpdateOptInActionUMA(OptInActionType::RETRY); |
| 1118 | 1125 |
| 1119 // TODO(hidehiko): Simplify the retry logic. | 1126 // TODO(hidehiko): Simplify the retry logic. |
| 1120 if (!profile_->GetPrefs()->GetBoolean(prefs::kArcTermsAccepted)) { | 1127 if (!profile_->GetPrefs()->GetBoolean(prefs::kArcTermsAccepted)) { |
| 1121 // If the user has not yet agreed on Terms of Service, then show it. | 1128 // If the user has not yet agreed on Terms of Service, then show it. |
| 1122 support_host_->ShowTermsOfService(); | 1129 support_host_->ShowTermsOfService(); |
| 1123 } else if (support_host_->ui_page() == ArcSupportHost::UIPage::ERROR && | 1130 } else if (support_host_->ui_page() == ArcSupportHost::UIPage::ERROR && |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1183 return os << "ACTIVE"; | 1190 return os << "ACTIVE"; |
| 1184 } | 1191 } |
| 1185 | 1192 |
| 1186 // Some compiler reports an error even if all values of an enum-class are | 1193 // Some compiler reports an error even if all values of an enum-class are |
| 1187 // covered indivisually in a switch statement. | 1194 // covered indivisually in a switch statement. |
| 1188 NOTREACHED(); | 1195 NOTREACHED(); |
| 1189 return os; | 1196 return os; |
| 1190 } | 1197 } |
| 1191 | 1198 |
| 1192 } // namespace arc | 1199 } // namespace arc |
| OLD | NEW |