Chromium Code Reviews| 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/files/file_path.h" | |
| 11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 12 #include "chrome/browser/component_updater/component_updater_service.h" | 13 #include "chrome/browser/component_updater/component_updater_service.h" |
| 13 | 14 |
| 14 namespace base { | 15 namespace base { |
| 15 class DictionaryValue; | 16 class DictionaryValue; |
| 16 class FilePath; | 17 class FilePath; |
| 17 } | 18 } |
| 18 | 19 |
| 19 namespace net { | 20 namespace net { |
| 20 class CRLSet; | 21 class CRLSet; |
| 21 } | 22 } |
| 22 | 23 |
| 23 class CRLSetFetcher : public component_updater::ComponentInstaller, | 24 class CRLSetFetcher : public component_updater::ComponentInstaller, |
| 24 public base::RefCountedThreadSafe<CRLSetFetcher> { | 25 public base::RefCountedThreadSafe<CRLSetFetcher> { |
| 25 public: | 26 public: |
| 26 CRLSetFetcher(); | 27 CRLSetFetcher(); |
| 27 | 28 |
| 28 void StartInitialLoad(component_updater::ComponentUpdateService* cus); | 29 void StartInitialLoad(component_updater::ComponentUpdateService* cus); |
| 29 | 30 |
| 31 void StartInitialLoadWithHash(component_updater::ComponentUpdateService* cus, | |
| 32 const std::string& user_id_hash); | |
|
Ryan Sleevi
2014/07/16 19:39:28
This seems like a very ChromeOS-specific concept,
| |
| 33 | |
| 30 // DeleteFromDisk asynchronously delete the CRLSet file. | 34 // DeleteFromDisk asynchronously delete the CRLSet file. |
| 31 void DeleteFromDisk(); | 35 void DeleteFromDisk(); |
| 32 | 36 |
| 33 // ComponentInstaller interface | 37 // ComponentInstaller interface |
| 34 virtual void OnUpdateError(int error) OVERRIDE; | 38 virtual void OnUpdateError(int error) OVERRIDE; |
| 35 virtual bool Install(const base::DictionaryValue& manifest, | 39 virtual bool Install(const base::DictionaryValue& manifest, |
| 36 const base::FilePath& unpack_path) OVERRIDE; | 40 const base::FilePath& unpack_path) OVERRIDE; |
| 37 virtual bool GetInstalledFile(const std::string& file, | 41 virtual bool GetInstalledFile(const std::string& file, |
| 38 base::FilePath* installed_file) OVERRIDE; | 42 base::FilePath* installed_file) OVERRIDE; |
| 39 | 43 |
| 40 private: | 44 private: |
| 41 friend class base::RefCountedThreadSafe<CRLSetFetcher>; | 45 friend class base::RefCountedThreadSafe<CRLSetFetcher>; |
| 42 | 46 |
| 43 virtual ~CRLSetFetcher(); | 47 virtual ~CRLSetFetcher(); |
| 44 | 48 |
| 45 // GetCRLSetbase::FilePath gets the path of the CRL set file in the user data | 49 // GetCRLSetbase::FilePath gets the path of the CRL set file in the user data |
| 46 // dir. | 50 // dir. |
| 47 bool GetCRLSetFilePath(base::FilePath* path) const; | 51 base::FilePath GetCRLSetFilePath() const; |
| 52 | |
| 53 // Set the path of the CRL set file in the user data dir. | |
|
Jorge Lucangeli Obes
2014/07/16 16:36:34
"Sets", comments are usually not written in impera
| |
| 54 // Optional |user_id_hash| that is used by ChromeOS. | |
|
Jorge Lucangeli Obes
2014/07/16 16:36:34
"Chrome OS" with a space.
| |
| 55 bool SetCRLSetFilePath(const std::string* user_id_hash); | |
| 56 | |
| 57 // Posts DoInitialLoadFromDisk to the FILE Thread. | |
| 58 void PostInitialLoad(component_updater::ComponentUpdateService* cus); | |
| 48 | 59 |
| 49 // DoInitialLoadFromDisk runs on the FILE thread and attempts to load a CRL | 60 // DoInitialLoadFromDisk runs on the FILE thread and attempts to load a CRL |
| 50 // set from the user-data dir. It then registers this object as a component | 61 // set from the user-data dir. It then registers this object as a component |
| 51 // in order to get updates. | 62 // in order to get updates. |
| 52 void DoInitialLoadFromDisk(); | 63 void DoInitialLoadFromDisk(); |
| 53 | 64 |
| 54 // LoadFromDisk runs on the FILE thread and attempts to load a CRL set | 65 // LoadFromDisk runs on the FILE thread and attempts to load a CRL set |
| 55 // from |load_from|. | 66 // from |load_from|. |
| 56 void LoadFromDisk(base::FilePath load_from, | 67 void LoadFromDisk(base::FilePath load_from, |
| 57 scoped_refptr<net::CRLSet>* out_crl_set); | 68 scoped_refptr<net::CRLSet>* out_crl_set); |
| 58 | 69 |
| 59 // SetCRLSetIfNewer runs on the IO thread and installs a CRL set | 70 // SetCRLSetIfNewer runs on the IO thread and installs a CRL set |
| 60 // as the global CRL set if it's newer than the existing one. | 71 // as the global CRL set if it's newer than the existing one. |
| 61 void SetCRLSetIfNewer(scoped_refptr<net::CRLSet> crl_set); | 72 void SetCRLSetIfNewer(scoped_refptr<net::CRLSet> crl_set); |
| 62 | 73 |
| 63 // RegisterComponent registers this object as a component updater. | 74 // RegisterComponent registers this object as a component updater. |
| 64 void RegisterComponent(uint32 sequence_of_loaded_crl); | 75 void RegisterComponent(uint32 sequence_of_loaded_crl); |
| 65 | 76 |
| 66 // DoDeleteFromDisk runs on the FILE thread and removes the CRLSet file from | 77 // DoDeleteFromDisk runs on the FILE thread and removes the CRLSet file from |
| 67 // the disk. | 78 // the disk. |
| 68 void DoDeleteFromDisk(); | 79 void DoDeleteFromDisk(); |
| 69 | 80 |
| 70 component_updater::ComponentUpdateService* cus_; | 81 component_updater::ComponentUpdateService* cus_; |
| 71 | 82 |
| 83 // Path where CRL file is stored. | |
| 84 base::FilePath crl_path_; | |
| 85 | |
| 72 // We keep a pointer to the current CRLSet for use on the FILE thread when | 86 // We keep a pointer to the current CRLSet for use on the FILE thread when |
| 73 // applying delta updates. | 87 // applying delta updates. |
| 74 scoped_refptr<net::CRLSet> crl_set_; | 88 scoped_refptr<net::CRLSet> crl_set_; |
| 75 | 89 |
| 76 DISALLOW_COPY_AND_ASSIGN(CRLSetFetcher); | 90 DISALLOW_COPY_AND_ASSIGN(CRLSetFetcher); |
| 77 }; | 91 }; |
| 78 | 92 |
| 79 #endif // CHROME_BROWSER_NET_CRL_SET_FETCHER_H_ | 93 #endif // CHROME_BROWSER_NET_CRL_SET_FETCHER_H_ |
| OLD | NEW |