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

Side by Side Diff: chromeos/network/client_cert_resolver.h

Issue 2608073003: Use TaskScheduler instead of WorkerPool in client_cert_resolver.cc. (Closed)
Patch Set: Created 3 years, 11 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROMEOS_NETWORK_CLIENT_CERT_RESOLVER_H_ 5 #ifndef CHROMEOS_NETWORK_CLIENT_CERT_RESOLVER_H_
6 #define CHROMEOS_NETWORK_CLIENT_CERT_RESOLVER_H_ 6 #define CHROMEOS_NETWORK_CLIENT_CERT_RESOLVER_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/ref_counted.h"
14 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
15 #include "base/observer_list.h" 14 #include "base/observer_list.h"
16 #include "base/time/time.h" 15 #include "base/time/time.h"
17 #include "chromeos/cert_loader.h" 16 #include "chromeos/cert_loader.h"
18 #include "chromeos/chromeos_export.h" 17 #include "chromeos/chromeos_export.h"
19 #include "chromeos/network/client_cert_util.h" 18 #include "chromeos/network/client_cert_util.h"
20 #include "chromeos/network/network_policy_observer.h" 19 #include "chromeos/network/network_policy_observer.h"
21 #include "chromeos/network/network_state_handler.h" 20 #include "chromeos/network/network_state_handler.h"
22 #include "chromeos/network/network_state_handler_observer.h" 21 #include "chromeos/network/network_state_handler_observer.h"
23 22
24 namespace base { 23 namespace base {
25 class Clock; 24 class Clock;
26 class TaskRunner;
27 } 25 }
28 26
29 namespace chromeos { 27 namespace chromeos {
30 28
31 class NetworkState; 29 class NetworkState;
32 class ManagedNetworkConfigurationHandler; 30 class ManagedNetworkConfigurationHandler;
33 31
34 // Observes the known networks. If a network is configured with a client 32 // Observes the known networks. If a network is configured with a client
35 // certificate pattern, this class searches for a matching client certificate. 33 // certificate pattern, this class searches for a matching client certificate.
36 // Each time it finds a match, it configures the network accordingly. 34 // Each time it finds a match, it configures the network accordingly.
(...skipping 17 matching lines...) Expand all
54 private: 52 private:
55 DISALLOW_ASSIGN(Observer); 53 DISALLOW_ASSIGN(Observer);
56 }; 54 };
57 55
58 ClientCertResolver(); 56 ClientCertResolver();
59 ~ClientCertResolver() override; 57 ~ClientCertResolver() override;
60 58
61 void Init(NetworkStateHandler* network_state_handler, 59 void Init(NetworkStateHandler* network_state_handler,
62 ManagedNetworkConfigurationHandler* managed_network_config_handler); 60 ManagedNetworkConfigurationHandler* managed_network_config_handler);
63 61
64 // Sets the task runner that any slow calls will be made from, e.g. calls
65 // to the NSS database. If not set, uses base::WorkerPool.
66 void SetSlowTaskRunnerForTest(
67 const scoped_refptr<base::TaskRunner>& task_runner);
68
69 void AddObserver(Observer* observer); 62 void AddObserver(Observer* observer);
70 void RemoveObserver(Observer* observer); 63 void RemoveObserver(Observer* observer);
71 64
72 // Returns true if any resolve tasks are running. Every time a task finishes 65 // Returns true if any resolve tasks are running. Every time a task finishes
73 // and no further requests are pending, a notification is sent, see 66 // and no further requests are pending, a notification is sent, see
74 // |Observer|. 67 // |Observer|.
75 bool IsAnyResolveTaskRunning() const; 68 bool IsAnyResolveTaskRunning() const;
76 69
77 // Sets the clock for testing. This clock is used when checking the 70 // Sets the clock for testing. This clock is used when checking the
78 // certificates for expiration. 71 // certificates for expiration.
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 // True if any network properties were changed since the last notification to 130 // True if any network properties were changed since the last notification to
138 // observers. 131 // observers.
139 bool network_properties_changed_; 132 bool network_properties_changed_;
140 133
141 // Unowned associated (global or test) instance. 134 // Unowned associated (global or test) instance.
142 NetworkStateHandler* network_state_handler_; 135 NetworkStateHandler* network_state_handler_;
143 136
144 // Unowned associated (global or test) instance. 137 // Unowned associated (global or test) instance.
145 ManagedNetworkConfigurationHandler* managed_network_config_handler_; 138 ManagedNetworkConfigurationHandler* managed_network_config_handler_;
146 139
147 // TaskRunner for slow tasks.
148 scoped_refptr<base::TaskRunner> slow_task_runner_for_test_;
149
150 // Can be set for testing. 140 // Can be set for testing.
151 base::Clock* testing_clock_; 141 base::Clock* testing_clock_;
152 142
153 base::WeakPtrFactory<ClientCertResolver> weak_ptr_factory_; 143 base::WeakPtrFactory<ClientCertResolver> weak_ptr_factory_;
154 144
155 DISALLOW_COPY_AND_ASSIGN(ClientCertResolver); 145 DISALLOW_COPY_AND_ASSIGN(ClientCertResolver);
156 }; 146 };
157 147
158 } // namespace chromeos 148 } // namespace chromeos
159 149
160 #endif // CHROMEOS_NETWORK_CLIENT_CERT_RESOLVER_H_ 150 #endif // CHROMEOS_NETWORK_CLIENT_CERT_RESOLVER_H_
OLDNEW
« no previous file with comments | « chromeos/network/auto_connect_handler_unittest.cc ('k') | chromeos/network/client_cert_resolver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698