| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/policy/cloud/remote_commands_invalidator.h" | 5 #include "chrome/browser/policy/cloud/remote_commands_invalidator.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "components/invalidation/invalidation.h" | 10 #include "components/invalidation/invalidation.h" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 invalidation_service_->RegisterInvalidationHandler(this); | 131 invalidation_service_->RegisterInvalidationHandler(this); |
| 132 is_registered_ = true; | 132 is_registered_ = true; |
| 133 } | 133 } |
| 134 | 134 |
| 135 object_id_ = object_id; | 135 object_id_ = object_id; |
| 136 UpdateInvalidationsEnabled(); | 136 UpdateInvalidationsEnabled(); |
| 137 | 137 |
| 138 // Update registration with the invalidation service. | 138 // Update registration with the invalidation service. |
| 139 syncer::ObjectIdSet ids; | 139 syncer::ObjectIdSet ids; |
| 140 ids.insert(object_id); | 140 ids.insert(object_id); |
| 141 invalidation_service_->UpdateRegisteredInvalidationIds(this, ids); | 141 CHECK(invalidation_service_->UpdateRegisteredInvalidationIds(this, ids)); |
| 142 } | 142 } |
| 143 | 143 |
| 144 void RemoteCommandsInvalidator::Unregister() { | 144 void RemoteCommandsInvalidator::Unregister() { |
| 145 if (is_registered_) { | 145 if (is_registered_) { |
| 146 invalidation_service_->UpdateRegisteredInvalidationIds( | 146 CHECK(invalidation_service_->UpdateRegisteredInvalidationIds( |
| 147 this, syncer::ObjectIdSet()); | 147 this, syncer::ObjectIdSet())); |
| 148 invalidation_service_->UnregisterInvalidationHandler(this); | 148 invalidation_service_->UnregisterInvalidationHandler(this); |
| 149 is_registered_ = false; | 149 is_registered_ = false; |
| 150 UpdateInvalidationsEnabled(); | 150 UpdateInvalidationsEnabled(); |
| 151 } | 151 } |
| 152 } | 152 } |
| 153 | 153 |
| 154 void RemoteCommandsInvalidator::UpdateInvalidationsEnabled() { | 154 void RemoteCommandsInvalidator::UpdateInvalidationsEnabled() { |
| 155 invalidations_enabled_ = invalidation_service_enabled_ && is_registered_; | 155 invalidations_enabled_ = invalidation_service_enabled_ && is_registered_; |
| 156 } | 156 } |
| 157 | 157 |
| 158 } // namespace policy | 158 } // namespace policy |
| OLD | NEW |