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, AsWeakPtr())); |
161 } | 162 } |
162 } | 163 } |
163 | 164 |
164 void LoginPerformer::OnProfileCreated(Profile* profile, Status status) { | 165 void LoginPerformer::OnProfileCreated( |
| 166 Profile* profile, |
| 167 Profile::CreateStatus status) { |
165 CHECK(profile); | 168 CHECK(profile); |
166 switch (status) { | 169 switch (status) { |
167 case STATUS_INITIALIZED: | 170 case Profile::CREATE_STATUS_INITIALIZED: |
168 break; | 171 break; |
169 case STATUS_CREATED: | 172 case Profile::CREATE_STATUS_CREATED: |
170 return; | 173 return; |
171 case STATUS_FAIL: | 174 case Profile::CREATE_STATUS_FAIL: |
172 default: | 175 default: |
173 NOTREACHED(); | 176 NOTREACHED(); |
174 return; | 177 return; |
175 } | 178 } |
176 | 179 |
177 if (using_oauth_) | 180 if (using_oauth_) |
178 LoginUtils::Get()->StartTokenServices(profile); | 181 LoginUtils::Get()->StartTokenServices(profile); |
179 | 182 |
180 LoginUtils::Get()->StartSync(profile, credentials_); | 183 LoginUtils::Get()->StartSync(profile, credentials_); |
181 credentials_ = GaiaAuthConsumer::ClientLoginResult(); | 184 credentials_ = GaiaAuthConsumer::ClientLoginResult(); |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 profile, | 549 profile, |
547 username_, | 550 username_, |
548 password_, | 551 password_, |
549 captcha_token_, | 552 captcha_token_, |
550 captcha_)); | 553 captcha_)); |
551 } | 554 } |
552 password_.clear(); | 555 password_.clear(); |
553 } | 556 } |
554 | 557 |
555 } // namespace chromeos | 558 } // namespace chromeos |
OLD | NEW |