| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/webui/options/sync_setup_handler.h" | 5 #include "chrome/browser/ui/webui/options/sync_setup_handler.h" |
| 6 | 6 |
| 7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
| 8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/google/google_util.h" | 10 #include "chrome/browser/google/google_util.h" |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 | 461 |
| 462 // If the wizard is already visible, focus it. | 462 // If the wizard is already visible, focus it. |
| 463 if (service->get_wizard().IsVisible()) { | 463 if (service->get_wizard().IsVisible()) { |
| 464 web_ui_->CallJavascriptFunction("OptionsPage.closeOverlay"); | 464 web_ui_->CallJavascriptFunction("OptionsPage.closeOverlay"); |
| 465 service->get_wizard().Focus(); | 465 service->get_wizard().Focus(); |
| 466 return; | 466 return; |
| 467 } | 467 } |
| 468 | 468 |
| 469 // The user is trying to manually load a syncSetup URL. We should bring up | 469 // The user is trying to manually load a syncSetup URL. We should bring up |
| 470 // either a login or a configure flow based on the state of sync. | 470 // either a login or a configure flow based on the state of sync. |
| 471 if (service->HasSyncSetupCompleted()) | 471 if (service->HasSyncSetupCompleted()) { |
| 472 service->get_wizard().Step(SyncSetupWizard::CONFIGURE); | 472 if (service->IsPassphraseRequiredForDecryption()) { |
| 473 else | 473 service->get_wizard().Step(SyncSetupWizard::ENTER_PASSPHRASE); |
| 474 } else { |
| 475 service->get_wizard().Step(SyncSetupWizard::CONFIGURE); |
| 476 } |
| 477 } else { |
| 474 service->get_wizard().Step(SyncSetupWizard::GAIA_LOGIN); | 478 service->get_wizard().Step(SyncSetupWizard::GAIA_LOGIN); |
| 479 } |
| 475 | 480 |
| 476 // Show the Sync Setup page. | 481 // Show the Sync Setup page. |
| 477 scoped_ptr<Value> page(Value::CreateStringValue("syncSetup")); | 482 scoped_ptr<Value> page(Value::CreateStringValue("syncSetup")); |
| 478 web_ui_->CallJavascriptFunction("OptionsPage.navigateToPage", *page); | 483 web_ui_->CallJavascriptFunction("OptionsPage.navigateToPage", *page); |
| 479 } | 484 } |
| OLD | NEW |