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

Unified Diff: components/ownership/owner_settings_service.h

Issue 654263003: Implemented OwnerSettingsService::Set() method. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge with https://codereview.chromium.org/666363002/. 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 | « chrome/chrome_tests_unit.gypi ('k') | components/ownership/owner_settings_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/ownership/owner_settings_service.h
diff --git a/components/ownership/owner_settings_service.h b/components/ownership/owner_settings_service.h
index 19619757164d0afabd21f0e66f992d01f8e0720c..16a79e6e9d41faa4934e19e407d4a232f12c59b1 100644
--- a/components/ownership/owner_settings_service.h
+++ b/components/ownership/owner_settings_service.h
@@ -13,6 +13,7 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
+#include "base/observer_list.h"
#include "base/threading/thread_checker.h"
#include "components/keyed_service/core/keyed_service.h"
#include "components/ownership/ownership_export.h"
@@ -20,6 +21,7 @@
namespace base {
class TaskRunner;
+class Value;
}
namespace ownership {
@@ -31,19 +33,38 @@ class PublicKey;
// which deal with ownership, keypairs and owner-related settings.
class OWNERSHIP_EXPORT OwnerSettingsService : public KeyedService {
public:
- typedef base::Callback<void(std::string policy_blob)>
+ class Observer {
+ public:
+ virtual ~Observer() {}
+
+ // Called when signed policy was stored, or when an error happed during
+ // policy storage..
+ virtual void OnSignedPolicyStored(bool success) {}
+
+ // Called when tentative changes were made to policy, but the policy still
+ // not signed and stored.
+ virtual void OnTentativeChangesInPolicy(
+ const enterprise_management::PolicyData& policy_data) {}
+ };
+
+ typedef base::Callback<void(
+ scoped_ptr<enterprise_management::PolicyFetchResponse> policy_response)>
AssembleAndSignPolicyAsyncCallback;
typedef base::Callback<void(bool is_owner)> IsOwnerCallback;
explicit OwnerSettingsService(
const scoped_refptr<ownership::OwnerKeyUtil>& owner_key_util);
- ~OwnerSettingsService() override;
+ virtual ~OwnerSettingsService();
base::WeakPtr<OwnerSettingsService> as_weak_ptr() {
return weak_factory_.GetWeakPtr();
}
+ void AddObserver(Observer* observer);
+
+ void RemoveObserver(Observer* observer);
+
// Returns whether current user is owner or not. When this method
// is called too early, incorrect result can be returned because
// private key loading may be in progress.
@@ -60,12 +81,22 @@ class OWNERSHIP_EXPORT OwnerSettingsService : public KeyedService {
scoped_ptr<enterprise_management::PolicyData> policy,
const AssembleAndSignPolicyAsyncCallback& callback);
- // Signs |settings| with the private half of the owner key and sends
- // the resulting policy blob for storage. The
- // result of the operation is reported through |callback|.
- virtual void SignAndStorePolicyAsync(
- scoped_ptr<enterprise_management::PolicyData> policy,
- const base::Closure& callback) = 0;
+ // Checks whether |setting| is handled by OwnerSettingsService.
+ virtual bool HandlesSetting(const std::string& setting) = 0;
+
+ // Sets |setting| value to |value|.
+ virtual bool Set(const std::string& setting, const base::Value& value) = 0;
+
+ // Sets a bunch of device settings accumulated before ownership gets
+ // established.
+ // Note that this is a temporary solution and should be removed soon.
Mattias Nissler (ping if slow) 2014/10/24 10:48:13 nit: reference the bug
ygorshenin1 2014/10/24 12:10:00 Done.
+ virtual bool CommitTentativeDeviceSettings(
+ scoped_ptr<enterprise_management::PolicyData> policy) = 0;
+
+ bool SetBoolean(const std::string& setting, bool value);
+ bool SetInteger(const std::string& setting, int value);
+ bool SetDouble(const std::string& setting, double value);
+ bool SetString(const std::string& setting, const std::string& value);
protected:
void ReloadKeypair();
@@ -89,6 +120,8 @@ class OWNERSHIP_EXPORT OwnerSettingsService : public KeyedService {
std::vector<IsOwnerCallback> pending_is_owner_callbacks_;
+ ObserverList<Observer> observers_;
+
base::ThreadChecker thread_checker_;
private:
« no previous file with comments | « chrome/chrome_tests_unit.gypi ('k') | components/ownership/owner_settings_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698