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

Side by Side Diff: chrome/browser/ui/webui/options/options_sync_setup_handler.cc

Issue 9169096: Remove a bunch of GetProfileSyncService callers to use the new factory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rm todos Created 8 years, 11 months 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 | Annotate | Revision Log
OLDNEW
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/options_sync_setup_handler.h" 5 #include "chrome/browser/ui/webui/options/options_sync_setup_handler.h"
6 6
7 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/sync/profile_sync_service.h" 8 #include "chrome/browser/sync/profile_sync_service.h"
9 #include "chrome/browser/sync/profile_sync_service_factory.h"
9 #include "content/public/browser/web_ui.h" 10 #include "content/public/browser/web_ui.h"
10 11
11 OptionsSyncSetupHandler::OptionsSyncSetupHandler( 12 OptionsSyncSetupHandler::OptionsSyncSetupHandler(
12 ProfileManager* profile_manager) : SyncSetupHandler(profile_manager) { 13 ProfileManager* profile_manager) : SyncSetupHandler(profile_manager) {
13 } 14 }
14 15
15 OptionsSyncSetupHandler::~OptionsSyncSetupHandler() { 16 OptionsSyncSetupHandler::~OptionsSyncSetupHandler() {
16 } 17 }
17 18
18 void OptionsSyncSetupHandler::StepWizardForShowSetupUI() { 19 void OptionsSyncSetupHandler::StepWizardForShowSetupUI() {
19 ProfileSyncService* service = 20 ProfileSyncService* service(ProfileSyncServiceFactory::
20 Profile::FromWebUI(web_ui())->GetProfileSyncService(); 21 GetInstance()->GetForProfile(Profile::FromWebUI(web_ui())));
21 DCHECK(service); 22 DCHECK(service);
22 23
23 // We should bring up either a login or a configure flow based on the state of 24 // We should bring up either a login or a configure flow based on the state of
24 // sync. 25 // sync.
25 if (service->HasSyncSetupCompleted()) { 26 if (service->HasSyncSetupCompleted()) {
26 if (service->IsPassphraseRequiredForDecryption()) { 27 if (service->IsPassphraseRequiredForDecryption()) {
27 service->get_wizard().Step(SyncSetupWizard::ENTER_PASSPHRASE); 28 service->get_wizard().Step(SyncSetupWizard::ENTER_PASSPHRASE);
28 } else { 29 } else {
29 service->get_wizard().Step(SyncSetupWizard::CONFIGURE); 30 service->get_wizard().Step(SyncSetupWizard::CONFIGURE);
30 } 31 }
31 } else { 32 } else {
32 service->get_wizard().Step(SyncSetupWizard::GetLoginState()); 33 service->get_wizard().Step(SyncSetupWizard::GetLoginState());
33 } 34 }
34 } 35 }
35 36
36 void OptionsSyncSetupHandler::ShowSetupUI() { 37 void OptionsSyncSetupHandler::ShowSetupUI() {
37 // Show the Sync Setup page. 38 // Show the Sync Setup page.
38 scoped_ptr<Value> page(Value::CreateStringValue("syncSetup")); 39 scoped_ptr<Value> page(Value::CreateStringValue("syncSetup"));
39 web_ui()->CallJavascriptFunction("OptionsPage.navigateToPage", *page); 40 web_ui()->CallJavascriptFunction("OptionsPage.navigateToPage", *page);
40 } 41 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/ntp/ntp_resource_cache.cc ('k') | chrome/browser/ui/webui/options/personal_options_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698