Index: chrome/browser/chromeos/login/screens/controller_pairing_screen.cc |
diff --git a/chrome/browser/chromeos/login/screens/controller_pairing_screen.cc b/chrome/browser/chromeos/login/screens/controller_pairing_screen.cc |
index 382ad45be58bd495837f7866c32e744b537f24dd..e34e16966bfaccf222f35aeeac2b2be45be72aa6 100644 |
--- a/chrome/browser/chromeos/login/screens/controller_pairing_screen.cc |
+++ b/chrome/browser/chromeos/login/screens/controller_pairing_screen.cc |
@@ -12,10 +12,6 @@ |
using namespace chromeos::controller_pairing; |
using namespace pairing_chromeos; |
-namespace { |
-const char* kTestAuthToken = "TestAuthToken"; |
-}; |
- |
namespace chromeos { |
ControllerPairingScreen::ControllerPairingScreen( |
@@ -25,6 +21,7 @@ ControllerPairingScreen::ControllerPairingScreen( |
: WizardScreen(observer), |
actor_(actor), |
controller_(controller), |
+ observing_controller_(true), |
current_stage_(ControllerPairingController::STAGE_NONE), |
device_preselected_(false) { |
actor_->SetDelegate(this); |
@@ -34,7 +31,8 @@ ControllerPairingScreen::ControllerPairingScreen( |
ControllerPairingScreen::~ControllerPairingScreen() { |
if (actor_) |
actor_->SetDelegate(NULL); |
- controller_->RemoveObserver(this); |
+ if (observing_controller_) |
+ controller_->RemoveObserver(this); |
dzhioev (left Google)
2014/09/09 02:46:51
nit: it is safe to try to remove observer, that is
Zachary Kuznia
2014/09/09 23:53:58
Done.
|
} |
void ControllerPairingScreen::CommitContextChanges() { |
@@ -75,6 +73,7 @@ std::string ControllerPairingScreen::GetName() const { |
// Overridden from ControllerPairingController::Observer: |
void ControllerPairingScreen::PairingStageChanged(Stage new_stage) { |
DCHECK(new_stage != current_stage_); |
+ DCHECK(observing_controller_); |
std::string desired_page; |
switch (new_stage) { |
@@ -112,6 +111,11 @@ void ControllerPairingScreen::PairingStageChanged(Stage new_stage) { |
break; |
} |
case ControllerPairingController::STAGE_WAITING_FOR_CREDENTIALS: { |
+ observing_controller_ = false; |
+ controller_->RemoveObserver(this); |
+ get_screen_observer()->OnExit( |
+ WizardController::CONTROLLER_PAIRING_FINISHED); |
+ // TODO: Move the rest of the stages to the proper location. |
desired_page = kPageEnrollmentIntroduction; |
break; |
} |
@@ -200,8 +204,6 @@ void ControllerPairingScreen::OnUserActed(const std::string& action) { |
gaia::SanitizeEmail(context_.GetString(kContextKeyAccountId)); |
const std::string domain(gaia::ExtractDomainName(account_id)); |
context_.SetString(kContextKeyEnrollmentDomain, domain); |
- // TODO(zork): Get proper credentials. (http://crbug.com/405744) |
- controller_->OnAuthenticationDone(domain, kTestAuthToken); |
} else if (action == kActionStartSession) { |
controller_->StartSession(); |
} |