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

Side by Side Diff: remoting/host/policy_watcher.cc

Issue 2847853003: Remove policy watching from It2MeHost. (Closed)
Patch Set: Remove pending policies from It2MeNativeMessagingHost and add an accessor to PolicyWatcher. Created 3 years, 7 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 unified diff | Download patch
OLDNEW
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 // Most of this code is copied from: 5 // Most of this code is copied from:
6 // src/chrome/browser/policy/asynchronous_policy_loader.{h,cc} 6 // src/chrome/browser/policy/asynchronous_policy_loader.{h,cc}
7 7
8 #include "remoting/host/policy_watcher.h" 8 #include "remoting/host/policy_watcher.h"
9 9
10 #include <utility> 10 #include <utility>
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 151
152 // Listen for future policy changes. 152 // Listen for future policy changes.
153 policy_service_->AddObserver(policy::POLICY_DOMAIN_CHROME, this); 153 policy_service_->AddObserver(policy::POLICY_DOMAIN_CHROME, this);
154 154
155 // Process current policy state. 155 // Process current policy state.
156 if (policy_service_->IsInitializationComplete(policy::POLICY_DOMAIN_CHROME)) { 156 if (policy_service_->IsInitializationComplete(policy::POLICY_DOMAIN_CHROME)) {
157 OnPolicyServiceInitialized(policy::POLICY_DOMAIN_CHROME); 157 OnPolicyServiceInitialized(policy::POLICY_DOMAIN_CHROME);
158 } 158 }
159 } 159 }
160 160
161 std::unique_ptr<base::DictionaryValue> PolicyWatcher::GetCurrentPolicies() {
162 return old_policies_->CreateDeepCopy();
163 }
164
161 void PolicyWatcher::SignalPolicyError() { 165 void PolicyWatcher::SignalPolicyError() {
162 old_policies_->Clear(); 166 old_policies_->Clear();
163 policy_error_callback_.Run(); 167 policy_error_callback_.Run();
164 } 168 }
165 169
166 PolicyWatcher::PolicyWatcher( 170 PolicyWatcher::PolicyWatcher(
167 policy::PolicyService* policy_service, 171 policy::PolicyService* policy_service,
168 std::unique_ptr<policy::PolicyService> owned_policy_service, 172 std::unique_ptr<policy::PolicyService> owned_policy_service,
169 std::unique_ptr<policy::ConfigurationPolicyProvider> owned_policy_provider, 173 std::unique_ptr<policy::ConfigurationPolicyProvider> owned_policy_provider,
170 std::unique_ptr<policy::SchemaRegistry> owned_schema_registry) 174 std::unique_ptr<policy::SchemaRegistry> owned_schema_registry)
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 return PolicyWatcher::CreateFromPolicyLoader(std::move(policy_loader)); 393 return PolicyWatcher::CreateFromPolicyLoader(std::move(policy_loader));
390 #endif // !(OS_CHROMEOS) 394 #endif // !(OS_CHROMEOS)
391 } 395 }
392 396
393 std::unique_ptr<PolicyWatcher> PolicyWatcher::CreateFromPolicyLoaderForTesting( 397 std::unique_ptr<PolicyWatcher> PolicyWatcher::CreateFromPolicyLoaderForTesting(
394 std::unique_ptr<policy::AsyncPolicyLoader> async_policy_loader) { 398 std::unique_ptr<policy::AsyncPolicyLoader> async_policy_loader) {
395 return CreateFromPolicyLoader(std::move(async_policy_loader)); 399 return CreateFromPolicyLoader(std::move(async_policy_loader));
396 } 400 }
397 401
398 } // namespace remoting 402 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698