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

Side by Side Diff: chrome/browser/chromeos/policy/network_policy_service.cc

Issue 24153012: Fix cyclic dependency between ProfilePolicyConnector and PrefService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed another bug for OTRProfile. Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/chromeos/policy/network_policy_service.h"
6
7 #include "base/bind.h"
8 #include "base/bind_helpers.h"
9 #include "base/logging.h"
10 #include "base/prefs/pref_service.h"
11 #include "chrome/browser/chromeos/policy/user_network_configuration_updater.h"
12 #include "chrome/common/pref_names.h"
13 #include "chromeos/network/network_handler.h"
14 #include "chromeos/network/onc/onc_certificate_importer_impl.h"
15
16 namespace policy {
17
18 NetworkPolicyService::~NetworkPolicyService() {}
19
20 NetworkPolicyService::NetworkPolicyService(bool allow_trusted_certs_from_policy,
21 const chromeos::User& user,
22 PrefService* user_prefs,
23 PolicyService* policy_service)
24 : user_prefs_(user_prefs) {
25 DCHECK(user_prefs_);
26 network_configuration_updater_ =
27 UserNetworkConfigurationUpdater::CreateForUserPolicy(
28 allow_trusted_certs_from_policy,
29 user,
30 scoped_ptr<chromeos::onc::CertificateImporter>(
31 new chromeos::onc::CertificateImporterImpl),
32 policy_service,
33 chromeos::NetworkHandler::Get()
34 ->managed_network_configuration_handler());
35 }
36
37 void NetworkPolicyService::AddPolicyCertVerifier(
38 PolicyCertVerifier* cert_verifier) {
39 network_configuration_updater_->AddPolicyCertVerifier(cert_verifier);
40 }
41
42 void NetworkPolicyService::RemovePolicyCertVerifier(
43 PolicyCertVerifier* cert_verifier) {
44 network_configuration_updater_->RemovePolicyCertVerifier(cert_verifier);
45 }
46
47 base::Closure NetworkPolicyService::GetPolicyCertTrustedCallback() {
48 return base::Bind(&NetworkPolicyService::SetUsedPolicyCertificatesOnce,
49 base::Unretained(this));
50 }
51
52 void NetworkPolicyService::GetWebTrustedCertificates(
53 net::CertificateList* certs) const {
54 certs->clear();
55 network_configuration_updater_->GetWebTrustedCertificates(certs);
56 }
57
58 bool NetworkPolicyService::UsedPolicyCertificates() const {
59 return user_prefs_->GetBoolean(prefs::kUsedPolicyCertificatesOnce);
60 }
61
62 void NetworkPolicyService::Shutdown() {
63 network_configuration_updater_.reset();
64 user_prefs_ = NULL;
65 }
66
67 void NetworkPolicyService::SetUsedPolicyCertificatesOnce() {
68 user_prefs_->SetBoolean(prefs::kUsedPolicyCertificatesOnce, true);
69 }
70
71 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698