Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 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 COMPONENTS_CERTIFICATE_TRANSPARENCY_CT_POLICY_MANAGER_H_ | |
| 6 #define COMPONENTS_CERTIFICATE_TRANSPARENCY_CT_POLICY_MANAGER_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 #include "base/memory/ref_counted.h" | |
| 12 #include "base/memory/weak_ptr.h" | |
| 13 #include "components/prefs/pref_change_registrar.h" | |
| 14 #include "net/http/transport_security_state.h" | |
| 15 | |
| 16 namespace base { | |
| 17 class SequencedTaskRunner; | |
|
mmenke
2016/06/27 22:11:57
Should this be included explicitly? Seems like CT
Ryan Sleevi
2016/06/27 22:49:19
It doesn't need to be (only at call-site; you can
| |
| 18 } // base | |
| 19 | |
| 20 namespace user_prefs { | |
| 21 class PrefRegistrySyncable; | |
| 22 } // user_prefs | |
| 23 | |
| 24 namespace certificate_transparency { | |
| 25 | |
| 26 class CTPolicyManager { | |
|
mmenke
2016/06/27 22:11:57
Should document this class, and its lifetime and t
Ryan Sleevi
2016/06/27 22:49:19
Yeah; it's created on UI, shut down on UI, deleted
| |
| 27 public: | |
| 28 // Registers the preferences related to Certificate Transparency policy | |
| 29 // in the given pref registry. | |
| 30 static void RegisterPrefs(user_prefs::PrefRegistrySyncable* registry); | |
| 31 | |
| 32 explicit CTPolicyManager( | |
|
mmenke
2016/06/27 22:11:57
nit: Explicit not needed.
| |
| 33 PrefService* pref_service, | |
| 34 scoped_refptr<base::SequencedTaskRunner> network_task_runner); | |
| 35 ~CTPolicyManager(); | |
| 36 | |
| 37 void Shutdown(); | |
|
mmenke
2016/06/27 22:11:56
As used in ProfileIOData, its delegate on the UITh
Ryan Sleevi
2016/06/27 22:49:19
I'm perhaps not sure I understood your comment.
I
mmenke
2016/06/28 12:38:00
Right, I just wanted enough usage comments here th
| |
| 38 | |
| 39 // Gets the RequireCTDelegate() that responds based on the policies set | |
| 40 // via the pref service. This object MUST only be used on the network | |
| 41 // task runner provided, and MUST NOT be used after this object has | |
| 42 // been destructed. | |
| 43 net::TransportSecurityState::RequireCTDelegate* GetDelegate(); | |
| 44 | |
| 45 private: | |
| 46 class CTDelegate; | |
| 47 | |
| 48 // Schedules an update of the CTPolicyDelegate. As it's possible that | |
| 49 // multiple preferences may be updated at the same time, this exists to | |
| 50 // schedule only a single update. | |
| 51 void ScheduleUpdate(); | |
| 52 | |
| 53 // Performs the actual update of the CTPolicyDelegate once preference | |
| 54 // changes have quiesced. | |
| 55 void Update(); | |
| 56 | |
| 57 PrefChangeRegistrar pref_change_registrar_; | |
| 58 std::unique_ptr<CTDelegate> delegate_; | |
| 59 | |
| 60 base::WeakPtrFactory<CTPolicyManager> weak_factory_; | |
| 61 | |
| 62 DISALLOW_COPY_AND_ASSIGN(CTPolicyManager); | |
| 63 }; | |
| 64 | |
| 65 } // namespace certificate_transparency | |
| 66 | |
| 67 #endif // COMPONENTS_CERTIFICATE_TRANSPARENCY_CT_POLICY_MANAGER_H_ | |
| OLD | NEW |