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

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

Issue 2554743003: arc: Fix double provisioning failure reporting. (Closed)
Patch Set: rebase / todo added 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 } 267 }
268 268
269 void ArcSessionManager::OnProvisioningFinished(ProvisioningResult result) { 269 void ArcSessionManager::OnProvisioningFinished(ProvisioningResult result) {
270 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 270 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
271 271
272 // Due asynchronous nature of stopping Arc bridge, OnProvisioningFinished may 272 // Due asynchronous nature of stopping Arc bridge, OnProvisioningFinished may
273 // arrive after setting the |State::STOPPED| state and |State::Active| is not 273 // arrive after setting the |State::STOPPED| state and |State::Active| is not
274 // guaranty set here. prefs::kArcDataRemoveRequested is also can be active 274 // guaranty set here. prefs::kArcDataRemoveRequested is also can be active
275 // for now. 275 // for now.
276 276
277 if (provisioning_reported_) {
278 // We don't expect ProvisioningResult::SUCCESS is reported twice or reported
279 // after an error.
280 DCHECK_NE(result, ProvisioningResult::SUCCESS);
281 // TODO (khmel): Consider changing LOG to NOTREACHED once we guaranty that
282 // no double message can happen in production.
283 LOG(WARNING) << " Provisioning result was already reported. Ignoring "
284 << " additional result " << static_cast<int>(result) << ".";
285 return;
286 }
287 provisioning_reported_ = true;
288
277 if (result == ProvisioningResult::CHROME_SERVER_COMMUNICATION_ERROR) { 289 if (result == ProvisioningResult::CHROME_SERVER_COMMUNICATION_ERROR) {
278 if (IsArcKioskMode()) { 290 if (IsArcKioskMode()) {
279 VLOG(1) << "Robot account auth code fetching error"; 291 VLOG(1) << "Robot account auth code fetching error";
280 // Log out the user. All the cleanup will be done in Shutdown() method. 292 // Log out the user. All the cleanup will be done in Shutdown() method.
281 // The callback is not called because auth code is empty. 293 // The callback is not called because auth code is empty.
282 chrome::AttemptUserExit(); 294 chrome::AttemptUserExit();
283 return; 295 return;
284 } 296 }
285 297
286 // For backwards compatibility, use NETWORK_ERROR for 298 // For backwards compatibility, use NETWORK_ERROR for
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 reenable_arc_ = true; 642 reenable_arc_ = true;
631 StopArc(); 643 StopArc();
632 } 644 }
633 645
634 void ArcSessionManager::StartArc() { 646 void ArcSessionManager::StartArc() {
635 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 647 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
636 648
637 // Arc must be started only if no pending data removal request exists. 649 // Arc must be started only if no pending data removal request exists.
638 DCHECK(!profile_->GetPrefs()->GetBoolean(prefs::kArcDataRemoveRequested)); 650 DCHECK(!profile_->GetPrefs()->GetBoolean(prefs::kArcDataRemoveRequested));
639 651
652 provisioning_reported_ = false;
653
640 arc_bridge_service()->RequestStart(); 654 arc_bridge_service()->RequestStart();
641 SetState(State::ACTIVE); 655 SetState(State::ACTIVE);
642 } 656 }
643 657
644 void ArcSessionManager::OnArcSignInTimeout() { 658 void ArcSessionManager::OnArcSignInTimeout() {
645 LOG(ERROR) << "Timed out waiting for first sign in."; 659 LOG(ERROR) << "Timed out waiting for first sign in.";
646 OnProvisioningFinished(ProvisioningResult::OVERALL_SIGN_IN_TIMEOUT); 660 OnProvisioningFinished(ProvisioningResult::OVERALL_SIGN_IN_TIMEOUT);
647 } 661 }
648 662
649 void ArcSessionManager::CancelAuthCode() { 663 void ArcSessionManager::CancelAuthCode() {
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 return os << "ACTIVE"; 915 return os << "ACTIVE";
902 } 916 }
903 917
904 // Some compiler reports an error even if all values of an enum-class are 918 // Some compiler reports an error even if all values of an enum-class are
905 // covered indivisually in a switch statement. 919 // covered indivisually in a switch statement.
906 NOTREACHED(); 920 NOTREACHED();
907 return os; 921 return os;
908 } 922 }
909 923
910 } // namespace arc 924 } // 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