OLD | NEW |
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.h" | 5 #include "chrome/browser/chromeos/login/auth/online_attempt.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "chrome/browser/chromeos/login/auth/auth_attempt_state.h" | 13 #include "chrome/browser/chromeos/login/auth/auth_attempt_state.h" |
14 #include "chrome/browser/chromeos/login/auth/auth_attempt_state_resolver.h" | 14 #include "chrome/browser/chromeos/login/auth/auth_attempt_state_resolver.h" |
| 15 #include "chrome/browser/chromeos/login/auth/key.h" |
| 16 #include "chrome/browser/chromeos/login/auth/user_context.h" |
15 #include "chrome/browser/chromeos/login/users/user.h" | 17 #include "chrome/browser/chromeos/login/users/user.h" |
16 #include "content/public/browser/browser_context.h" | 18 #include "content/public/browser/browser_context.h" |
17 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
18 #include "google_apis/gaia/gaia_auth_consumer.h" | 20 #include "google_apis/gaia/gaia_auth_consumer.h" |
19 #include "google_apis/gaia/gaia_auth_fetcher.h" | 21 #include "google_apis/gaia/gaia_auth_fetcher.h" |
20 #include "google_apis/gaia/gaia_constants.h" | 22 #include "google_apis/gaia/gaia_constants.h" |
21 #include "net/base/load_flags.h" | 23 #include "net/base/load_flags.h" |
22 #include "net/base/net_errors.h" | 24 #include "net/base/net_errors.h" |
23 #include "net/url_request/url_request_status.h" | 25 #include "net/url_request/url_request_status.h" |
24 | 26 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 void OnlineAttempt::TryClientLogin() { | 122 void OnlineAttempt::TryClientLogin() { |
121 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 123 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
122 | 124 |
123 BrowserThread::PostDelayedTask( | 125 BrowserThread::PostDelayedTask( |
124 BrowserThread::UI, FROM_HERE, | 126 BrowserThread::UI, FROM_HERE, |
125 base::Bind(&OnlineAttempt::CancelClientLogin, weak_factory_.GetWeakPtr()), | 127 base::Bind(&OnlineAttempt::CancelClientLogin, weak_factory_.GetWeakPtr()), |
126 base::TimeDelta::FromMilliseconds(kClientLoginTimeoutMs)); | 128 base::TimeDelta::FromMilliseconds(kClientLoginTimeoutMs)); |
127 | 129 |
128 client_fetcher_->StartClientLogin( | 130 client_fetcher_->StartClientLogin( |
129 attempt_->user_context.GetUserID(), | 131 attempt_->user_context.GetUserID(), |
130 attempt_->user_context.GetPassword(), | 132 attempt_->user_context.GetKey()->GetSecret(), |
131 GaiaConstants::kSyncService, | 133 GaiaConstants::kSyncService, |
132 attempt_->login_token, | 134 attempt_->login_token, |
133 attempt_->login_captcha, | 135 attempt_->login_captcha, |
134 attempt_->hosted_policy()); | 136 attempt_->hosted_policy()); |
135 } | 137 } |
136 | 138 |
137 bool OnlineAttempt::HasPendingFetch() { | 139 bool OnlineAttempt::HasPendingFetch() { |
138 return client_fetcher_->HasPendingFetch(); | 140 return client_fetcher_->HasPendingFetch(); |
139 } | 141 } |
140 | 142 |
(...skipping 12 matching lines...) Expand all Loading... |
153 } | 155 } |
154 | 156 |
155 void OnlineAttempt::TriggerResolve( | 157 void OnlineAttempt::TriggerResolve( |
156 const LoginFailure& outcome) { | 158 const LoginFailure& outcome) { |
157 attempt_->RecordOnlineLoginStatus(outcome); | 159 attempt_->RecordOnlineLoginStatus(outcome); |
158 client_fetcher_.reset(NULL); | 160 client_fetcher_.reset(NULL); |
159 resolver_->Resolve(); | 161 resolver_->Resolve(); |
160 } | 162 } |
161 | 163 |
162 } // namespace chromeos | 164 } // namespace chromeos |
OLD | NEW |