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

Unified Diff: components/arc/arc_bridge_service.cc

Issue 1754803003: Implement Stub for policy bridge to ARC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ordering and ordinal numbers in .mojom files, nits adressed Created 4 years, 9 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
« no previous file with comments | « components/arc/arc_bridge_service.h ('k') | components/arc/common/arc_bridge.mojom » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/arc/arc_bridge_service.cc
diff --git a/components/arc/arc_bridge_service.cc b/components/arc/arc_bridge_service.cc
index 00516d1b270218e76d9e469dae14cc26060f0005..e5dc41842ec067d146e51817446a4f7c0f925a3f 100644
--- a/components/arc/arc_bridge_service.cc
+++ b/components/arc/arc_bridge_service.cc
@@ -72,6 +72,8 @@ void ArcBridgeService::AddObserver(Observer* observer) {
observer->OnNetInstanceReady();
if (notifications_instance())
observer->OnNotificationsInstanceReady();
+ if (policy_instance())
+ observer->OnPolicyInstanceReady();
if (power_instance())
observer->OnPowerInstanceReady();
if (process_instance())
@@ -283,6 +285,30 @@ void ArcBridgeService::CloseNotificationsChannel() {
FOR_EACH_OBSERVER(Observer, observer_list(), OnNotificationsInstanceClosed());
}
+void ArcBridgeService::OnPolicyInstanceReady(PolicyInstancePtr policy_ptr) {
+ DCHECK(CalledOnValidThread());
+ temporary_policy_ptr_ = std::move(policy_ptr);
+ temporary_policy_ptr_.QueryVersion(base::Bind(
+ &ArcBridgeService::OnPolicyVersionReady, weak_factory_.GetWeakPtr()));
+}
+
+void ArcBridgeService::OnPolicyVersionReady(int32_t version) {
+ DCHECK(CalledOnValidThread());
+ policy_ptr_ = std::move(temporary_policy_ptr_);
+ policy_ptr_.set_connection_error_handler(base::Bind(
+ &ArcBridgeService::ClosePolicyChannel, weak_factory_.GetWeakPtr()));
+ FOR_EACH_OBSERVER(Observer, observer_list(), OnPolicyInstanceReady());
+}
+
+void ArcBridgeService::ClosePolicyChannel() {
+ DCHECK(CalledOnValidThread());
+ if (!policy_ptr_)
+ return;
+
+ policy_ptr_.reset();
+ FOR_EACH_OBSERVER(Observer, observer_list(), OnPolicyInstanceClosed());
+}
+
void ArcBridgeService::OnPowerInstanceReady(PowerInstancePtr power_ptr) {
DCHECK(CalledOnValidThread());
temporary_power_ptr_ = std::move(power_ptr);
@@ -385,6 +411,7 @@ void ArcBridgeService::CloseAllChannels() {
CloseIntentHelperChannel();
CloseNetChannel();
CloseNotificationsChannel();
+ ClosePolicyChannel();
ClosePowerChannel();
CloseProcessChannel();
CloseVideoChannel();
« no previous file with comments | « components/arc/arc_bridge_service.h ('k') | components/arc/common/arc_bridge.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698