Componentize AccountReconcilor.
[chromium-blink-merge.git] / chrome / browser / net / crl_set_fetcher.h
blob28b224a4d93b8d51cf127af092ce7f76a6a0a1e4
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_
8 #include <string>
10 #include "base/compiler_specific.h"
11 #include "base/memory/ref_counted.h"
12 #include "chrome/browser/component_updater/component_updater_service.h"
14 namespace base {
15 class DictionaryValue;
16 class FilePath;
19 namespace net {
20 class CRLSet;
23 class CRLSetFetcher : public component_updater::ComponentInstaller,
24 public base::RefCountedThreadSafe<CRLSetFetcher> {
25 public:
26 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;
37 private:
38 friend class base::RefCountedThreadSafe<CRLSetFetcher>;
40 virtual ~CRLSetFetcher();
42 // GetCRLSetbase::FilePath gets the path of the CRL set file in the user data
43 // dir.
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
52 // from |load_from|.
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_