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

Unified Diff: chrome/browser/chromeos/arc/auth/arc_active_directory_enrollment_token_fetcher.cc

Issue 2705213002: Show different error message if ARC is disabled. (Closed)
Patch Set: Fix browsertests and add a new test for 904 Arc Disabled Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/arc/auth/arc_active_directory_enrollment_token_fetcher.cc
diff --git a/chrome/browser/chromeos/arc/auth/arc_active_directory_enrollment_token_fetcher.cc b/chrome/browser/chromeos/arc/auth/arc_active_directory_enrollment_token_fetcher.cc
index 8a3cb3a7bbed666f676792778c3370dfa2824b62..e92fe007a92ebbaa1c4c5dac16f47186e8823af1 100644
--- a/chrome/browser/chromeos/arc/auth/arc_active_directory_enrollment_token_fetcher.cc
+++ b/chrome/browser/chromeos/arc/auth/arc_active_directory_enrollment_token_fetcher.cc
@@ -73,7 +73,8 @@ void ArcActiveDirectoryEnrollmentTokenFetcher::OnDMTokenAvailable(
if (dm_token.empty()) {
LOG(ERROR) << "Retrieving the DMToken failed.";
- base::ResetAndReturn(&callback_).Run(std::string());
+ base::ResetAndReturn(&callback_)
+ .Run(ArcAuthInfoFetchStatus::FAILURE, std::string());
return;
}
@@ -113,29 +114,38 @@ void SavePlayUserId(const std::string& user_id) {
}
void ArcActiveDirectoryEnrollmentTokenFetcher::OnFetchEnrollmentTokenCompleted(
- policy::DeviceManagementStatus status,
+ policy::DeviceManagementStatus dm_status,
int net_error,
const enterprise_management::DeviceManagementResponse& response) {
fetch_request_job_.reset();
- if (status == policy::DM_STATUS_SUCCESS &&
- (!response.has_active_directory_enroll_play_user_response())) {
- LOG(WARNING) << "Invalid Active Directory enroll Play user response.";
- status = policy::DM_STATUS_RESPONSE_DECODING_ERROR;
+ ArcAuthInfoFetchStatus fetch_status;
+ std::string enrollment_token;
+
+ switch (dm_status) {
+ case policy::DM_STATUS_SUCCESS:
+ if (!response.has_active_directory_enroll_play_user_response()) {
+ LOG(WARNING) << "Invalid Active Directory enroll Play user response.";
+ fetch_status = ArcAuthInfoFetchStatus::FAILURE;
+ break;
+ }
+ fetch_status = ArcAuthInfoFetchStatus::SUCCESS;
+ enrollment_token = response.active_directory_enroll_play_user_response()
+ .enrollment_token();
+ SavePlayUserId(
+ response.active_directory_enroll_play_user_response().user_id());
+ break;
+ case policy::DM_STATUS_SERVICE_ARC_DISABLED:
+ fetch_status = ArcAuthInfoFetchStatus::ARC_DISABLED;
+ break;
+ default: // All other error cases
+ LOG(ERROR) << "Fetching an enrollment token failed. DM Status: "
+ << dm_status;
+ fetch_status = ArcAuthInfoFetchStatus::FAILURE;
+ break;
}
- if (status != policy::DM_STATUS_SUCCESS) {
- LOG(ERROR) << "Fetching an enrollment token failed. DM Status: " << status;
- base::ResetAndReturn(&callback_).Run(std::string());
- return;
- }
-
- SavePlayUserId(
- response.active_directory_enroll_play_user_response().user_id());
-
- base::ResetAndReturn(&callback_)
- .Run(response.active_directory_enroll_play_user_response()
- .enrollment_token());
+ base::ResetAndReturn(&callback_).Run(fetch_status, enrollment_token);
}
} // namespace arc

Powered by Google App Engine
This is Rietveld 408576698