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

Unified Diff: chrome/browser/chromeos/policy/device_local_account_policy_service.h

Issue 822523003: Implement device-local account policy pushing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@f_2_442800_switch_device_cloud_policy_invalidator
Patch Set: Removed the need to initialize singletons in unit tests. Created 5 years, 11 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
Index: chrome/browser/chromeos/policy/device_local_account_policy_service.h
diff --git a/chrome/browser/chromeos/policy/device_local_account_policy_service.h b/chrome/browser/chromeos/policy/device_local_account_policy_service.h
index 3230a64e0cfccdc21b9f3bd0bc535c0a086e29e8..6849eb35accf76b7740b7d897160e3d99f3be27d 100644
--- a/chrome/browser/chromeos/policy/device_local_account_policy_service.h
+++ b/chrome/browser/chromeos/policy/device_local_account_policy_service.h
@@ -18,6 +18,7 @@
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
#include "chrome/browser/chromeos/extensions/device_local_account_external_policy_loader.h"
+#include "chrome/browser/chromeos/policy/affiliated_invalidation_service_provider.h"
#include "chrome/browser/chromeos/policy/device_local_account_extension_tracker.h"
#include "chrome/browser/chromeos/policy/device_local_account_external_data_manager.h"
#include "chrome/browser/chromeos/settings/cros_settings.h"
@@ -35,12 +36,17 @@ class DeviceSettingsService;
class SessionManagerClient;
}
+namespace invalidation {
+class InvalidationService;
+}
+
namespace net {
class URLRequestContextGetter;
}
namespace policy {
+class CloudPolicyInvalidator;
struct DeviceLocalAccount;
class DeviceLocalAccountExternalDataService;
class DeviceLocalAccountPolicyStore;
@@ -50,12 +56,15 @@ class DeviceManagementService;
// a single device-local account.
class DeviceLocalAccountPolicyBroker
: public CloudPolicyStore::Observer,
- public ComponentCloudPolicyService::Delegate {
+ public ComponentCloudPolicyService::Delegate,
+ public AffiliatedInvalidationServiceProvider::Consumer {
public:
+ // |invalidation_service_provider| must outlive |this|.
// |policy_update_callback| will be invoked to notify observers that the
// policy for |account| has been updated.
// |task_runner| is the runner for policy refresh tasks.
DeviceLocalAccountPolicyBroker(
+ AffiliatedInvalidationServiceProvider* invalidation_service_provider,
pneubeck (no reviews) 2015/01/30 14:23:58 nitty: non const& arguments tend to be add the e
bartfab (slow) 2015/02/03 18:31:06 Done.
const DeviceLocalAccount& account,
const base::FilePath& component_policy_cache_path,
scoped_ptr<DeviceLocalAccountPolicyStore> store,
@@ -110,11 +119,26 @@ class DeviceLocalAccountPolicyBroker
// ComponentCloudPolicyService::Delegate:
void OnComponentCloudPolicyUpdated() override;
+ // AffiliatedInvalidationServiceProvider::Consumer:
+ void OnInvalidationServiceSet(
+ invalidation::InvalidationService* invalidation_service) override;
+
+ CloudPolicyInvalidator* GetInvalidatorForTest() const;
+
private:
+ bool IsConnected();
pneubeck (no reviews) 2015/01/30 14:23:58 could have a comment
bartfab (slow) 2015/02/03 18:31:06 Added comment. Also, renamed this to HasClient().
+
void CreateComponentCloudPolicyService(
const scoped_refptr<net::URLRequestContextGetter>& request_context,
CloudPolicyClient* client);
+ // Creates an |invalidator_| if an |invalidation_service_| is available and
+ // the |core_| is connected.
+ void CreateInvalidatorIfPossible();
+
+ void DestroyInvalidator();
+
+ AffiliatedInvalidationServiceProvider* invalidation_service_provider_;
const std::string account_id_;
const std::string user_id_;
const base::FilePath component_policy_cache_path_;
@@ -128,6 +152,10 @@ class DeviceLocalAccountPolicyBroker
scoped_ptr<ComponentCloudPolicyService> component_policy_service_;
base::Closure policy_update_callback_;
+ int64 highest_handled_invalidation_version_;
+ invalidation::InvalidationService* invalidation_service_;
+ scoped_ptr<CloudPolicyInvalidator> invalidator_;
+
DISALLOW_COPY_AND_ASSIGN(DeviceLocalAccountPolicyBroker);
};
@@ -153,6 +181,7 @@ class DeviceLocalAccountPolicyService {
chromeos::SessionManagerClient* session_manager_client,
chromeos::DeviceSettingsService* device_settings_service,
chromeos::CrosSettings* cros_settings,
+ AffiliatedInvalidationServiceProvider* invalidation_service_provider,
scoped_refptr<base::SequencedTaskRunner> store_background_task_runner,
scoped_refptr<base::SequencedTaskRunner> extension_cache_task_runner,
scoped_refptr<base::SequencedTaskRunner>
@@ -227,6 +256,7 @@ class DeviceLocalAccountPolicyService {
chromeos::SessionManagerClient* session_manager_client_;
chromeos::DeviceSettingsService* device_settings_service_;
chromeos::CrosSettings* cros_settings_;
+ AffiliatedInvalidationServiceProvider* invalidation_service_provider_;
DeviceManagementService* device_management_service_;

Powered by Google App Engine
This is Rietveld 408576698