OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 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 #ifndef CHROMEOS_NETWORK_CLIENT_CERT_RESOLVER_H_ | |
6 #define CHROMEOS_NETWORK_CLIENT_CERT_RESOLVER_H_ | |
7 | |
8 #include <string> | |
9 #include <vector> | |
10 | |
11 #include "base/basictypes.h" | |
12 #include "base/memory/ref_counted.h" | |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "base/memory/weak_ptr.h" | |
15 #include "chromeos/cert_loader.h" | |
16 #include "chromeos/chromeos_export.h" | |
17 #include "chromeos/network/network_policy_observer.h" | |
18 #include "chromeos/network/network_state_handler_observer.h" | |
19 | |
20 namespace base { | |
21 class TaskRunner; | |
22 } | |
23 | |
24 namespace chromeos { | |
25 | |
26 class NetworkState; | |
27 class NetworkStateHandler; | |
28 class ManagedNetworkConfigurationHandler; | |
29 | |
30 // Resolve client certificate patterns. | |
31 class CHROMEOS_EXPORT ClientCertResolver : public NetworkStateHandlerObserver, | |
32 public CertLoader::Observer, | |
33 public NetworkPolicyObserver { | |
34 public: | |
35 struct NetworkAndMatchingCert; | |
stevenjb
2013/08/07 19:04:51
Should be private?
pneubeck (no reviews)
2013/08/08 12:41:03
it's public so that FindCertificateMatches (in the
stevenjb
2013/08/08 16:35:11
Yeah, it's a bit confusing. Maybe add a comment. O
| |
36 | |
37 ClientCertResolver(); | |
38 virtual ~ClientCertResolver(); | |
stevenjb
2013/08/07 19:04:51
WS
pneubeck (no reviews)
2013/08/08 12:41:03
Done.
| |
39 void Init(NetworkStateHandler* network_state_handler, | |
40 ManagedNetworkConfigurationHandler* managed_network_config_handler); | |
41 | |
42 // Sets the task runner that any slow calls will be made from, e.g. calls | |
43 // to the NSS database. If not set, uses base::WorkerPool. | |
44 void SetSlowTaskRunnerForTest( | |
45 const scoped_refptr<base::TaskRunner>& task_runner); | |
46 | |
47 private: | |
48 typedef std::vector<const NetworkState*> NetworkStateList; | |
49 | |
50 // NetworkStateHandlerObserver overrides | |
51 virtual void NetworkListChanged() OVERRIDE; | |
52 | |
53 // CertLoader::Observer overrides | |
54 virtual void OnCertificatesLoaded(const net::CertificateList& cert_list, | |
55 bool initial_load) OVERRIDE; | |
56 | |
57 // NetworkPolicyObserver overrides | |
58 virtual void PolicyApplied(const std::string& service_path) OVERRIDE; | |
59 | |
60 void ResolveNetworks(const NetworkStateList& networks); | |
61 void ConfigureCertificates(std::vector<NetworkAndMatchingCert>* matches); | |
62 | |
63 // The set of networks that were checked/resolved in previous passes. These | |
64 // networks are skipped in the NetworkListChanged notification. | |
65 std::set<std::string> resolved_networks_; | |
66 | |
67 // Unowned associated (global or test) instance. | |
68 NetworkStateHandler* network_state_handler_; | |
69 | |
70 // Unowned associated (global or test) instance. | |
71 ManagedNetworkConfigurationHandler* managed_network_config_handler_; | |
72 | |
73 // TaskRunner for slow tasks. | |
74 scoped_refptr<base::TaskRunner> slow_task_runner_for_test_; | |
75 | |
76 base::WeakPtrFactory<ClientCertResolver> weak_ptr_factory_; | |
77 | |
78 DISALLOW_COPY_AND_ASSIGN(ClientCertResolver); | |
79 }; | |
80 | |
81 } // namespace chromeos | |
82 | |
83 #endif // CHROMEOS_NETWORK_CLIENT_CERT_RESOLVER_H_ | |
OLD | NEW |