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

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

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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/file_path.h" 10 #include "base/file_path.h"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/path_service.h" 13 #include "base/path_service.h"
14 #include "base/string_util.h" 14 #include "base/string_util.h"
15 #include "base/synchronization/lock.h" 15 #include "base/synchronization/lock.h"
16 #include "crypto/third_party/nss/blapi.h" 16 #include "crypto/third_party/nss/blapi.h"
17 #include "crypto/third_party/nss/sha256.h" 17 #include "crypto/third_party/nss/sha256.h"
18 #include "chrome/browser/chromeos/cros/cryptohome_library.h" 18 #include "chrome/browser/chromeos/cros/cryptohome_library.h"
19 #include "chrome/browser/chromeos/login/auth_response_handler.h" 19 #include "chrome/browser/chromeos/login/auth_response_handler.h"
20 #include "chrome/browser/chromeos/login/authentication_notification_details.h" 20 #include "chrome/browser/chromeos/login/authentication_notification_details.h"
21 #include "chrome/browser/chromeos/login/login_status_consumer.h" 21 #include "chrome/browser/chromeos/login/login_status_consumer.h"
22 #include "chrome/browser/chromeos/login/ownership_service.h" 22 #include "chrome/browser/chromeos/login/ownership_service.h"
23 #include "chrome/browser/chromeos/login/user_manager.h" 23 #include "chrome/browser/chromeos/login/user_manager.h"
24 #include "chrome/browser/profiles/profile.h" 24 #include "chrome/browser/profiles/profile.h"
25 #include "chrome/browser/profiles/profile_manager.h" 25 #include "chrome/browser/profiles/profile_manager.h"
26 #include "chrome/common/chrome_notification_types.h"
26 #include "chrome/common/chrome_paths.h" 27 #include "chrome/common/chrome_paths.h"
27 #include "chrome/common/net/gaia/gaia_auth_fetcher.h" 28 #include "chrome/common/net/gaia/gaia_auth_fetcher.h"
28 #include "chrome/common/net/gaia/gaia_constants.h" 29 #include "chrome/common/net/gaia/gaia_constants.h"
29 #include "content/browser/browser_thread.h" 30 #include "content/browser/browser_thread.h"
30 #include "content/common/notification_service.h" 31 #include "content/common/notification_service.h"
31 #include "net/base/load_flags.h" 32 #include "net/base/load_flags.h"
32 #include "net/base/net_errors.h" 33 #include "net/base/net_errors.h"
33 #include "net/url_request/url_request_status.h" 34 #include "net/url_request/url_request_status.h"
34 #include "third_party/libjingle/source/talk/base/urlencode.h" 35 #include "third_party/libjingle/source/talk/base/urlencode.h"
35 36
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 } 124 }
124 125
125 void ParallelAuthenticator::OnLoginSuccess( 126 void ParallelAuthenticator::OnLoginSuccess(
126 const GaiaAuthConsumer::ClientLoginResult& credentials, 127 const GaiaAuthConsumer::ClientLoginResult& credentials,
127 bool request_pending) { 128 bool request_pending) {
128 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 129 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
129 VLOG(1) << "Login success"; 130 VLOG(1) << "Login success";
130 // Send notification of success 131 // Send notification of success
131 AuthenticationNotificationDetails details(true); 132 AuthenticationNotificationDetails details(true);
132 NotificationService::current()->Notify( 133 NotificationService::current()->Notify(
133 NotificationType::LOGIN_AUTHENTICATION, 134 chrome::NOTIFICATION_LOGIN_AUTHENTICATION,
134 NotificationService::AllSources(), 135 NotificationService::AllSources(),
135 Details<AuthenticationNotificationDetails>(&details)); 136 Details<AuthenticationNotificationDetails>(&details));
136 { 137 {
137 base::AutoLock for_this_block(success_lock_); 138 base::AutoLock for_this_block(success_lock_);
138 already_reported_success_ = true; 139 already_reported_success_ = true;
139 } 140 }
140 consumer_->OnLoginSuccess(current_state_->username, 141 consumer_->OnLoginSuccess(current_state_->username,
141 current_state_->password, 142 current_state_->password,
142 credentials, 143 credentials,
143 request_pending); 144 request_pending);
144 } 145 }
145 146
146 void ParallelAuthenticator::OnOffTheRecordLoginSuccess() { 147 void ParallelAuthenticator::OnOffTheRecordLoginSuccess() {
147 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 148 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
148 // Send notification of success 149 // Send notification of success
149 AuthenticationNotificationDetails details(true); 150 AuthenticationNotificationDetails details(true);
150 NotificationService::current()->Notify( 151 NotificationService::current()->Notify(
151 NotificationType::LOGIN_AUTHENTICATION, 152 chrome::NOTIFICATION_LOGIN_AUTHENTICATION,
152 NotificationService::AllSources(), 153 NotificationService::AllSources(),
153 Details<AuthenticationNotificationDetails>(&details)); 154 Details<AuthenticationNotificationDetails>(&details));
154 consumer_->OnOffTheRecordLoginSuccess(); 155 consumer_->OnOffTheRecordLoginSuccess();
155 } 156 }
156 157
157 void ParallelAuthenticator::OnPasswordChangeDetected( 158 void ParallelAuthenticator::OnPasswordChangeDetected(
158 const GaiaAuthConsumer::ClientLoginResult& credentials) { 159 const GaiaAuthConsumer::ClientLoginResult& credentials) {
159 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 160 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
160 consumer_->OnPasswordChangeDetected(credentials); 161 consumer_->OnPasswordChangeDetected(credentials);
161 } 162 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 BrowserThread::UI, FROM_HERE, 196 BrowserThread::UI, FROM_HERE,
196 NewRunnableMethod(this, &ParallelAuthenticator::OnLoginFailure, error)); 197 NewRunnableMethod(this, &ParallelAuthenticator::OnLoginFailure, error));
197 } 198 }
198 } 199 }
199 200
200 void ParallelAuthenticator::OnLoginFailure(const LoginFailure& error) { 201 void ParallelAuthenticator::OnLoginFailure(const LoginFailure& error) {
201 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 202 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
202 // Send notification of failure 203 // Send notification of failure
203 AuthenticationNotificationDetails details(false); 204 AuthenticationNotificationDetails details(false);
204 NotificationService::current()->Notify( 205 NotificationService::current()->Notify(
205 NotificationType::LOGIN_AUTHENTICATION, 206 chrome::NOTIFICATION_LOGIN_AUTHENTICATION,
206 NotificationService::AllSources(), 207 NotificationService::AllSources(),
207 Details<AuthenticationNotificationDetails>(&details)); 208 Details<AuthenticationNotificationDetails>(&details));
208 LOG(WARNING) << "Login failed: " << error.GetErrorString(); 209 LOG(WARNING) << "Login failed: " << error.GetErrorString();
209 consumer_->OnLoginFailure(error); 210 consumer_->OnLoginFailure(error);
210 } 211 }
211 212
212 void ParallelAuthenticator::RecoverEncryptedData( 213 void ParallelAuthenticator::RecoverEncryptedData(
213 const std::string& old_password, 214 const std::string& old_password,
214 const GaiaAuthConsumer::ClientLoginResult& credentials) { 215 const GaiaAuthConsumer::ClientLoginResult& credentials) {
215 std::string old_hash = HashPassword(old_password); 216 std::string old_hash = HashPassword(old_password);
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 const unsigned int len) { 630 const unsigned int len) {
630 if (len < 2*binary_len) 631 if (len < 2*binary_len)
631 return false; 632 return false;
632 memset(hex_string, 0, len); 633 memset(hex_string, 0, len);
633 for (uint i = 0, j = 0; i < binary_len; i++, j+=2) 634 for (uint i = 0, j = 0; i < binary_len; i++, j+=2)
634 snprintf(hex_string + j, len - j, "%02x", binary[i]); 635 snprintf(hex_string + j, len - j, "%02x", binary[i]);
635 return true; 636 return true;
636 } 637 }
637 638
638 } // namespace chromeos 639 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/ownership_service.cc ('k') | chrome/browser/chromeos/login/screen_lock_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698