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/chromeos/login/login_performer.h" | 5 #include "chrome/browser/chromeos/login/login_performer.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 pending_requests, | 150 pending_requests, |
151 using_oauth); | 151 using_oauth); |
152 return; | 152 return; |
153 } else { | 153 } else { |
154 // Online login has succeeded. | 154 // Online login has succeeded. |
155 DCHECK(!pending_requests) | 155 DCHECK(!pending_requests) |
156 << "Pending request w/o delegate_ should not happen!"; | 156 << "Pending request w/o delegate_ should not happen!"; |
157 // It is not guaranted, that profile creation has been finished yet. So use | 157 // It is not guaranted, that profile creation has been finished yet. So use |
158 // async version here. | 158 // async version here. |
159 credentials_ = credentials; | 159 credentials_ = credentials; |
160 ProfileManager::CreateDefaultProfileAsync(this); | 160 ProfileManager::CreateDefaultProfileAsync( |
| 161 base::Bind(&LoginPerformer::OnProfileCreated, |
| 162 weak_factory_.GetWeakPtr())); |
161 } | 163 } |
162 } | 164 } |
163 | 165 |
164 void LoginPerformer::OnProfileCreated(Profile* profile, Status status) { | 166 void LoginPerformer::OnProfileCreated( |
| 167 Profile* profile, |
| 168 Profile::CreateStatus status) { |
165 CHECK(profile); | 169 CHECK(profile); |
166 switch (status) { | 170 switch (status) { |
167 case STATUS_INITIALIZED: | 171 case Profile::CREATE_STATUS_INITIALIZED: |
168 break; | 172 break; |
169 case STATUS_CREATED: | 173 case Profile::CREATE_STATUS_CREATED: |
170 return; | 174 return; |
171 case STATUS_FAIL: | 175 case Profile::CREATE_STATUS_FAIL: |
172 default: | 176 default: |
173 NOTREACHED(); | 177 NOTREACHED(); |
174 return; | 178 return; |
175 } | 179 } |
176 | 180 |
177 if (using_oauth_) | 181 if (using_oauth_) |
178 LoginUtils::Get()->StartTokenServices(profile); | 182 LoginUtils::Get()->StartTokenServices(profile); |
179 | 183 |
180 LoginUtils::Get()->StartSync(profile, credentials_); | 184 LoginUtils::Get()->StartSync(profile, credentials_); |
181 credentials_ = GaiaAuthConsumer::ClientLoginResult(); | 185 credentials_ = GaiaAuthConsumer::ClientLoginResult(); |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 profile, | 550 profile, |
547 username_, | 551 username_, |
548 password_, | 552 password_, |
549 captcha_token_, | 553 captcha_token_, |
550 captcha_)); | 554 captcha_)); |
551 } | 555 } |
552 password_.clear(); | 556 password_.clear(); |
553 } | 557 } |
554 | 558 |
555 } // namespace chromeos | 559 } // namespace chromeos |
OLD | NEW |