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

Side by Side Diff: chrome/browser/chromeos/login/auth/online_attempt_host.cc

Issue 292663018: [cros login] Cleanup: replace some of Profile usages with BrowserContext. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add missing include, fix ProxySettingsDialog ctor Created 6 years, 7 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/auth/online_attempt_host.h" 5 #include "chrome/browser/chromeos/login/auth/online_attempt_host.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/sha1.h" 8 #include "base/sha1.h"
9 #include "chrome/browser/chromeos/login/auth/auth_attempt_state.h" 9 #include "chrome/browser/chromeos/login/auth/auth_attempt_state.h"
10 #include "chrome/browser/chromeos/login/auth/online_attempt.h" 10 #include "chrome/browser/chromeos/login/auth/online_attempt.h"
11 #include "chrome/browser/chromeos/login/auth/user_context.h" 11 #include "chrome/browser/chromeos/login/auth/user_context.h"
12 #include "chrome/browser/chromeos/login/users/user.h" 12 #include "chrome/browser/chromeos/login/users/user.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "content/public/browser/browser_context.h"
14 #include "content/public/browser/browser_thread.h" 14 #include "content/public/browser/browser_thread.h"
15 15
16 namespace chromeos { 16 namespace chromeos {
17 17
18 OnlineAttemptHost::OnlineAttemptHost(Delegate* delegate) 18 OnlineAttemptHost::OnlineAttemptHost(Delegate* delegate)
19 : delegate_(delegate), weak_ptr_factory_(this) {} 19 : delegate_(delegate), weak_ptr_factory_(this) {}
20 20
21 OnlineAttemptHost::~OnlineAttemptHost() { 21 OnlineAttemptHost::~OnlineAttemptHost() {
22 Reset(); 22 Reset();
23 } 23 }
24 24
25 void OnlineAttemptHost::Check(Profile* profile, 25 void OnlineAttemptHost::Check(content::BrowserContext* auth_context,
26 const UserContext& user_context) { 26 const UserContext& user_context) {
27 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 27 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
28 std::string attempt_hash = base::SHA1HashString( 28 std::string attempt_hash = base::SHA1HashString(
29 user_context.GetUserID() + "\n" + user_context.GetPassword()); 29 user_context.GetUserID() + "\n" + user_context.GetPassword());
30 if (attempt_hash != current_attempt_hash_) { 30 if (attempt_hash != current_attempt_hash_) {
31 Reset(); 31 Reset();
32 current_attempt_hash_ = attempt_hash; 32 current_attempt_hash_ = attempt_hash;
33 current_username_ = user_context.GetUserID(); 33 current_username_ = user_context.GetUserID();
34 34
35 state_.reset(new AuthAttemptState(user_context, 35 state_.reset(new AuthAttemptState(user_context,
36 User::USER_TYPE_REGULAR, 36 User::USER_TYPE_REGULAR,
37 false, // unlock 37 false, // unlock
38 false, // online_complete 38 false, // online_complete
39 false)); // user_is_new 39 false)); // user_is_new
40 online_attempt_.reset(new OnlineAttempt(state_.get(), this)); 40 online_attempt_.reset(new OnlineAttempt(state_.get(), this));
41 online_attempt_->Initiate(profile); 41 online_attempt_->Initiate(auth_context);
42 } 42 }
43 } 43 }
44 44
45 void OnlineAttemptHost::Reset() { 45 void OnlineAttemptHost::Reset() {
46 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 46 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
47 online_attempt_.reset(NULL); 47 online_attempt_.reset(NULL);
48 current_attempt_hash_.clear(); 48 current_attempt_hash_.clear();
49 current_username_.clear(); 49 current_username_.clear();
50 } 50 }
51 51
(...skipping 10 matching lines...) Expand all
62 } 62 }
63 } 63 }
64 64
65 void OnlineAttemptHost::ResolveOnUIThread(bool success) { 65 void OnlineAttemptHost::ResolveOnUIThread(bool success) {
66 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 66 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
67 delegate_->OnChecked(current_username_, success); 67 delegate_->OnChecked(current_username_, success);
68 Reset(); 68 Reset();
69 } 69 }
70 70
71 } // namespace chromeos 71 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/auth/online_attempt_host.h ('k') | chrome/browser/chromeos/login/lock/screen_locker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698