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

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: 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 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..9218af10aeaae68c0c6ecec3f4bf3393e6eaaf5e
--- /dev/null
+++ b/chrome/browser/chromeos/policy/network_policy_service.h
@@ -0,0 +1,81 @@
+// 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/callback.h"
+#include "base/compiler_specific.h"
+#include "base/memory/scoped_ptr.h"
+#include "components/browser_context_keyed_service/browser_context_keyed_service.h"
+
+class PrefService;
+
+namespace chromeos {
+class User;
+}
+
+namespace net {
+class X509Certificate;
+typedef std::vector<scoped_refptr<X509Certificate> > CertificateList;
+}
+
+namespace policy {
+
+class PolicyCertVerifier;
+class PolicyService;
+class UserNetworkConfigurationUpdater;
+
+// This service manages the per-Profile network policy components, this includes
+// certificates.
+class NetworkPolicyService : public BrowserContextKeyedService {
+ public:
+ NetworkPolicyService(bool allow_trusted_certs_from_policy,
+ const chromeos::User& user,
+ PrefService* user_prefs,
+ PolicyService* policy_service);
+ virtual ~NetworkPolicyService();
+
+ // Adds a CertVerifier on which the current list of Web trusted server and
+ // CA certificates will be set. Policy updates will trigger further calls to
+ // |cert_verifier| later. |cert_verifier| must be valid until it's removed
+ // with RemovePolicyCertVerifier. Calls to |cert_verifier| will happen on the
+ // IO thread. This function must be called on the UI thread.
+ void AddPolicyCertVerifier(PolicyCertVerifier* cert_verifier);
+
+ // Removes |cert_verifier| from further notifications.
+ void RemovePolicyCertVerifier(PolicyCertVerifier* cert_verifier);
+
+ // Returns a callback that should be called if a policy installed certificate
+ // was trusted for the associated profile. Must not be called after this
+ // object is destructed.
+ base::Closure GetPolicyCertTrustedCallback();
+
+ // Sets |certs| to the list of Web trusted server and CA certificates from the
+ // last received ONC user policy.
+ void GetWebTrustedCertificates(net::CertificateList* certs) const;
+
+ // 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;
+
+ // BrowserContextKeyedService:
+ virtual void Shutdown() OVERRIDE;
+
+ private:
+ void SetUsedPolicyCertificatesOnce();
+
+ PrefService* user_prefs_;
+ scoped_ptr<UserNetworkConfigurationUpdater> network_configuration_updater_;
+
+ 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