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

Side by Side Diff: components/policy/core/common/schema_registry.cc

Issue 2441653003: Enable fetching of admin policies for login screen apps (Closed)
Patch Set: Rebase Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/policy/core/common/schema_registry.h" 5 #include "components/policy/core/common/schema_registry.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 namespace policy { 9 namespace policy {
10 10
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 } 192 }
193 schema_map_ = new SchemaMap(map); 193 schema_map_ = new SchemaMap(map);
194 Notify(has_new_schemas); 194 Notify(has_new_schemas);
195 } 195 }
196 196
197 ForwardingSchemaRegistry::ForwardingSchemaRegistry(SchemaRegistry* wrapped) 197 ForwardingSchemaRegistry::ForwardingSchemaRegistry(SchemaRegistry* wrapped)
198 : wrapped_(wrapped) { 198 : wrapped_(wrapped) {
199 schema_map_ = wrapped_->schema_map(); 199 schema_map_ = wrapped_->schema_map();
200 wrapped_->AddObserver(this); 200 wrapped_->AddObserver(this);
201 wrapped_->AddInternalObserver(this); 201 wrapped_->AddInternalObserver(this);
202 UpdateReadiness();
202 } 203 }
203 204
204 ForwardingSchemaRegistry::~ForwardingSchemaRegistry() { 205 ForwardingSchemaRegistry::~ForwardingSchemaRegistry() {
205 if (wrapped_) { 206 if (wrapped_) {
206 wrapped_->RemoveObserver(this); 207 wrapped_->RemoveObserver(this);
207 wrapped_->RemoveInternalObserver(this); 208 wrapped_->RemoveInternalObserver(this);
208 } 209 }
209 } 210 }
210 211
211 void ForwardingSchemaRegistry::RegisterComponents( 212 void ForwardingSchemaRegistry::RegisterComponents(
(...skipping 11 matching lines...) Expand all
223 if (wrapped_) 224 if (wrapped_)
224 wrapped_->UnregisterComponent(ns); 225 wrapped_->UnregisterComponent(ns);
225 // Ignore otherwise. 226 // Ignore otherwise.
226 } 227 }
227 228
228 void ForwardingSchemaRegistry::OnSchemaRegistryUpdated(bool has_new_schemas) { 229 void ForwardingSchemaRegistry::OnSchemaRegistryUpdated(bool has_new_schemas) {
229 schema_map_ = wrapped_->schema_map(); 230 schema_map_ = wrapped_->schema_map();
230 Notify(has_new_schemas); 231 Notify(has_new_schemas);
231 } 232 }
232 233
234 void ForwardingSchemaRegistry::OnSchemaRegistryReady() {
235 UpdateReadiness();
236 }
237
233 void ForwardingSchemaRegistry::OnSchemaRegistryShuttingDown( 238 void ForwardingSchemaRegistry::OnSchemaRegistryShuttingDown(
234 SchemaRegistry* registry) { 239 SchemaRegistry* registry) {
235 DCHECK_EQ(wrapped_, registry); 240 DCHECK_EQ(wrapped_, registry);
236 wrapped_->RemoveObserver(this); 241 wrapped_->RemoveObserver(this);
237 wrapped_->RemoveInternalObserver(this); 242 wrapped_->RemoveInternalObserver(this);
238 wrapped_ = NULL; 243 wrapped_ = NULL;
239 // Keep serving the same |schema_map_|. 244 // Keep serving the same |schema_map_|.
240 } 245 }
241 246
247 void ForwardingSchemaRegistry::UpdateReadiness() {
248 if (wrapped_->IsReady())
249 SetAllDomainsReady();
250 }
251
242 } // namespace policy 252 } // namespace policy
OLDNEW
« no previous file with comments | « components/policy/core/common/schema_registry.h ('k') | components/policy/core/common/schema_registry_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698