| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_auth_service.h" | 5 #include "chrome/browser/chromeos/arc/arc_auth_service.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 } else { | 467 } else { |
| 468 StartArc(); | 468 StartArc(); |
| 469 } | 469 } |
| 470 } | 470 } |
| 471 | 471 |
| 472 UpdateEnabledStateUMA(true); | 472 UpdateEnabledStateUMA(true); |
| 473 } | 473 } |
| 474 | 474 |
| 475 void ArcAuthService::ShutdownBridge() { | 475 void ArcAuthService::ShutdownBridge() { |
| 476 playstore_launcher_.reset(); | 476 playstore_launcher_.reset(); |
| 477 auth_callback_.reset(); | 477 auth_callback_.Reset(); |
| 478 ubertoken_fetcher_.reset(); | 478 ubertoken_fetcher_.reset(); |
| 479 merger_fetcher_.reset(); | 479 merger_fetcher_.reset(); |
| 480 arc_bridge_service()->Shutdown(); | 480 arc_bridge_service()->Shutdown(); |
| 481 if (state_ != State::NOT_INITIALIZED) | 481 if (state_ != State::NOT_INITIALIZED) |
| 482 SetState(State::STOPPED); | 482 SetState(State::STOPPED); |
| 483 FOR_EACH_OBSERVER(Observer, observer_list_, OnShutdownBridge()); | 483 FOR_EACH_OBSERVER(Observer, observer_list_, OnShutdownBridge()); |
| 484 } | 484 } |
| 485 | 485 |
| 486 void ArcAuthService::ShutdownBridgeAndCloseUI() { | 486 void ArcAuthService::ShutdownBridgeAndCloseUI() { |
| 487 ShutdownBridge(); | 487 ShutdownBridge(); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 } | 525 } |
| 526 | 526 |
| 527 void ArcAuthService::SetAuthCodeAndStartArc(const std::string& auth_code) { | 527 void ArcAuthService::SetAuthCodeAndStartArc(const std::string& auth_code) { |
| 528 DCHECK(thread_checker.Get().CalledOnValidThread()); | 528 DCHECK(thread_checker.Get().CalledOnValidThread()); |
| 529 DCHECK(!auth_code.empty()); | 529 DCHECK(!auth_code.empty()); |
| 530 | 530 |
| 531 if (!auth_callback_.is_null()) { | 531 if (!auth_callback_.is_null()) { |
| 532 DCHECK_EQ(state_, State::FETCHING_CODE); | 532 DCHECK_EQ(state_, State::FETCHING_CODE); |
| 533 SetState(State::ACTIVE); | 533 SetState(State::ACTIVE); |
| 534 auth_callback_.Run(mojo::String(auth_code), !IsOptInVerificationDisabled()); | 534 auth_callback_.Run(mojo::String(auth_code), !IsOptInVerificationDisabled()); |
| 535 auth_callback_.reset(); | 535 auth_callback_.Reset(); |
| 536 return; | 536 return; |
| 537 } | 537 } |
| 538 | 538 |
| 539 State state = state_; | 539 State state = state_; |
| 540 if (state != State::FETCHING_CODE) { | 540 if (state != State::FETCHING_CODE) { |
| 541 ShutdownBridgeAndCloseUI(); | 541 ShutdownBridgeAndCloseUI(); |
| 542 return; | 542 return; |
| 543 } | 543 } |
| 544 | 544 |
| 545 SetUIPage(UIPage::START_PROGRESS, base::string16()); | 545 SetUIPage(UIPage::START_PROGRESS, base::string16()); |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 return os << kStateFetchingCode; | 695 return os << kStateFetchingCode; |
| 696 case ArcAuthService::State::ACTIVE: | 696 case ArcAuthService::State::ACTIVE: |
| 697 return os << kStateActive; | 697 return os << kStateActive; |
| 698 default: | 698 default: |
| 699 NOTREACHED(); | 699 NOTREACHED(); |
| 700 return os; | 700 return os; |
| 701 } | 701 } |
| 702 } | 702 } |
| 703 | 703 |
| 704 } // namespace arc | 704 } // namespace arc |
| OLD | NEW |