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

Unified Diff: chrome/browser/chromeos/login/auth/online_attempt_host.cc

Issue 402403004: Refactoring : Move OnlineAttempt to chromeos/login (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Yet another merge with ToT Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/login/auth/online_attempt_host.cc
diff --git a/chrome/browser/chromeos/login/auth/online_attempt_host.cc b/chrome/browser/chromeos/login/auth/online_attempt_host.cc
deleted file mode 100644
index 277e2d88e319774d03f30a644c4c6d11d4c51454..0000000000000000000000000000000000000000
--- a/chrome/browser/chromeos/login/auth/online_attempt_host.cc
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// 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 "base/bind.h"
-#include "chrome/browser/chromeos/login/auth/online_attempt.h"
-#include "chromeos/login/auth/auth_attempt_state.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) {}
-
-OnlineAttemptHost::~OnlineAttemptHost() {
- Reset();
-}
-
-void OnlineAttemptHost::Check(content::BrowserContext* auth_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;
-
- state_.reset(new AuthAttemptState(user_context,
- user_manager::USER_TYPE_REGULAR,
- false, // unlock
- false, // online_complete
- false)); // user_is_new
- online_attempt_.reset(new OnlineAttempt(state_.get(), this));
- online_attempt_->Initiate(auth_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));
- }
-}
-
-void OnlineAttemptHost::ResolveOnUIThread(bool success) {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
- delegate_->OnChecked(current_attempt_user_context_.GetUserID(), success);
- Reset();
-}
-
-} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698