| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_NET_CRL_SET_FETCHER_H_ | 5 #ifndef CHROME_BROWSER_NET_CRL_SET_FETCHER_H_ |
| 6 #define CHROME_BROWSER_NET_CRL_SET_FETCHER_H_ | 6 #define CHROME_BROWSER_NET_CRL_SET_FETCHER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "chrome/browser/component_updater/component_updater_service.h" | 12 #include "chrome/browser/component_updater/component_updater_service.h" |
| 13 | 13 |
| 14 class FilePath; | |
| 15 | |
| 16 namespace base { | 14 namespace base { |
| 17 class DictionaryValue; | 15 class DictionaryValue; |
| 16 class FilePath; |
| 18 } | 17 } |
| 19 | 18 |
| 20 namespace net { | 19 namespace net { |
| 21 class CRLSet; | 20 class CRLSet; |
| 22 } | 21 } |
| 23 | 22 |
| 24 class ComponentUpdateService; | 23 class ComponentUpdateService; |
| 25 | 24 |
| 26 class CRLSetFetcher : public ComponentInstaller, | 25 class CRLSetFetcher : public ComponentInstaller, |
| 27 public base::RefCountedThreadSafe<CRLSetFetcher> { | 26 public base::RefCountedThreadSafe<CRLSetFetcher> { |
| 28 public: | 27 public: |
| 29 CRLSetFetcher(); | 28 CRLSetFetcher(); |
| 30 | 29 |
| 31 void StartInitialLoad(ComponentUpdateService* cus); | 30 void StartInitialLoad(ComponentUpdateService* cus); |
| 32 | 31 |
| 33 // ComponentInstaller interface | 32 // ComponentInstaller interface |
| 34 virtual void OnUpdateError(int error) OVERRIDE; | 33 virtual void OnUpdateError(int error) OVERRIDE; |
| 35 virtual bool Install(base::DictionaryValue* manifest, | 34 virtual bool Install(base::DictionaryValue* manifest, |
| 36 const FilePath& unpack_path) OVERRIDE; | 35 const base::FilePath& unpack_path) OVERRIDE; |
| 37 | 36 |
| 38 private: | 37 private: |
| 39 friend class base::RefCountedThreadSafe<CRLSetFetcher>; | 38 friend class base::RefCountedThreadSafe<CRLSetFetcher>; |
| 40 | 39 |
| 41 virtual ~CRLSetFetcher(); | 40 virtual ~CRLSetFetcher(); |
| 42 | 41 |
| 43 // GetCRLSetFilePath gets the path of the CRL set file in the user data | 42 // GetCRLSetbase::FilePath gets the path of the CRL set file in the user data |
| 44 // dir. | 43 // dir. |
| 45 bool GetCRLSetFilePath(FilePath* path) const; | 44 bool GetCRLSetFilePath(base::FilePath* path) const; |
| 46 | 45 |
| 47 // DoInitialLoadFromDisk runs on the FILE thread and attempts to load a CRL | 46 // DoInitialLoadFromDisk runs on the FILE thread and attempts to load a CRL |
| 48 // set from the user-data dir. It then registers this object as a component | 47 // set from the user-data dir. It then registers this object as a component |
| 49 // in order to get updates. | 48 // in order to get updates. |
| 50 void DoInitialLoadFromDisk(); | 49 void DoInitialLoadFromDisk(); |
| 51 | 50 |
| 52 // LoadFromDisk runs on the FILE thread and attempts to load a CRL set | 51 // LoadFromDisk runs on the FILE thread and attempts to load a CRL set |
| 53 // from |load_from|. | 52 // from |load_from|. |
| 54 void LoadFromDisk(FilePath load_from, | 53 void LoadFromDisk(base::FilePath load_from, |
| 55 scoped_refptr<net::CRLSet>* out_crl_set); | 54 scoped_refptr<net::CRLSet>* out_crl_set); |
| 56 | 55 |
| 57 // SetCRLSetIfNewer runs on the IO thread and installs a CRL set | 56 // SetCRLSetIfNewer runs on the IO thread and installs a CRL set |
| 58 // as the global CRL set if it's newer than the existing one. | 57 // as the global CRL set if it's newer than the existing one. |
| 59 void SetCRLSetIfNewer(scoped_refptr<net::CRLSet> crl_set); | 58 void SetCRLSetIfNewer(scoped_refptr<net::CRLSet> crl_set); |
| 60 | 59 |
| 61 // RegisterComponent registers this object as a component updater. | 60 // RegisterComponent registers this object as a component updater. |
| 62 void RegisterComponent(uint32 sequence_of_loaded_crl); | 61 void RegisterComponent(uint32 sequence_of_loaded_crl); |
| 63 | 62 |
| 64 ComponentUpdateService* cus_; | 63 ComponentUpdateService* cus_; |
| 65 | 64 |
| 66 // We keep a pointer to the current CRLSet for use on the FILE thread when | 65 // We keep a pointer to the current CRLSet for use on the FILE thread when |
| 67 // applying delta updates. | 66 // applying delta updates. |
| 68 scoped_refptr<net::CRLSet> crl_set_; | 67 scoped_refptr<net::CRLSet> crl_set_; |
| 69 | 68 |
| 70 DISALLOW_COPY_AND_ASSIGN(CRLSetFetcher); | 69 DISALLOW_COPY_AND_ASSIGN(CRLSetFetcher); |
| 71 }; | 70 }; |
| 72 | 71 |
| 73 #endif // CHROME_BROWSER_NET_CRL_SET_FETCHER_H_ | 72 #endif // CHROME_BROWSER_NET_CRL_SET_FETCHER_H_ |
| OLD | NEW |