| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/ui/webui/options2/options_sync_setup_handler.h" | |
| 6 | |
| 7 #include "chrome/browser/profiles/profile.h" | |
| 8 #include "chrome/browser/sync/profile_sync_service.h" | |
| 9 | |
| 10 OptionsSyncSetupHandler::OptionsSyncSetupHandler( | |
| 11 ProfileManager* profile_manager) : SyncSetupHandler2(profile_manager) { | |
| 12 } | |
| 13 | |
| 14 OptionsSyncSetupHandler::~OptionsSyncSetupHandler() { | |
| 15 } | |
| 16 | |
| 17 void OptionsSyncSetupHandler::ShowSetupUI() { | |
| 18 ProfileSyncService* service = | |
| 19 Profile::FromWebUI(web_ui_)->GetProfileSyncService(); | |
| 20 DCHECK(service); | |
| 21 | |
| 22 // The user is trying to manually load a syncSetup URL. We should bring up | |
| 23 // either a login or a configure flow based on the state of sync. | |
| 24 if (service->HasSyncSetupCompleted()) { | |
| 25 if (service->IsPassphraseRequiredForDecryption()) { | |
| 26 service->get_wizard().Step(SyncSetupWizard::ENTER_PASSPHRASE); | |
| 27 } else { | |
| 28 service->get_wizard().Step(SyncSetupWizard::CONFIGURE); | |
| 29 } | |
| 30 } else { | |
| 31 service->get_wizard().Step(SyncSetupWizard::GetLoginState()); | |
| 32 } | |
| 33 | |
| 34 // Show the Sync Setup page. | |
| 35 scoped_ptr<Value> page(Value::CreateStringValue("syncSetup")); | |
| 36 web_ui_->CallJavascriptFunction("OptionsPage.navigateToPage", *page); | |
| 37 } | |
| OLD | NEW |