| Index: chrome/browser/chromeos/cros/login_library.cc
|
| diff --git a/chrome/browser/chromeos/cros/login_library.cc b/chrome/browser/chromeos/cros/login_library.cc
|
| index 2c7fd5bc876c8d33a497cb94dabefe3ed1cf2d0f..d013b31aebcee02df656052c1415c84265d28495 100644
|
| --- a/chrome/browser/chromeos/cros/login_library.cc
|
| +++ b/chrome/browser/chromeos/cros/login_library.cc
|
| @@ -27,13 +27,57 @@ class LoginLibraryImpl : public LoginLibrary {
|
| return chromeos::EmitLoginPromptReady();
|
| }
|
|
|
| - bool SetOwnerKey(const std::vector<uint8>& public_key_der,
|
| - Delegate<bool>* callback) {
|
| - DCHECK(callback) << "must provide a callback to SetOwnerKey()";
|
| + bool CheckWhitelist(const std::string& email,
|
| + std::vector<uint8>* OUT_signature) {
|
| + return chromeos::CheckWhitelist(email.c_str(), OUT_signature);
|
| + }
|
| +
|
| + bool RetrieveProperty(const std::string& name,
|
| + std::string* OUT_value,
|
| + std::vector<uint8>* OUT_signature) {
|
| + return chromeos::RetrieveProperty(name.c_str(), OUT_value, OUT_signature);
|
| + }
|
| +
|
| + bool SetOwnerKeyAsync(const std::vector<uint8>& public_key_der,
|
| + Delegate<bool>* callback) {
|
| + DCHECK(callback) << "must provide a callback to SetOwnerKeyAsync()";
|
| + if (set_owner_key_callback_)
|
| + return false;
|
| set_owner_key_callback_ = callback;
|
| return chromeos::SetOwnerKey(public_key_der);
|
| }
|
|
|
| + bool StorePropertyAsync(const std::string& name,
|
| + const std::string& value,
|
| + const std::vector<uint8>& signature,
|
| + Delegate<bool>* callback) {
|
| + DCHECK(callback) << "must provide a callback to StorePropertyAsync()";
|
| + if (property_op_callback_)
|
| + return false;
|
| + property_op_callback_ = callback;
|
| + return chromeos::StoreProperty(name.c_str(), value.c_str(), signature);
|
| + }
|
| +
|
| + bool UnwhitelistAsync(const std::string& email,
|
| + const std::vector<uint8>& signature,
|
| + Delegate<bool>* callback) {
|
| + DCHECK(callback) << "must provide a callback to UnwhitelistAsync()";
|
| + if (whitelist_op_callback_)
|
| + return false;
|
| + whitelist_op_callback_ = callback;
|
| + return chromeos::Unwhitelist(email.c_str(), signature);
|
| + }
|
| +
|
| + bool WhitelistAsync(const std::string& email,
|
| + const std::vector<uint8>& signature,
|
| + Delegate<bool>* callback) {
|
| + DCHECK(callback) << "must provide a callback to WhitelistAsync()";
|
| + if (whitelist_op_callback_)
|
| + return false;
|
| + whitelist_op_callback_ = callback;
|
| + return chromeos::Whitelist(email.c_str(), signature);
|
| + }
|
| +
|
| bool StartSession(const std::string& user_email,
|
| const std::string& unique_id /* unused */) {
|
| // only pass unique_id through once we use it for something.
|
| @@ -60,13 +104,20 @@ class LoginLibraryImpl : public LoginLibrary {
|
| self->CompleteSetOwnerKey(false);
|
| break;
|
| case WhitelistOpSuccess:
|
| + self->CompleteWhitelistOp(true);
|
| + break;
|
| case WhitelistOpFailure:
|
| + self->CompleteWhitelistOp(false);
|
| + break;
|
| case PropertyOpSuccess:
|
| + self->CompletePropertyOp(true);
|
| + break;
|
| case PropertyOpFailure:
|
| - NOTIMPLEMENTED();
|
| + self->CompletePropertyOp(false);
|
| break;
|
| default:
|
| NOTREACHED();
|
| + break;
|
| }
|
| }
|
|
|
| @@ -81,9 +132,23 @@ class LoginLibraryImpl : public LoginLibrary {
|
| set_owner_key_callback_ = NULL;
|
| }
|
|
|
| + void CompleteWhitelistOp(bool result) {
|
| + CHECK(whitelist_op_callback_);
|
| + whitelist_op_callback_->Run(result);
|
| + whitelist_op_callback_ = NULL;
|
| + }
|
| +
|
| + void CompletePropertyOp(bool result) {
|
| + CHECK(property_op_callback_);
|
| + property_op_callback_->Run(result);
|
| + property_op_callback_ = NULL;
|
| + }
|
| +
|
| chromeos::SessionConnection session_connection_;
|
|
|
| Delegate<bool>* set_owner_key_callback_;
|
| + Delegate<bool>* whitelist_op_callback_;
|
| + Delegate<bool>* property_op_callback_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(LoginLibraryImpl);
|
| };
|
| @@ -94,11 +159,48 @@ class LoginLibraryStubImpl : public LoginLibrary {
|
| virtual ~LoginLibraryStubImpl() {}
|
|
|
| bool EmitLoginPromptReady() { return true; }
|
| - bool SetOwnerKey(const std::vector<uint8>& public_key_der,
|
| - Delegate<bool>* callback) {
|
| + bool CheckWhitelist(const std::string& email,
|
| + std::vector<uint8>* OUT_signature) {
|
| + OUT_signature->assign(2, 0);
|
| + return true;
|
| + }
|
| + bool RetrieveProperty(const std::string& name,
|
| + std::string* OUT_value,
|
| + std::vector<uint8>* OUT_signature) {
|
| + OUT_value->assign("stub");
|
| + OUT_signature->assign(2, 0);
|
| + return true;
|
| + }
|
| + bool SetOwnerKeyAsync(const std::vector<uint8>& public_key_der,
|
| + Delegate<bool>* callback) {
|
| + ChromeThread::PostTask(
|
| + ChromeThread::UI, FROM_HERE,
|
| + NewRunnableFunction(&DoStubCallback, callback));
|
| + return true;
|
| + }
|
| + bool StorePropertyAsync(const std::string& name,
|
| + const std::string& value,
|
| + const std::vector<uint8>& signature,
|
| + Delegate<bool>* callback) {
|
| + ChromeThread::PostTask(
|
| + ChromeThread::UI, FROM_HERE,
|
| + NewRunnableFunction(&DoStubCallback, callback));
|
| + return true;
|
| + }
|
| + bool UnwhitelistAsync(const std::string& email,
|
| + const std::vector<uint8>& signature,
|
| + Delegate<bool>* callback) {
|
| + ChromeThread::PostTask(
|
| + ChromeThread::UI, FROM_HERE,
|
| + NewRunnableFunction(&DoStubCallback, callback));
|
| + return true;
|
| + }
|
| + bool WhitelistAsync(const std::string& email,
|
| + const std::vector<uint8>& signature,
|
| + Delegate<bool>* callback) {
|
| ChromeThread::PostTask(
|
| ChromeThread::UI, FROM_HERE,
|
| - NewRunnableFunction(&SetOwnerKeyStubCallback, callback));
|
| + NewRunnableFunction(&DoStubCallback, callback));
|
| return true;
|
| }
|
| bool StartSession(const std::string& user_email,
|
| @@ -107,7 +209,7 @@ class LoginLibraryStubImpl : public LoginLibrary {
|
| bool RestartJob(int pid, const std::string& command_line) { return true; }
|
|
|
| private:
|
| - static void SetOwnerKeyStubCallback(Delegate<bool>* callback) {
|
| + static void DoStubCallback(Delegate<bool>* callback) {
|
| callback->Run(true);
|
| }
|
|
|
|
|