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

Unified Diff: components/ownership/owner_settings_service.cc

Issue 640063008: Revert of Implemented OwnerSettingsService::Set() method. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months 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
« no previous file with comments | « components/ownership/owner_settings_service.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/ownership/owner_settings_service.cc
diff --git a/components/ownership/owner_settings_service.cc b/components/ownership/owner_settings_service.cc
index 204cdd1c5a2d42f80dcb183d2ad5a42f82c9a5c3..56bcbe0b09f97e1d60c2bb052ba6853652f225b3 100644
--- a/components/ownership/owner_settings_service.cc
+++ b/components/ownership/owner_settings_service.cc
@@ -12,7 +12,6 @@
#include "base/message_loop/message_loop.h"
#include "base/task_runner.h"
#include "base/task_runner_util.h"
-#include "base/values.h"
#include "components/ownership/owner_key_util.h"
#include "crypto/signature_creator.h"
@@ -22,15 +21,13 @@
namespace {
-scoped_ptr<em::PolicyFetchResponse> AssembleAndSignPolicy(
- scoped_ptr<em::PolicyData> policy,
- crypto::RSAPrivateKey* private_key) {
+std::string AssembleAndSignPolicy(scoped_ptr<em::PolicyData> policy,
+ crypto::RSAPrivateKey* private_key) {
// Assemble the policy.
- scoped_ptr<em::PolicyFetchResponse> policy_response(
- new em::PolicyFetchResponse());
- if (!policy->SerializeToString(policy_response->mutable_policy_data())) {
+ em::PolicyFetchResponse policy_response;
+ if (!policy->SerializeToString(policy_response.mutable_policy_data())) {
LOG(ERROR) << "Failed to encode policy payload.";
- return scoped_ptr<em::PolicyFetchResponse>(nullptr).Pass();
+ return std::string();
}
// Generate the signature.
@@ -38,19 +35,19 @@
crypto::SignatureCreator::Create(private_key,
crypto::SignatureCreator::SHA1));
signature_creator->Update(
- reinterpret_cast<const uint8*>(policy_response->policy_data().c_str()),
- policy_response->policy_data().size());
+ reinterpret_cast<const uint8*>(policy_response.policy_data().c_str()),
+ policy_response.policy_data().size());
std::vector<uint8> signature_bytes;
std::string policy_blob;
if (!signature_creator->Final(&signature_bytes)) {
LOG(ERROR) << "Failed to create policy signature.";
- return scoped_ptr<em::PolicyFetchResponse>(nullptr).Pass();
+ return std::string();
}
- policy_response->mutable_policy_data_signature()->assign(
+ policy_response.mutable_policy_data_signature()->assign(
reinterpret_cast<const char*>(vector_as_array(&signature_bytes)),
signature_bytes.size());
- return policy_response.Pass();
+ return policy_response.SerializeAsString();
}
} // namepace
@@ -62,15 +59,6 @@
OwnerSettingsService::~OwnerSettingsService() {
DCHECK(thread_checker_.CalledOnValidThread());
-}
-
-void OwnerSettingsService::AddObserver(Observer* observer) {
- if (observer && !observers_.HasObserver(observer))
- observers_.AddObserver(observer);
-}
-
-void OwnerSettingsService::RemoveObserver(Observer* observer) {
- observers_.RemoveObserver(observer);
}
bool OwnerSettingsService::IsOwner() {
@@ -103,31 +91,6 @@
callback);
}
-bool OwnerSettingsService::SetBoolean(const std::string& setting, bool value) {
- DCHECK(thread_checker_.CalledOnValidThread());
- base::FundamentalValue in_value(value);
- return Set(setting, in_value);
-}
-
-bool OwnerSettingsService::SetInteger(const std::string& setting, int value) {
- DCHECK(thread_checker_.CalledOnValidThread());
- base::FundamentalValue in_value(value);
- return Set(setting, in_value);
-}
-
-bool OwnerSettingsService::SetDouble(const std::string& setting, double value) {
- DCHECK(thread_checker_.CalledOnValidThread());
- base::FundamentalValue in_value(value);
- return Set(setting, in_value);
-}
-
-bool OwnerSettingsService::SetString(const std::string& setting,
- const std::string& value) {
- DCHECK(thread_checker_.CalledOnValidThread());
- base::StringValue in_value(value);
- return Set(setting, in_value);
-}
-
void OwnerSettingsService::ReloadKeypair() {
ReloadKeypairImpl(
base::Bind(&OwnerSettingsService::OnKeypairLoaded, as_weak_ptr()));
« no previous file with comments | « components/ownership/owner_settings_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698