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

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

Issue 8091002: PART2: Make SignedSettings use proper Value types instead of string all around the place. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed the nits and rebased on ToT (which now has PART1 in). Created 9 years, 1 month 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 2c2309d5428ece9d023b458c1e416a14f2df977a..e5ea6fb990e50767bc0527d75d19a0365ab8b6e9 100644
--- a/chrome/browser/chromeos/login/signed_settings_helper.cc
+++ b/chrome/browser/chromeos/login/signed_settings_helper.cc
@@ -10,6 +10,7 @@
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/memory/ref_counted.h"
+#include "base/values.h"
#include "chrome/browser/chromeos/login/signed_settings.h"
#include "chrome/browser/policy/proto/device_management_backend.pb.h"
#include "content/public/browser/browser_thread.h"
@@ -170,12 +171,12 @@ class StorePropertyOpContext : public SignedSettings::Delegate<bool>,
public OpContext {
public:
StorePropertyOpContext(const std::string& name,
- const std::string& value,
+ const base::Value& value,
SignedSettingsHelper::Callback* callback,
OpContext::Delegate* delegate)
: OpContext(callback, delegate),
name_(name),
- value_(value) {
+ value_(value.DeepCopy()) {
}
// chromeos::SignedSettings::Delegate implementation
@@ -183,25 +184,25 @@ class StorePropertyOpContext : public SignedSettings::Delegate<bool>,
bool unused) OVERRIDE {
VLOG(2) << "OnSettingsOpCompleted, code = " << code;
if (callback_)
- callback_->OnStorePropertyCompleted(code, name_, value_);
+ callback_->OnStorePropertyCompleted(code, name_, *value_);
OnOpCompleted();
}
protected:
// OpContext implemenetation
virtual void CreateOp() OVERRIDE {
- op_ = SignedSettings::CreateStorePropertyOp(name_, value_, this);
+ op_ = SignedSettings::CreateStorePropertyOp(name_, *value_, this);
}
private:
std::string name_;
- std::string value_;
+ scoped_ptr<base::Value> value_;
DISALLOW_COPY_AND_ASSIGN(StorePropertyOpContext);
};
class RetrievePropertyOpContext
- : public SignedSettings::Delegate<std::string>,
+ : public SignedSettings::Delegate<const base::Value*>,
public OpContext {
public:
RetrievePropertyOpContext(const std::string& name,
@@ -213,7 +214,7 @@ class RetrievePropertyOpContext
// chromeos::SignedSettings::Delegate implementation
virtual void OnSettingsOpCompleted(SignedSettings::ReturnCode code,
- std::string value) OVERRIDE {
+ const base::Value* value) OVERRIDE {
if (callback_)
callback_->OnRetrievePropertyCompleted(code, name_, value);
@@ -303,7 +304,7 @@ class SignedSettingsHelperImpl : public SignedSettingsHelper,
bool add_to_whitelist,
Callback* callback) OVERRIDE;
virtual void StartStorePropertyOp(const std::string& name,
- const std::string& value,
+ const base::Value& value,
Callback* callback) OVERRIDE;
virtual void StartRetrieveProperty(const std::string& name,
Callback* callback) OVERRIDE;
@@ -367,7 +368,7 @@ void SignedSettingsHelperImpl::StartWhitelistOp(
void SignedSettingsHelperImpl::StartStorePropertyOp(
const std::string& name,
- const std::string& value,
+ const base::Value& value,
SignedSettingsHelper::Callback* callback) {
AddOpContext(new StorePropertyOpContext(
name,

Powered by Google App Engine
This is Rietveld 408576698