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

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

Issue 419013003: Replace c/b/nss_context by a KeyedService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added Linux implementation. Created 6 years, 3 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/user_network_configuration_updater.h
diff --git a/chrome/browser/chromeos/policy/user_network_configuration_updater.h b/chrome/browser/chromeos/policy/user_network_configuration_updater.h
index e5346651fed44e7c02a555195329c4cafae12a38..0f86d185624e5b63aa33c698c2844942f415e0e2 100644
--- a/chrome/browser/chromeos/policy/user_network_configuration_updater.h
+++ b/chrome/browser/chromeos/policy/user_network_configuration_updater.h
@@ -15,8 +15,6 @@
#include "base/observer_list.h"
#include "chrome/browser/chromeos/policy/network_configuration_updater.h"
#include "components/keyed_service/core/keyed_service.h"
-#include "content/public/browser/notification_observer.h"
-#include "content/public/browser/notification_registrar.h"
class Profile;
@@ -49,8 +47,7 @@ class PolicyService;
// expansion with the user's name (or email address, etc.) and handling of "Web"
// trust of certificates.
class UserNetworkConfigurationUpdater : public NetworkConfigurationUpdater,
- public KeyedService,
- public content::NotificationObserver {
+ public KeyedService {
public:
class WebTrustedCertsObserver {
public:
@@ -67,6 +64,8 @@ class UserNetworkConfigurationUpdater : public NetworkConfigurationUpdater,
// each policy change. Imported certificates, that request it, are only
// granted Web trust if |allow_trusted_certs_from_policy| is true. A reference
// to |user| is stored. It must outlive the returned updater.
+ // Until CreateAndSetCertificateImporter is called with the NSSCertDatabase of
+ // the user, no certificates are imported.
static scoped_ptr<UserNetworkConfigurationUpdater> CreateForUserPolicy(
Profile* profile,
bool allow_trusted_certs_from_policy,
@@ -81,6 +80,12 @@ class UserNetworkConfigurationUpdater : public NetworkConfigurationUpdater,
// last received policy.
void GetWebTrustedCertificates(net::CertificateList* certs) const;
+ // Initializes this updater with a new onc::CertificateImporter using
+ // |database| and starts importing certificates.
+ // Must be called exactly once after creation of the updater (or
+ // SetCertificateImporterForTest in case of unit tests).
+ void CreateAndSetCertificateImporter(net::NSSCertDatabase* database);
+
// Helper method to expose |SetCertificateImporter| for usage in tests.
void SetCertificateImporterForTest(
scoped_ptr<chromeos::onc::CertificateImporter> certificate_importer);
@@ -102,16 +107,6 @@ class UserNetworkConfigurationUpdater : public NetworkConfigurationUpdater,
base::ListValue* network_configs_onc,
base::DictionaryValue* global_network_config) OVERRIDE;
- // content::NotificationObserver implementation. Observes the profile to which
- // |this| belongs to for PROFILE_ADDED notification.
- virtual void Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) OVERRIDE;
-
- // Creates onc::CertImporter with |database| and passes it to
- // |SetCertificateImporter|.
- void CreateAndSetCertificateImporter(net::NSSCertDatabase* database);
-
// Sets the certificate importer that should be used to import certificate
// policies. If there is |pending_certificates_onc_|, it gets imported.
void SetCertificateImporter(
@@ -140,8 +135,6 @@ class UserNetworkConfigurationUpdater : public NetworkConfigurationUpdater,
// Set by |SetCertificateImporter|.
scoped_ptr<chromeos::onc::CertificateImporter> certificate_importer_;
- content::NotificationRegistrar registrar_;
-
base::WeakPtrFactory<UserNetworkConfigurationUpdater> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(UserNetworkConfigurationUpdater);

Powered by Google App Engine
This is Rietveld 408576698