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 |