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

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

Issue 9566006: [cros] Resolve online login attempt on UI thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 8 years, 10 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
« no previous file with comments | « chrome/browser/chromeos/login/online_attempt_host.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/login/online_attempt_host.cc
diff --git a/chrome/browser/chromeos/login/online_attempt_host.cc b/chrome/browser/chromeos/login/online_attempt_host.cc
index 7b38c109c1c6b9bfeee1919fc04f3c122e88177a..27096a8994c87f2c4924a03bceef5d8864cfd5cf 100644
--- a/chrome/browser/chromeos/login/online_attempt_host.cc
+++ b/chrome/browser/chromeos/login/online_attempt_host.cc
@@ -4,11 +4,13 @@
#include "chrome/browser/chromeos/login/online_attempt_host.h"
+#include "base/bind.h"
#include "base/sha1.h"
#include "chrome/browser/chromeos/login/auth_attempt_state.h"
#include "chrome/browser/chromeos/login/authenticator.h"
#include "chrome/browser/chromeos/login/online_attempt.h"
#include "chrome/browser/profiles/profile.h"
+#include "content/public/browser/browser_thread.h"
namespace chromeos {
@@ -23,6 +25,7 @@ OnlineAttemptHost::~OnlineAttemptHost() {
void OnlineAttemptHost::Check(Profile* profile,
const std::string& username,
const std::string& password) {
+ DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
std::string attempt_hash = base::SHA1HashString(username + "\n" + password);
if (attempt_hash != current_attempt_hash_) {
Reset();
@@ -45,17 +48,27 @@ void OnlineAttemptHost::Check(Profile* profile,
}
void OnlineAttemptHost::Reset() {
+ DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
online_attempt_ = NULL;
current_attempt_hash_.clear();
current_username_.clear();
}
void OnlineAttemptHost::Resolve() {
+ DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
if (state_->online_complete()) {
bool success = state_->online_outcome().reason() == LoginFailure::NONE;
- delegate_->OnChecked(current_username_, success);
- Reset();
+ content::BrowserThread::PostTask(
+ content::BrowserThread::UI, FROM_HERE,
+ base::Bind(&OnlineAttemptHost::ResolveOnUIThread,
+ base::Unretained(this), success));
}
}
+void OnlineAttemptHost::ResolveOnUIThread(bool success) {
+ DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
+ delegate_->OnChecked(current_username_, success);
+ Reset();
+}
+
} // chromeos
« no previous file with comments | « chrome/browser/chromeos/login/online_attempt_host.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698