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

Side by Side Diff: chrome/browser/sync/sync_setup_flow.cc

Issue 8665011: sync: remove GetAuthenticatedUsername from ProfileSyncService/SyncBackendHost. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test Created 9 years 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/sync/sync_setup_flow.h" 5 #include "chrome/browser/sync/sync_setup_flow.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 // static 96 // static
97 void SyncSetupFlow::GetArgsForGaiaLogin(const ProfileSyncService* service, 97 void SyncSetupFlow::GetArgsForGaiaLogin(const ProfileSyncService* service,
98 DictionaryValue* args) { 98 DictionaryValue* args) {
99 const GoogleServiceAuthError& error = service->GetAuthError(); 99 const GoogleServiceAuthError& error = service->GetAuthError();
100 if (!service->last_attempted_user_email().empty()) { 100 if (!service->last_attempted_user_email().empty()) {
101 args->SetString("user", service->last_attempted_user_email()); 101 args->SetString("user", service->last_attempted_user_email());
102 args->SetInteger("error", error.state()); 102 args->SetInteger("error", error.state());
103 args->SetBoolean("editable_user", true); 103 args->SetBoolean("editable_user", true);
104 } else { 104 } else {
105 string16 user; 105 string16 user;
106 if (!service->cros_user().empty()) 106 user = UTF8ToUTF16(service->profile()->GetPrefs()->GetString(
107 user = UTF8ToUTF16(service->cros_user()); 107 prefs::kGoogleServicesUsername));
Andrew T Wilson (Slow) 2011/11/24 01:48:16 I'm slightly nervous about this, as it's not 100%
tim (not reviewing) 2011/11/24 03:59:42 But in that case the username has to stay the same
Andrew T Wilson (Slow) 2011/11/24 17:14:08 OK, if you're saying the user always has the optio
108 else
109 user = service->GetAuthenticatedUsername();
110 args->SetString("user", user); 108 args->SetString("user", user);
111 args->SetInteger("error", 0); 109 args->SetInteger("error", 0);
112 args->SetBoolean("editable_user", user.empty()); 110 args->SetBoolean("editable_user", user.empty());
113 } 111 }
114 112
115 args->SetString("captchaUrl", error.captcha().image_url.spec()); 113 args->SetString("captchaUrl", error.captcha().image_url.spec());
116 } 114 }
117 115
118 void SyncSetupFlow::GetArgsForConfigure(ProfileSyncService* service, 116 void SyncSetupFlow::GetArgsForConfigure(ProfileSyncService* service,
119 DictionaryValue* args) { 117 DictionaryValue* args) {
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 // display the error appropriately (http://crbug.com/92722). 487 // display the error appropriately (http://crbug.com/92722).
490 DictionaryValue args; 488 DictionaryValue args;
491 SyncSetupFlow::GetArgsForGaiaLogin(service_, &args); 489 SyncSetupFlow::GetArgsForGaiaLogin(service_, &args);
492 args.SetBoolean("fatalError", true); 490 args.SetBoolean("fatalError", true);
493 current_state_ = SyncSetupWizard::GAIA_LOGIN; 491 current_state_ = SyncSetupWizard::GAIA_LOGIN;
494 flow_handler_->ShowGaiaLogin(args); 492 flow_handler_->ShowGaiaLogin(args);
495 break; 493 break;
496 } 494 }
497 case SyncSetupWizard::DONE: 495 case SyncSetupWizard::DONE:
498 case SyncSetupWizard::ABORT: 496 case SyncSetupWizard::ABORT:
499 flow_handler_->ShowSetupDone(service_->GetAuthenticatedUsername()); 497 flow_handler_->ShowSetupDone(UTF8ToUTF16(
498 service_->profile()->GetPrefs()->GetString(
499 prefs::kGoogleServicesUsername)));
500 break; 500 break;
501 default: 501 default:
502 NOTREACHED() << "Invalid advance state: " << state; 502 NOTREACHED() << "Invalid advance state: " << state;
503 } 503 }
504 } 504 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698