| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_session_manager.h" | 5 #include "chrome/browser/chromeos/arc/arc_session_manager.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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 // Restart ARC anyway. Let the enterprise reporting instance decide whether | 275 // Restart ARC anyway. Let the enterprise reporting instance decide whether |
| 276 // the ARC user data wipe is still required or not. | 276 // the ARC user data wipe is still required or not. |
| 277 reenable_arc_ = false; | 277 reenable_arc_ = false; |
| 278 VLOG(1) << "Reenable ARC"; | 278 VLOG(1) << "Reenable ARC"; |
| 279 EnableArc(); | 279 EnableArc(); |
| 280 } | 280 } |
| 281 | 281 |
| 282 void ArcSessionManager::OnProvisioningFinished(ProvisioningResult result) { | 282 void ArcSessionManager::OnProvisioningFinished(ProvisioningResult result) { |
| 283 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 283 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 284 | 284 |
| 285 // If the Mojo message to notify finishing the provisioning is already sent |
| 286 // from the container, it will be processed even after requesting to stop the |
| 287 // container. Ignore all |result|s arriving while ARC is disabled, in order to |
| 288 // avoid popping up an error message triggered below. This code intentionally |
| 289 // does not support the case of reenabling. |
| 290 if (!IsArcEnabled()) { |
| 291 LOG(WARNING) << "Provisioning result received after Arc was disabled. " |
| 292 << "Ignoring result " << static_cast<int>(result) << "."; |
| 293 return; |
| 294 } |
| 295 |
| 285 // Due asynchronous nature of stopping the ARC instance, | 296 // Due asynchronous nature of stopping the ARC instance, |
| 286 // OnProvisioningFinished may arrive after setting the |State::STOPPED| state | 297 // OnProvisioningFinished may arrive after setting the |State::STOPPED| state |
| 287 // and |State::Active| is not guaranteed to be set here. | 298 // and |State::Active| is not guaranteed to be set here. |
| 288 // prefs::kArcDataRemoveRequested also can be active for now. | 299 // prefs::kArcDataRemoveRequested also can be active for now. |
| 289 | 300 |
| 290 if (provisioning_reported_) { | 301 if (provisioning_reported_) { |
| 291 // We don't expect ProvisioningResult::SUCCESS is reported twice or reported | 302 // We don't expect ProvisioningResult::SUCCESS is reported twice or reported |
| 292 // after an error. | 303 // after an error. |
| 293 DCHECK_NE(result, ProvisioningResult::SUCCESS); | 304 DCHECK_NE(result, ProvisioningResult::SUCCESS); |
| 294 // TODO (khmel): Consider changing LOG to NOTREACHED once we guaranty that | 305 // TODO (khmel): Consider changing LOG to NOTREACHED once we guaranty that |
| 295 // no double message can happen in production. | 306 // no double message can happen in production. |
| 296 LOG(WARNING) << " Provisioning result was already reported. Ignoring " | 307 LOG(WARNING) << "Provisioning result was already reported. Ignoring " |
| 297 << " additional result " << static_cast<int>(result) << "."; | 308 << "additional result " << static_cast<int>(result) << "."; |
| 298 return; | 309 return; |
| 299 } | 310 } |
| 300 provisioning_reported_ = true; | 311 provisioning_reported_ = true; |
| 301 | 312 |
| 302 if (result == ProvisioningResult::CHROME_SERVER_COMMUNICATION_ERROR) { | 313 if (result == ProvisioningResult::CHROME_SERVER_COMMUNICATION_ERROR) { |
| 303 if (IsArcKioskMode()) { | 314 if (IsArcKioskMode()) { |
| 304 VLOG(1) << "Robot account auth code fetching error"; | 315 VLOG(1) << "Robot account auth code fetching error"; |
| 305 // Log out the user. All the cleanup will be done in Shutdown() method. | 316 // Log out the user. All the cleanup will be done in Shutdown() method. |
| 306 // The callback is not called because auth code is empty. | 317 // The callback is not called because auth code is empty. |
| 307 attempt_user_exit_callback_.Run(); | 318 attempt_user_exit_callback_.Run(); |
| (...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 986 return os << "ACTIVE"; | 997 return os << "ACTIVE"; |
| 987 } | 998 } |
| 988 | 999 |
| 989 // Some compiler reports an error even if all values of an enum-class are | 1000 // Some compiler reports an error even if all values of an enum-class are |
| 990 // covered indivisually in a switch statement. | 1001 // covered indivisually in a switch statement. |
| 991 NOTREACHED(); | 1002 NOTREACHED(); |
| 992 return os; | 1003 return os; |
| 993 } | 1004 } |
| 994 | 1005 |
| 995 } // namespace arc | 1006 } // namespace arc |
| OLD | NEW |