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

Unified Diff: chrome/browser/chromeos/policy/network_policy_service.h

Issue 24153012: Fix cyclic dependency between ProfilePolicyConnector and PrefService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix/Extend NetworkConfigurationUpdater unit test. Created 7 years, 1 month 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: chrome/browser/chromeos/policy/network_policy_service.h
diff --git a/chrome/browser/chromeos/policy/network_policy_service.h b/chrome/browser/chromeos/policy/network_policy_service.h
new file mode 100644
index 0000000000000000000000000000000000000000..8b7ac78ae806999ceacdca421c2cb2198da5385c
--- /dev/null
+++ b/chrome/browser/chromeos/policy/network_policy_service.h
@@ -0,0 +1,78 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_CHROMEOS_POLICY_NETWORK_POLICY_SERVICE_H_
+#define CHROME_BROWSER_CHROMEOS_POLICY_NETWORK_POLICY_SERVICE_H_
+
+#include <vector>
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
+#include "chrome/browser/chromeos/policy/user_network_configuration_updater.h"
+#include "components/browser_context_keyed_service/browser_context_keyed_service.h"
+
+class PrefService;
+
+namespace chromeos {
+class User;
Joao da Silva 2013/11/11 12:38:19 not used
pneubeck (no reviews) 2013/11/12 10:07:53 Done.
+}
+
+namespace net {
+class X509Certificate;
+typedef std::vector<scoped_refptr<X509Certificate> > CertificateList;
Joao da Silva 2013/11/11 12:38:19 #include ref_counted.h
pneubeck (no reviews) 2013/11/12 10:07:53 Done.
+}
+
+namespace policy {
+
+class PolicyCertVerifier;
+class PolicyService;
Joao da Silva 2013/11/11 12:38:19 not used
pneubeck (no reviews) 2013/11/12 10:07:53 Done.
+
+// This service is the counterpart of PolicyCertVerifier on the UI thread. It's
+// responsible for pushing the current list of trust anchors to the CertVerifier
+// and marking the profile's prefs if any of the trust anchors was used.
+// Except for unit tests, PolicyCertVerifier should only be created through this
+// class.
+class NetworkPolicyService
+ : public BrowserContextKeyedService,
+ public UserNetworkConfigurationUpdater::WebTrustedCertsObserver {
+ public:
+ NetworkPolicyService(UserNetworkConfigurationUpdater* net_conf_updater,
+ PrefService* user_prefs);
+ virtual ~NetworkPolicyService();
+
+ // Creates an associated PolicyCertVerifier. The returned object must only be
+ // used on the IO thread and must outlive this object.
+ scoped_ptr<PolicyCertVerifier> CreatePolicyCertVerifier();
+
+ // Returns true if the profile with |user_prefs| has used certificates
+ // installed via policy to establish a secure connection before. This means
+ // that it may have cached content from an untrusted source.
+ bool UsedPolicyCertificates() const;
+
+ // UserNetworkConfigurationUpdater::WebTrustedCertsObserver:
+ virtual void OnTrustAnchorsChanged(const net::CertificateList& trust_anchors)
+ OVERRIDE;
+
+ // BrowserContextKeyedService:
+ virtual void Shutdown() OVERRIDE;
+
+ private:
+ void SetUsedPolicyCertificatesOnce();
+
+ PolicyCertVerifier* cert_verifier_;
+ UserNetworkConfigurationUpdater* net_conf_updater_;
+ PrefService* user_prefs_;
+
+ // Weak pointers to handle callbacks from PolicyCertVerifier on the IO thread.
+ // The factory and the created WeakPtrs must only be used on the UI thread.
+ base::WeakPtrFactory<NetworkPolicyService> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(NetworkPolicyService);
+};
+
+} // namespace policy
+
+#endif // CHROME_BROWSER_CHROMEOS_POLICY_NETWORK_POLICY_SERVICE_H_

Powered by Google App Engine
This is Rietveld 408576698