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

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

Issue 10386206: RefCounted types should not have public destructors, chromeos edition (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to r143931 Created 8 years, 6 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 | « chrome/browser/chromeos/login/signed_settings.h ('k') | chrome/browser/chromeos/low_memory_observer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/login/signed_settings.cc
diff --git a/chrome/browser/chromeos/login/signed_settings.cc b/chrome/browser/chromeos/login/signed_settings.cc
index 44975d77dcc78fb7cea618c839ddf8201166b2ae..11fd6d37729e61a39c73d5ee9ba6c8278e8d530d 100644
--- a/chrome/browser/chromeos/login/signed_settings.cc
+++ b/chrome/browser/chromeos/login/signed_settings.cc
@@ -58,15 +58,19 @@ class StorePolicyOp : public SignedSettings {
public:
StorePolicyOp(em::PolicyFetchResponse* policy,
SignedSettings::Delegate<bool>* d);
- virtual ~StorePolicyOp();
- void Execute();
- void Fail(SignedSettings::ReturnCode code);
void Succeed(bool value);
// Implementation of OwnerManager::Delegate
- void OnKeyOpComplete(const OwnerManager::KeyOpCode return_code,
- const std::vector<uint8>& payload);
+ virtual void Execute() OVERRIDE;
+ virtual void Fail(SignedSettings::ReturnCode code) OVERRIDE;
+ virtual void OnKeyOpComplete(const OwnerManager::KeyOpCode return_code,
+ const std::vector<uint8>& payload) OVERRIDE;
+
+ protected:
+ virtual ~StorePolicyOp();
private:
+ void RequestStorePolicy();
+
void OnBoolComplete(bool success);
// Always call d_->OnSettingOpCompleted() via this call.
// It guarantees that the callback will not be triggered until _after_
@@ -76,21 +80,21 @@ class StorePolicyOp : public SignedSettings {
em::PolicyFetchResponse* policy_;
SignedSettings::Delegate<bool>* d_;
-
- void RequestStorePolicy();
};
class RetrievePolicyOp : public SignedSettings {
public:
explicit RetrievePolicyOp(
SignedSettings::Delegate<const em::PolicyFetchResponse&>* d);
- virtual ~RetrievePolicyOp();
- void Execute();
- void Fail(SignedSettings::ReturnCode code);
void Succeed(const em::PolicyFetchResponse& value);
// Implementation of OwnerManager::Delegate
- void OnKeyOpComplete(const OwnerManager::KeyOpCode return_code,
- const std::vector<uint8>& payload);
+ virtual void Execute() OVERRIDE;
+ virtual void Fail(SignedSettings::ReturnCode code) OVERRIDE;
+ virtual void OnKeyOpComplete(const OwnerManager::KeyOpCode return_code,
+ const std::vector<uint8>& payload) OVERRIDE;
+
+ protected:
+ virtual ~RetrievePolicyOp();
private:
void OnStringComplete(const std::string& serialized_proto);
@@ -130,13 +134,18 @@ StorePolicyOp::StorePolicyOp(em::PolicyFetchResponse* policy,
d_(d) {
}
-StorePolicyOp::~StorePolicyOp() {}
-
-void StorePolicyOp::OnBoolComplete(bool success) {
- if (success)
- Succeed(true);
- else
- Fail(NOT_FOUND);
+void StorePolicyOp::Succeed(bool ignored) {
+ SignedSettings::ReturnCode code = SUCCESS;
+ bool to_ret = true;
+ em::PolicyData poldata;
+ if (SignedSettings::PolicyIsSane(*policy_, &poldata)) {
+ } else {
+ code = NOT_FOUND;
+ to_ret = false;
+ }
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
+ base::Bind(&StorePolicyOp::PerformCallback, this, code, to_ret));
}
void StorePolicyOp::Execute() {
@@ -155,20 +164,6 @@ void StorePolicyOp::Fail(SignedSettings::ReturnCode code) {
base::Bind(&StorePolicyOp::PerformCallback, this, code, false));
}
-void StorePolicyOp::Succeed(bool ignored) {
- SignedSettings::ReturnCode code = SUCCESS;
- bool to_ret = true;
- em::PolicyData poldata;
- if (SignedSettings::PolicyIsSane(*policy_, &poldata)) {
- } else {
- code = NOT_FOUND;
- to_ret = false;
- }
- BrowserThread::PostTask(
- BrowserThread::UI, FROM_HERE,
- base::Bind(&StorePolicyOp::PerformCallback, this, code, to_ret));
-}
-
void StorePolicyOp::OnKeyOpComplete(const OwnerManager::KeyOpCode return_code,
const std::vector<uint8>& payload) {
// Ensure we're on the UI thread, due to the need to send DBus traffic.
@@ -190,6 +185,8 @@ void StorePolicyOp::OnKeyOpComplete(const OwnerManager::KeyOpCode return_code,
Fail(SignedSettings::MapKeyOpCode(return_code));
}
+StorePolicyOp::~StorePolicyOp() {}
+
void StorePolicyOp::RequestStorePolicy() {
std::string serialized;
if (policy_->SerializeToString(&serialized)) {
@@ -201,6 +198,13 @@ void StorePolicyOp::RequestStorePolicy() {
}
}
+void StorePolicyOp::OnBoolComplete(bool success) {
+ if (success)
+ Succeed(true);
+ else
+ Fail(NOT_FOUND);
+}
+
void StorePolicyOp::PerformCallback(SignedSettings::ReturnCode code,
bool value) {
d_->OnSettingsOpCompleted(code, value);
@@ -211,7 +215,16 @@ RetrievePolicyOp::RetrievePolicyOp(
: d_(d) {
}
-RetrievePolicyOp::~RetrievePolicyOp() {}
+void RetrievePolicyOp::Succeed(const em::PolicyFetchResponse& value) {
+ em::PolicyData poldata;
+ if (SignedSettings::PolicyIsSane(value, &poldata)) {
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
+ base::Bind(&RetrievePolicyOp::PerformCallback, this, SUCCESS, value));
+ } else {
+ Fail(NOT_FOUND);
+ }
+}
void RetrievePolicyOp::Execute() {
DBusThreadManager::Get()->GetSessionManagerClient()->RetrieveDevicePolicy(
@@ -226,17 +239,6 @@ void RetrievePolicyOp::Fail(SignedSettings::ReturnCode code) {
em::PolicyFetchResponse()));
}
-void RetrievePolicyOp::Succeed(const em::PolicyFetchResponse& value) {
- em::PolicyData poldata;
- if (SignedSettings::PolicyIsSane(value, &poldata)) {
- BrowserThread::PostTask(
- BrowserThread::UI, FROM_HERE,
- base::Bind(&RetrievePolicyOp::PerformCallback, this, SUCCESS, value));
- } else {
- Fail(NOT_FOUND);
- }
-}
-
void RetrievePolicyOp::OnKeyOpComplete(
const OwnerManager::KeyOpCode return_code,
const std::vector<uint8>& payload) {
@@ -254,6 +256,8 @@ void RetrievePolicyOp::OnKeyOpComplete(
Fail(SignedSettings::MapKeyOpCode(return_code));
}
+RetrievePolicyOp::~RetrievePolicyOp() {}
+
void RetrievePolicyOp::OnStringComplete(const std::string& serialized_proto) {
ProcessPolicy(serialized_proto);
}
« no previous file with comments | « chrome/browser/chromeos/login/signed_settings.h ('k') | chrome/browser/chromeos/low_memory_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698