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

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

Issue 5671003: [Chrome OS] Plumb new error codes from SignedSettings to consumers of the API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years 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/signed_settings_helper.cc
diff --git a/chrome/browser/chromeos/login/signed_settings_helper.cc b/chrome/browser/chromeos/login/signed_settings_helper.cc
index b2075f726347adc8b728277eba737405d756f780..e36876a753131562091fe99b87c59c593fcea849 100644
--- a/chrome/browser/chromeos/login/signed_settings_helper.cc
+++ b/chrome/browser/chromeos/login/signed_settings_helper.cc
@@ -90,11 +90,6 @@ class OpContext {
delete this;
}
- // Callback on op failure.
- virtual void OnOpFailed() {
- OnOpCompleted();
- }
-
bool executing_;
Delegate* delegate_;
@@ -121,31 +116,29 @@ class WhitelistOpContext : public SignedSettings::Delegate<bool>,
}
// chromeos::SignedSettings::Delegate implementation
- virtual void OnSettingsOpSucceeded(bool value) {
+ virtual void OnSettingsOpCompleted(SignedSettings::ReturnCode code,
+ bool value) {
if (callback_) {
switch (type_) {
case CHECK:
- callback_->OnCheckWhiteListCompleted(value, email_);
+ if (code != SignedSettings::SUCCESS)
+ value = false; // Should be true already, but just to be sure.
Denis Lagno 2010/12/09 11:54:12 for my eye comment disagrees with the code
Chris Masone 2010/12/09 16:33:42 again, you are right!
+ callback_->OnCheckWhitelistCompleted(code, value, email_);
break;
case ADD:
- callback_->OnWhitelistCompleted(value, email_);
+ callback_->OnWhitelistCompleted(code, email_);
break;
case REMOVE:
- callback_->OnUnwhitelistCompleted(value, email_);
+ callback_->OnUnwhitelistCompleted(code, email_);
break;
default:
LOG(ERROR) << "Unknown WhitelistOpContext type " << type_;
break;
}
}
-
OnOpCompleted();
}
- virtual void OnSettingsOpFailed(SignedSettings::FailureCode code) {
- OnOpFailed();
- }
-
protected:
// OpContext implemenetation
virtual void CreateOp() {
@@ -165,27 +158,6 @@ class WhitelistOpContext : public SignedSettings::Delegate<bool>,
}
}
- virtual void OnOpFailed() {
- if (callback_) {
- switch (type_) {
- case CHECK:
- callback_->OnCheckWhiteListCompleted(false, email_);
- break;
- case ADD:
- callback_->OnWhitelistCompleted(false, email_);
- break;
- case REMOVE:
- callback_->OnUnwhitelistCompleted(false, email_);
- break;
- default:
- LOG(ERROR) << "Unknown WhitelistOpContext type " << type_;
- break;
- }
- }
-
- OnOpCompleted();
- }
-
private:
Type type_;
std::string email_;
@@ -206,28 +178,19 @@ class StorePropertyOpContext : public SignedSettings::Delegate<bool>,
}
// chromeos::SignedSettings::Delegate implementation
- virtual void OnSettingsOpSucceeded(bool value) {
+ virtual void OnSettingsOpCompleted(SignedSettings::ReturnCode code,
+ bool unused) {
if (callback_)
- callback_->OnStorePropertyCompleted(true, name_, value_);
+ callback_->OnStorePropertyCompleted(code, name_, value_);
OnOpCompleted();
}
- virtual void OnSettingsOpFailed(SignedSettings::FailureCode code) {
- OnOpFailed();
- }
-
protected:
// OpContext implemenetation
virtual void CreateOp() {
op_ = SignedSettings::CreateStorePropertyOp(name_, value_, this);
}
- virtual void OnOpFailed() {
- if (callback_)
- callback_->OnStorePropertyCompleted(false, name_, value_);
- OnOpCompleted();
- }
-
private:
std::string name_;
std::string value_;
@@ -247,29 +210,20 @@ class RetrievePropertyOpContext
}
// chromeos::SignedSettings::Delegate implementation
- virtual void OnSettingsOpSucceeded(std::string value) {
+ virtual void OnSettingsOpCompleted(SignedSettings::ReturnCode code,
+ std::string value) {
if (callback_)
- callback_->OnRetrievePropertyCompleted(true, name_, value);
+ callback_->OnRetrievePropertyCompleted(code, name_, value);
OnOpCompleted();
}
- virtual void OnSettingsOpFailed(SignedSettings::FailureCode code) {
- OnOpFailed();
- }
-
protected:
// OpContext implemenetation
virtual void CreateOp() {
op_ = SignedSettings::CreateRetrievePropertyOp(name_, this);
}
- virtual void OnOpFailed() {
- if (callback_)
- callback_->OnRetrievePropertyCompleted(false, name_, std::string());
- OnOpCompleted();
- }
-
private:
std::string name_;

Powered by Google App Engine
This is Rietveld 408576698