summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorantrim <antrim@chromium.org>2015-01-29 01:45:36 -0800
committerCommit bot <commit-bot@chromium.org>2015-01-29 09:46:37 +0000
commit7df6f9fc7fcd1c02babf89548ce967bf8605b7f3 (patch)
tree3c5125ef89a90a69c770b703db9c0765d95597fb
parent86f137da601b3604c3b487db7f2745285c8be067 (diff)
downloadchromium_src-7df6f9fc7fcd1c02babf89548ce967bf8605b7f3.zip
chromium_src-7df6f9fc7fcd1c02babf89548ce967bf8605b7f3.tar.gz
chromium_src-7df6f9fc7fcd1c02babf89548ce967bf8605b7f3.tar.bz2
Cryptohome: Notify about error in async calls if cryptohome is not ready yet.
BUG=451148 Review URL: https://codereview.chromium.org/880303003 Cr-Commit-Position: refs/heads/master@{#313687}
-rw-r--r--chrome/browser/chromeos/login/existing_user_controller.cc4
-rw-r--r--chromeos/cryptohome/async_method_caller.cc16
-rw-r--r--chromeos/dbus/cryptohome_client.cc6
-rw-r--r--chromeos/dbus/cryptohome_client.h4
4 files changed, 28 insertions, 2 deletions
diff --git a/chrome/browser/chromeos/login/existing_user_controller.cc b/chrome/browser/chromeos/login/existing_user_controller.cc
index c181999..70f0d5a 100644
--- a/chrome/browser/chromeos/login/existing_user_controller.cc
+++ b/chrome/browser/chromeos/login/existing_user_controller.cc
@@ -624,6 +624,10 @@ void ExistingUserController::OnAuthFailure(const AuthFailure& failure) {
ShowTPMError();
} else if (!online_succeeded_for_.empty()) {
ShowGaiaPasswordChanged(online_succeeded_for_);
+ } else if (last_login_attempt_username_ == chromeos::login::kGuestUserName) {
+ // Show no errors, just re-enable input.
+ login_display_->ClearAndEnablePassword();
+ StartPublicSessionAutoLoginTimer();
} else {
// Check networking after trying to login in case user is
// cached locally or the local admin account.
diff --git a/chromeos/cryptohome/async_method_caller.cc b/chromeos/cryptohome/async_method_caller.cc
index 0b137b0..f45d1a2 100644
--- a/chromeos/cryptohome/async_method_caller.cc
+++ b/chromeos/cryptohome/async_method_caller.cc
@@ -308,10 +308,17 @@ class AsyncMethodCallerImpl : public AsyncMethodCaller {
base::Bind(it->second.data_callback, return_status, return_data));
data_callback_map_.erase(it);
}
-
// Registers a callback which is called when the result for AsyncXXX is ready.
void RegisterAsyncCallback(
Callback callback, const char* error, int async_id) {
+ if (async_id == chromeos::CryptohomeClient::kNotReadyAsyncId) {
+ base::MessageLoopProxy::current()->PostTask(
+ FROM_HERE, base::Bind(callback,
+ false, // return status
+ cryptohome::MOUNT_ERROR_FATAL));
+ return;
+ }
+
if (async_id == 0) {
LOG(ERROR) << error;
return;
@@ -325,6 +332,13 @@ class AsyncMethodCallerImpl : public AsyncMethodCaller {
// Registers a callback which is called when the result for AsyncXXX is ready.
void RegisterAsyncDataCallback(
DataCallback callback, const char* error, int async_id) {
+ if (async_id == chromeos::CryptohomeClient::kNotReadyAsyncId) {
+ base::MessageLoopProxy::current()->PostTask(
+ FROM_HERE, base::Bind(callback,
+ false, // return status
+ std::string()));
+ return;
+ }
if (async_id == 0) {
LOG(ERROR) << error;
return;
diff --git a/chromeos/dbus/cryptohome_client.cc b/chromeos/dbus/cryptohome_client.cc
index 4ccb116..e816b91 100644
--- a/chromeos/dbus/cryptohome_client.cc
+++ b/chromeos/dbus/cryptohome_client.cc
@@ -20,6 +20,8 @@
namespace chromeos {
+const int CryptohomeClient::kNotReadyAsyncId = -1;
+
namespace {
// This suffix is appended to user_id to get hash in stub implementation:
@@ -882,8 +884,10 @@ class CryptohomeClientImpl : public CryptohomeClient {
// Handles the result of AsyncXXX methods.
void OnAsyncMethodCall(const AsyncMethodCallback& callback,
dbus::Response* response) {
- if (!response)
+ if (!response) {
+ callback.Run(kNotReadyAsyncId);
return;
+ }
dbus::MessageReader reader(response);
int async_id = 0;
if (!reader.PopInt32(&async_id)) {
diff --git a/chromeos/dbus/cryptohome_client.h b/chromeos/dbus/cryptohome_client.h
index 816c106..8f9a5dc 100644
--- a/chromeos/dbus/cryptohome_client.h
+++ b/chromeos/dbus/cryptohome_client.h
@@ -39,6 +39,10 @@ namespace chromeos {
// initializes the DBusThreadManager instance.
class CHROMEOS_EXPORT CryptohomeClient : public DBusClient {
public:
+ // Constant that will be passed to AsyncMethodCallback to indicate that
+ // cryptohome is not ready yet.
+ static const int kNotReadyAsyncId;
+
// A callback to handle AsyncCallStatus signals.
typedef base::Callback<void(int async_id,
bool return_status,