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

Unified Diff: components/policy/core/common/schema_registry.cc

Issue 2441653003: Enable fetching of admin policies for login screen apps (Closed)
Patch Set: Created 4 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
Index: components/policy/core/common/schema_registry.cc
diff --git a/components/policy/core/common/schema_registry.cc b/components/policy/core/common/schema_registry.cc
index a773634a7009926a80c10c84a5c4152bf6cc0fb0..517259d997e798647b8378d87c285085e36dc7cc 100644
--- a/components/policy/core/common/schema_registry.cc
+++ b/components/policy/core/common/schema_registry.cc
@@ -186,11 +186,13 @@ void CombinedSchemaRegistry::Combine(bool has_new_schemas) {
Notify(has_new_schemas);
}
-ForwardingSchemaRegistry::ForwardingSchemaRegistry(SchemaRegistry* wrapped)
- : wrapped_(wrapped) {
+ForwardingSchemaRegistry::ForwardingSchemaRegistry(SchemaRegistry* wrapped,
+ bool forward_readiness)
+ : wrapped_(wrapped), forward_readiness_(forward_readiness) {
schema_map_ = wrapped_->schema_map();
wrapped_->AddObserver(this);
wrapped_->AddInternalObserver(this);
+ UpdateReadiness();
}
ForwardingSchemaRegistry::~ForwardingSchemaRegistry() {
@@ -222,6 +224,10 @@ void ForwardingSchemaRegistry::OnSchemaRegistryUpdated(bool has_new_schemas) {
Notify(has_new_schemas);
}
+void ForwardingSchemaRegistry::OnSchemaRegistryReady() {
+ UpdateReadiness();
+}
+
void ForwardingSchemaRegistry::OnSchemaRegistryShuttingDown(
SchemaRegistry* registry) {
DCHECK_EQ(wrapped_, registry);
@@ -231,4 +237,11 @@ void ForwardingSchemaRegistry::OnSchemaRegistryShuttingDown(
// Keep serving the same |schema_map_|.
}
+void ForwardingSchemaRegistry::UpdateReadiness() {
Andrew T Wilson (Slow) 2016/10/28 14:49:56 How can UpdateReadiness() be called when wrapped_
emaxx 2016/10/31 15:51:20 You are right, check for NULL wrapped_ is unnecess
+ if (forward_readiness_ && wrapped_ && wrapped_->IsReady()) {
+ for (int i = 0; i < POLICY_DOMAIN_SIZE; ++i)
+ SetReady(static_cast<PolicyDomain>(i));
+ }
+}
+
} // namespace policy

Powered by Google App Engine
This is Rietveld 408576698