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

Unified Diff: chrome/browser/chromeos/policy/remote_commands/affiliated_remote_commands_invalidator.cc

Issue 1094493003: Initial RemoteCommandsInvalidator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkcr
Patch Set: fixes addressing #7 and #8 Created 5 years, 7 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/remote_commands/affiliated_remote_commands_invalidator.cc
diff --git a/chrome/browser/chromeos/policy/remote_commands/affiliated_remote_commands_invalidator.cc b/chrome/browser/chromeos/policy/remote_commands/affiliated_remote_commands_invalidator.cc
new file mode 100644
index 0000000000000000000000000000000000000000..63bb35a991797f909f1adbeb4d0390425ec7f99c
--- /dev/null
+++ b/chrome/browser/chromeos/policy/remote_commands/affiliated_remote_commands_invalidator.cc
@@ -0,0 +1,37 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/chromeos/policy/remote_commands/affiliated_remote_commands_invalidator.h"
+
+#include "chrome/browser/policy/cloud/remote_commands_invalidator_impl.h"
+
+namespace policy {
+
+AffiliatedRemoteCommandsInvalidator::AffiliatedRemoteCommandsInvalidator(
+ CloudPolicyCore* core,
+ AffiliatedInvalidationServiceProvider* invalidation_service_provider)
+ : core_(core),
+ invalidation_service_provider_(invalidation_service_provider) {
+ invalidation_service_provider_->RegisterConsumer(this);
+}
+
+AffiliatedRemoteCommandsInvalidator::~AffiliatedRemoteCommandsInvalidator() {
+ invalidation_service_provider_->UnregisterConsumer(this);
+}
+
+void AffiliatedRemoteCommandsInvalidator::OnInvalidationServiceSet(
+ invalidation::InvalidationService* invalidation_service) {
+ // Destroy this invalidator if it exists.
+ if (invalidator_) {
+ invalidator_->Shutdown();
+ invalidator_.reset();
+ }
+ // Create a new one if required.
+ if (invalidation_service) {
+ invalidator_.reset(new RemoteCommandsInvalidatorImpl(core_));
+ invalidator_->Initialize(invalidation_service);
+ }
+}
+
+} // namespace policy

Powered by Google App Engine
This is Rietveld 408576698