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

Side by Side Diff: chrome/browser/chromeos/login/parallel_authenticator.cc

Issue 8342048: Make NotificationService an interface in the content namespace, and switch callers to use it. Mov... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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/chromeos/login/parallel_authenticator.h" 5 #include "chrome/browser/chromeos/login/parallel_authenticator.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 14 matching lines...) Expand all
25 #include "chrome/browser/chromeos/login/ownership_service.h" 25 #include "chrome/browser/chromeos/login/ownership_service.h"
26 #include "chrome/browser/chromeos/login/user_manager.h" 26 #include "chrome/browser/chromeos/login/user_manager.h"
27 #include "chrome/browser/profiles/profile.h" 27 #include "chrome/browser/profiles/profile.h"
28 #include "chrome/browser/profiles/profile_manager.h" 28 #include "chrome/browser/profiles/profile_manager.h"
29 #include "chrome/common/chrome_notification_types.h" 29 #include "chrome/common/chrome_notification_types.h"
30 #include "chrome/common/chrome_paths.h" 30 #include "chrome/common/chrome_paths.h"
31 #include "chrome/common/chrome_switches.h" 31 #include "chrome/common/chrome_switches.h"
32 #include "chrome/common/net/gaia/gaia_auth_fetcher.h" 32 #include "chrome/common/net/gaia/gaia_auth_fetcher.h"
33 #include "chrome/common/net/gaia/gaia_constants.h" 33 #include "chrome/common/net/gaia/gaia_constants.h"
34 #include "content/browser/browser_thread.h" 34 #include "content/browser/browser_thread.h"
35 #include "content/common/notification_service.h" 35 #include "content/public/browser/notification_service.h"
36 #include "crypto/encryptor.h" 36 #include "crypto/encryptor.h"
37 #include "crypto/sha2.h" 37 #include "crypto/sha2.h"
38 #include "crypto/symmetric_key.h" 38 #include "crypto/symmetric_key.h"
39 #include "net/base/load_flags.h" 39 #include "net/base/load_flags.h"
40 #include "net/base/net_errors.h" 40 #include "net/base/net_errors.h"
41 #include "net/url_request/url_request_status.h" 41 #include "net/url_request/url_request_status.h"
42 #include "third_party/libjingle/source/talk/base/urlencode.h" 42 #include "third_party/libjingle/source/talk/base/urlencode.h"
43 43
44 using base::Time; 44 using base::Time;
45 using base::TimeDelta; 45 using base::TimeDelta;
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 guest_mounter_->Initiate(); 212 guest_mounter_->Initiate();
213 } 213 }
214 214
215 void ParallelAuthenticator::OnLoginSuccess( 215 void ParallelAuthenticator::OnLoginSuccess(
216 const GaiaAuthConsumer::ClientLoginResult& credentials, 216 const GaiaAuthConsumer::ClientLoginResult& credentials,
217 bool request_pending) { 217 bool request_pending) {
218 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 218 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
219 VLOG(1) << "Login success"; 219 VLOG(1) << "Login success";
220 // Send notification of success 220 // Send notification of success
221 AuthenticationNotificationDetails details(true); 221 AuthenticationNotificationDetails details(true);
222 NotificationService::current()->Notify( 222 content::NotificationService::current()->Notify(
223 chrome::NOTIFICATION_LOGIN_AUTHENTICATION, 223 chrome::NOTIFICATION_LOGIN_AUTHENTICATION,
224 NotificationService::AllSources(), 224 content::NotificationService::AllSources(),
225 content::Details<AuthenticationNotificationDetails>(&details)); 225 content::Details<AuthenticationNotificationDetails>(&details));
226 { 226 {
227 base::AutoLock for_this_block(success_lock_); 227 base::AutoLock for_this_block(success_lock_);
228 already_reported_success_ = true; 228 already_reported_success_ = true;
229 } 229 }
230 consumer_->OnLoginSuccess(current_state_->username, 230 consumer_->OnLoginSuccess(current_state_->username,
231 current_state_->password, 231 current_state_->password,
232 credentials, 232 credentials,
233 request_pending, 233 request_pending,
234 using_oauth_); 234 using_oauth_);
235 } 235 }
236 236
237 void ParallelAuthenticator::OnOffTheRecordLoginSuccess() { 237 void ParallelAuthenticator::OnOffTheRecordLoginSuccess() {
238 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 238 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
239 // Send notification of success 239 // Send notification of success
240 AuthenticationNotificationDetails details(true); 240 AuthenticationNotificationDetails details(true);
241 NotificationService::current()->Notify( 241 content::NotificationService::current()->Notify(
242 chrome::NOTIFICATION_LOGIN_AUTHENTICATION, 242 chrome::NOTIFICATION_LOGIN_AUTHENTICATION,
243 NotificationService::AllSources(), 243 content::NotificationService::AllSources(),
244 content::Details<AuthenticationNotificationDetails>(&details)); 244 content::Details<AuthenticationNotificationDetails>(&details));
245 consumer_->OnOffTheRecordLoginSuccess(); 245 consumer_->OnOffTheRecordLoginSuccess();
246 } 246 }
247 247
248 void ParallelAuthenticator::OnPasswordChangeDetected( 248 void ParallelAuthenticator::OnPasswordChangeDetected(
249 const GaiaAuthConsumer::ClientLoginResult& credentials) { 249 const GaiaAuthConsumer::ClientLoginResult& credentials) {
250 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 250 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
251 consumer_->OnPasswordChangeDetected(credentials); 251 consumer_->OnPasswordChangeDetected(credentials);
252 } 252 }
253 253
(...skipping 29 matching lines...) Expand all
283 BrowserThread::PostTask( 283 BrowserThread::PostTask(
284 BrowserThread::UI, FROM_HERE, 284 BrowserThread::UI, FROM_HERE,
285 base::Bind(&ParallelAuthenticator::OnLoginFailure, this, error)); 285 base::Bind(&ParallelAuthenticator::OnLoginFailure, this, error));
286 } 286 }
287 } 287 }
288 288
289 void ParallelAuthenticator::OnLoginFailure(const LoginFailure& error) { 289 void ParallelAuthenticator::OnLoginFailure(const LoginFailure& error) {
290 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 290 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
291 // Send notification of failure 291 // Send notification of failure
292 AuthenticationNotificationDetails details(false); 292 AuthenticationNotificationDetails details(false);
293 NotificationService::current()->Notify( 293 content::NotificationService::current()->Notify(
294 chrome::NOTIFICATION_LOGIN_AUTHENTICATION, 294 chrome::NOTIFICATION_LOGIN_AUTHENTICATION,
295 NotificationService::AllSources(), 295 content::NotificationService::AllSources(),
296 content::Details<AuthenticationNotificationDetails>(&details)); 296 content::Details<AuthenticationNotificationDetails>(&details));
297 LOG(WARNING) << "Login failed: " << error.GetErrorString(); 297 LOG(WARNING) << "Login failed: " << error.GetErrorString();
298 consumer_->OnLoginFailure(error); 298 consumer_->OnLoginFailure(error);
299 } 299 }
300 300
301 void ParallelAuthenticator::RecordOAuthCheckFailure( 301 void ParallelAuthenticator::RecordOAuthCheckFailure(
302 const std::string& user_name) { 302 const std::string& user_name) {
303 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 303 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
304 DCHECK(using_oauth_); 304 DCHECK(using_oauth_);
305 // Mark this account's OAuth token state as invalid in the local state. 305 // Mark this account's OAuth token state as invalid in the local state.
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 } 789 }
790 790
791 void ParallelAuthenticator::ResolveLoginCompletionStatus() { 791 void ParallelAuthenticator::ResolveLoginCompletionStatus() {
792 // Shortcut online state resolution process. 792 // Shortcut online state resolution process.
793 current_state_->RecordOnlineLoginStatus(GaiaAuthConsumer::ClientLoginResult(), 793 current_state_->RecordOnlineLoginStatus(GaiaAuthConsumer::ClientLoginResult(),
794 LoginFailure::None()); 794 LoginFailure::None());
795 Resolve(); 795 Resolve();
796 } 796 }
797 797
798 } // namespace chromeos 798 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/ownership_service_unittest.cc ('k') | chrome/browser/chromeos/login/profile_image_downloader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698