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

Side by Side Diff: chrome/browser/chromeos/arc/arc_session_manager.cc

Issue 2554743003: arc: Fix double provisioning failure reporting. (Closed)
Patch Set: add unit test and comments addressed Created 4 years 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 unified diff | Download patch
OLDNEW
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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 239
240 // Restart ARC anyway. Let the enterprise reporting instance decide whether 240 // Restart ARC anyway. Let the enterprise reporting instance decide whether
241 // the ARC user data wipe is still required or not. 241 // the ARC user data wipe is still required or not.
242 reenable_arc_ = false; 242 reenable_arc_ = false;
243 VLOG(1) << "Reenable ARC"; 243 VLOG(1) << "Reenable ARC";
244 EnableArc(); 244 EnableArc();
245 } 245 }
246 246
247 void ArcSessionManager::OnProvisioningFinished(ProvisioningResult result) { 247 void ArcSessionManager::OnProvisioningFinished(ProvisioningResult result) {
248 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 248 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
249
250 if (provisioning_reported_) {
251 // We don't expect ProvisioningResult::SUCCESS is reported twice or reported
252 // after an error.
253 DCHECK_NE(result, ProvisioningResult::SUCCESS);
254 LOG(WARNING) << " Provisioning result was already reported. Ignoring "
hidehiko 2016/12/06 18:50:01 I'm ok with the current code for the short term fi
khmel 2016/12/06 22:49:57 Done.
255 << " additional result " << static_cast<int>(result) << ".";
256 return;
257 }
258 provisioning_reported_ = true;
259
249 DCHECK_EQ(state_, State::ACTIVE); 260 DCHECK_EQ(state_, State::ACTIVE);
250 261
251 if (result == ProvisioningResult::CHROME_SERVER_COMMUNICATION_ERROR) { 262 if (result == ProvisioningResult::CHROME_SERVER_COMMUNICATION_ERROR) {
252 if (IsArcKioskMode()) { 263 if (IsArcKioskMode()) {
253 VLOG(1) << "Robot account auth code fetching error"; 264 VLOG(1) << "Robot account auth code fetching error";
254 // Log out the user. All the cleanup will be done in Shutdown() method. 265 // Log out the user. All the cleanup will be done in Shutdown() method.
255 // The callback is not called because auth code is empty. 266 // The callback is not called because auth code is empty.
256 chrome::AttemptUserExit(); 267 chrome::AttemptUserExit();
257 return; 268 return;
258 } 269 }
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 // TODO(hidehiko): Remove this. 595 // TODO(hidehiko): Remove this.
585 void ArcSessionManager::StopAndEnableArc() { 596 void ArcSessionManager::StopAndEnableArc() {
586 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 597 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
587 DCHECK(!arc_bridge_service()->stopped()); 598 DCHECK(!arc_bridge_service()->stopped());
588 reenable_arc_ = true; 599 reenable_arc_ = true;
589 StopArc(); 600 StopArc();
590 } 601 }
591 602
592 void ArcSessionManager::StartArc() { 603 void ArcSessionManager::StartArc() {
593 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 604 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
605 provisioning_reported_ = false;
594 arc_bridge_service()->RequestStart(); 606 arc_bridge_service()->RequestStart();
595 SetState(State::ACTIVE); 607 SetState(State::ACTIVE);
596 } 608 }
597 609
598 void ArcSessionManager::OnArcSignInTimeout() { 610 void ArcSessionManager::OnArcSignInTimeout() {
599 LOG(ERROR) << "Timed out waiting for first sign in."; 611 LOG(ERROR) << "Timed out waiting for first sign in.";
600 OnProvisioningFinished(ProvisioningResult::OVERALL_SIGN_IN_TIMEOUT); 612 OnProvisioningFinished(ProvisioningResult::OVERALL_SIGN_IN_TIMEOUT);
601 } 613 }
602 614
603 void ArcSessionManager::CancelAuthCode() { 615 void ArcSessionManager::CancelAuthCode() {
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 return os << "ACTIVE"; 865 return os << "ACTIVE";
854 } 866 }
855 867
856 // Some compiler reports an error even if all values of an enum-class are 868 // Some compiler reports an error even if all values of an enum-class are
857 // covered indivisually in a switch statement. 869 // covered indivisually in a switch statement.
858 NOTREACHED(); 870 NOTREACHED();
859 return os; 871 return os;
860 } 872 }
861 873
862 } // namespace arc 874 } // namespace arc
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/arc/arc_session_manager.h ('k') | chrome/browser/chromeos/arc/arc_session_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698