| Index: chromeos/login/auth/online_attempt_host.cc
|
| diff --git a/chrome/browser/chromeos/login/auth/online_attempt_host.cc b/chromeos/login/auth/online_attempt_host.cc
|
| similarity index 61%
|
| rename from chrome/browser/chromeos/login/auth/online_attempt_host.cc
|
| rename to chromeos/login/auth/online_attempt_host.cc
|
| index 277e2d88e319774d03f30a644c4c6d11d4c51454..6b742f8d15b31783c14267b3bea24f63b242a127 100644
|
| --- a/chrome/browser/chromeos/login/auth/online_attempt_host.cc
|
| +++ b/chromeos/login/auth/online_attempt_host.cc
|
| @@ -2,28 +2,30 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "chrome/browser/chromeos/login/auth/online_attempt_host.h"
|
| +#include "chromeos/login/auth/online_attempt_host.h"
|
|
|
| #include "base/bind.h"
|
| -#include "chrome/browser/chromeos/login/auth/online_attempt.h"
|
| +#include "base/location.h"
|
| +#include "base/message_loop/message_loop_proxy.h"
|
| #include "chromeos/login/auth/auth_attempt_state.h"
|
| +#include "chromeos/login/auth/online_attempt.h"
|
| #include "chromeos/login/auth/user_context.h"
|
| #include "components/user_manager/user_type.h"
|
| -#include "content/public/browser/browser_context.h"
|
| -#include "content/public/browser/browser_thread.h"
|
|
|
| namespace chromeos {
|
|
|
| OnlineAttemptHost::OnlineAttemptHost(Delegate* delegate)
|
| - : delegate_(delegate), weak_ptr_factory_(this) {}
|
| + : message_loop_(base::MessageLoopProxy::current()),
|
| + delegate_(delegate),
|
| + weak_ptr_factory_(this) {
|
| +}
|
|
|
| OnlineAttemptHost::~OnlineAttemptHost() {
|
| Reset();
|
| }
|
|
|
| -void OnlineAttemptHost::Check(content::BrowserContext* auth_context,
|
| +void OnlineAttemptHost::Check(net::URLRequestContextGetter* request_context,
|
| const UserContext& user_context) {
|
| - DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
|
| if (user_context != current_attempt_user_context_) {
|
| Reset();
|
| current_attempt_user_context_ = user_context;
|
| @@ -34,31 +36,26 @@ void OnlineAttemptHost::Check(content::BrowserContext* auth_context,
|
| false, // online_complete
|
| false)); // user_is_new
|
| online_attempt_.reset(new OnlineAttempt(state_.get(), this));
|
| - online_attempt_->Initiate(auth_context);
|
| + online_attempt_->Initiate(request_context);
|
| }
|
| }
|
|
|
| void OnlineAttemptHost::Reset() {
|
| - DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
|
| online_attempt_.reset(NULL);
|
| current_attempt_user_context_ = UserContext();
|
| }
|
|
|
| void OnlineAttemptHost::Resolve() {
|
| - DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
|
| if (state_->online_complete()) {
|
| bool success = state_->online_outcome().reason() == AuthFailure::NONE;
|
| - content::BrowserThread::PostTask(
|
| - content::BrowserThread::UI,
|
| - FROM_HERE,
|
| - base::Bind(&OnlineAttemptHost::ResolveOnUIThread,
|
| - weak_ptr_factory_.GetWeakPtr(),
|
| - success));
|
| + message_loop_->PostTask(FROM_HERE,
|
| + base::Bind(&OnlineAttemptHost::ResolveOnUIThread,
|
| + weak_ptr_factory_.GetWeakPtr(),
|
| + success));
|
| }
|
| }
|
|
|
| void OnlineAttemptHost::ResolveOnUIThread(bool success) {
|
| - DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
|
| delegate_->OnChecked(current_attempt_user_context_.GetUserID(), success);
|
| Reset();
|
| }
|
|
|