| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/chromeos/arc/arc_policy_bridge.h" | 5 #include "chrome/browser/chromeos/arc/arc_policy_bridge.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 std::string policy_json; | 127 std::string policy_json; |
| 128 JSONStringValueSerializer serializer(&policy_json); | 128 JSONStringValueSerializer serializer(&policy_json); |
| 129 serializer.Serialize(filtered_policies); | 129 serializer.Serialize(filtered_policies); |
| 130 return policy_json; | 130 return policy_json; |
| 131 } | 131 } |
| 132 | 132 |
| 133 } // namespace | 133 } // namespace |
| 134 | 134 |
| 135 ArcPolicyBridge::ArcPolicyBridge(ArcBridgeService* bridge_service) | 135 ArcPolicyBridge::ArcPolicyBridge(ArcBridgeService* bridge_service) |
| 136 : ArcService(bridge_service), binding_(this) { | 136 : ArcService(bridge_service), binding_(this) { |
| 137 VLOG(1) << "ArcPolicyBridge::ArcPolicyBridge"; | 137 VLOG(2) << "ArcPolicyBridge::ArcPolicyBridge"; |
| 138 arc_bridge_service()->AddObserver(this); | 138 arc_bridge_service()->AddObserver(this); |
| 139 } | 139 } |
| 140 | 140 |
| 141 ArcPolicyBridge::ArcPolicyBridge(ArcBridgeService* bridge_service, | 141 ArcPolicyBridge::ArcPolicyBridge(ArcBridgeService* bridge_service, |
| 142 policy::PolicyService* policy_service) | 142 policy::PolicyService* policy_service) |
| 143 : ArcService(bridge_service), | 143 : ArcService(bridge_service), |
| 144 binding_(this), | 144 binding_(this), |
| 145 policy_service_(policy_service) { | 145 policy_service_(policy_service) { |
| 146 VLOG(1) << "ArcPolicyBridge::ArcPolicyBridge(bridge_service, policy_service)"; | 146 VLOG(2) << "ArcPolicyBridge::ArcPolicyBridge(bridge_service, policy_service)"; |
| 147 arc_bridge_service()->AddObserver(this); | 147 arc_bridge_service()->AddObserver(this); |
| 148 } | 148 } |
| 149 | 149 |
| 150 ArcPolicyBridge::~ArcPolicyBridge() { | 150 ArcPolicyBridge::~ArcPolicyBridge() { |
| 151 VLOG(1) << "ArcPolicyBridge::~ArcPolicyBridge"; | 151 VLOG(2) << "ArcPolicyBridge::~ArcPolicyBridge"; |
| 152 arc_bridge_service()->RemoveObserver(this); | 152 arc_bridge_service()->RemoveObserver(this); |
| 153 } | 153 } |
| 154 | 154 |
| 155 void ArcPolicyBridge::OnPolicyInstanceReady() { | 155 void ArcPolicyBridge::OnPolicyInstanceReady() { |
| 156 VLOG(1) << "ArcPolicyBridge::OnPolicyInstanceReady"; | 156 VLOG(1) << "ArcPolicyBridge::OnPolicyInstanceReady"; |
| 157 if (policy_service_ == nullptr) { | 157 if (policy_service_ == nullptr) { |
| 158 InitializePolicyService(); | 158 InitializePolicyService(); |
| 159 } | 159 } |
| 160 policy_service_->AddObserver(policy::POLICY_DOMAIN_CHROME, this); | 160 policy_service_->AddObserver(policy::POLICY_DOMAIN_CHROME, this); |
| 161 | 161 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 const user_manager::User* const primary_user = | 197 const user_manager::User* const primary_user = |
| 198 user_manager::UserManager::Get()->GetPrimaryUser(); | 198 user_manager::UserManager::Get()->GetPrimaryUser(); |
| 199 Profile* const profile = | 199 Profile* const profile = |
| 200 chromeos::ProfileHelper::Get()->GetProfileByUser(primary_user); | 200 chromeos::ProfileHelper::Get()->GetProfileByUser(primary_user); |
| 201 policy_service_ = | 201 policy_service_ = |
| 202 policy::ProfilePolicyConnectorFactory::GetForBrowserContext(profile) | 202 policy::ProfilePolicyConnectorFactory::GetForBrowserContext(profile) |
| 203 ->policy_service(); | 203 ->policy_service(); |
| 204 } | 204 } |
| 205 | 205 |
| 206 } // namespace arc | 206 } // namespace arc |
| OLD | NEW |