Index: chrome/browser/policy/cloud_policy_controller.cc |
diff --git a/chrome/browser/policy/cloud_policy_controller.cc b/chrome/browser/policy/cloud_policy_controller.cc |
index 25c340e750e01f9b12805907c182bbda48a688b0..ed50b56f3c5b36f1f6e734a736c9581ef2a6b99d 100644 |
--- a/chrome/browser/policy/cloud_policy_controller.cc |
+++ b/chrome/browser/policy/cloud_policy_controller.cc |
@@ -167,6 +167,9 @@ void CloudPolicyController::OnDeviceTokenChanged() { |
} |
void CloudPolicyController::OnCredentialsChanged() { |
+ notifier_->Inform(CloudPolicySubsystem::UNENROLLED, |
+ CloudPolicySubsystem::NO_DETAILS, |
+ PolicyNotifier::POLICY_CONTROLLER); |
effective_policy_refresh_error_delay_ms_ = policy_refresh_error_delay_ms_; |
SetState(STATE_TOKEN_UNAVAILABLE); |
} |
@@ -235,10 +238,13 @@ void CloudPolicyController::FetchToken() { |
std::string machine_model = identity_strategy_->GetMachineModel(); |
em::DeviceRegisterRequest_Type policy_type = |
identity_strategy_->GetPolicyRegisterType(); |
- if (identity_strategy_->GetCredentials(&username, &auth_token) && |
- CanBeInManagedDomain(username)) { |
- token_fetcher_->FetchToken(auth_token, device_id, policy_type, |
- machine_id, machine_model); |
+ if (identity_strategy_->GetCredentials(&username, &auth_token)) { |
+ if (CanBeInManagedDomain(username)) { |
+ token_fetcher_->FetchToken(auth_token, device_id, policy_type, |
+ machine_id, machine_model); |
+ } else { |
+ SetState(STATE_TOKEN_UNMANAGED); |
+ } |
} |
} |