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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_NET_CRL_SET_FETCHER_H_
6 #define CHROME_BROWSER_NET_CRL_SET_FETCHER_H_
10 #include "base/compiler_specific.h"
11 #include "base/memory/ref_counted.h"
12 #include "chrome/browser/component_updater/component_updater_service.h"
15 class DictionaryValue
;
23 class CRLSetFetcher
: public component_updater::ComponentInstaller
,
24 public base::RefCountedThreadSafe
<CRLSetFetcher
> {
28 void StartInitialLoad(component_updater::ComponentUpdateService
* cus
);
30 // ComponentInstaller interface
31 virtual void OnUpdateError(int error
) OVERRIDE
;
32 virtual bool Install(const base::DictionaryValue
& manifest
,
33 const base::FilePath
& unpack_path
) OVERRIDE
;
34 virtual bool GetInstalledFile(const std::string
& file
,
35 base::FilePath
* installed_file
) OVERRIDE
;
38 friend class base::RefCountedThreadSafe
<CRLSetFetcher
>;
40 virtual ~CRLSetFetcher();
42 // GetCRLSetbase::FilePath gets the path of the CRL set file in the user data
44 bool GetCRLSetFilePath(base::FilePath
* path
) const;
46 // DoInitialLoadFromDisk runs on the FILE thread and attempts to load a CRL
47 // set from the user-data dir. It then registers this object as a component
48 // in order to get updates.
49 void DoInitialLoadFromDisk();
51 // LoadFromDisk runs on the FILE thread and attempts to load a CRL set
53 void LoadFromDisk(base::FilePath load_from
,
54 scoped_refptr
<net::CRLSet
>* out_crl_set
);
56 // SetCRLSetIfNewer runs on the IO thread and installs a CRL set
57 // as the global CRL set if it's newer than the existing one.
58 void SetCRLSetIfNewer(scoped_refptr
<net::CRLSet
> crl_set
);
60 // RegisterComponent registers this object as a component updater.
61 void RegisterComponent(uint32 sequence_of_loaded_crl
);
63 component_updater::ComponentUpdateService
* cus_
;
65 // We keep a pointer to the current CRLSet for use on the FILE thread when
66 // applying delta updates.
67 scoped_refptr
<net::CRLSet
> crl_set_
;
69 DISALLOW_COPY_AND_ASSIGN(CRLSetFetcher
);
72 #endif // CHROME_BROWSER_NET_CRL_SET_FETCHER_H_