Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(645)

Side by Side Diff: chrome/browser/component_updater/sth_set_component_installer.h

Issue 1853753003: Certificate Transparency: New component for obtaining fresh STHs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing review comments Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 CHROME_BROWSER_COMPONENT_UPDATER_STH_SET_COMPONENT_INSTALLER_H_
6 #define CHROME_BROWSER_COMPONENT_UPDATER_STH_SET_COMPONENT_INSTALLER_H_
7
8 #include <stdint.h>
9
10 #include <string>
11 #include <vector>
12
13 #include "base/gtest_prod_util.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "components/component_updater/default_component_installer.h"
16
17 namespace base {
18 class FilePath;
19 class Value;
20 } // namespace base
21
22 namespace net {
23 namespace ct {
24 class STHObserver;
25 } // namespace ct
26 } // namespace net
27
28 namespace component_updater {
29
30 class ComponentUpdateService;
31
32 // Component for receiving Signed Tree Heads updates for Certificate
33 // Transparency logs recognized in Chrome.
34 // The STHs are in JSON format.
35 // To identify the log each STH belongs to, the name of the file is
36 // hex-encoded Log ID of the log that produced this STH.
37 //
38 // Notifications of each of the new STHs are sent to the net::ct::STHObserver,
39 // so that it can take appropriate steps, including possible persistence.
40 class STHSetComponentInstallerTraits : public ComponentInstallerTraits {
41 public:
42 // The |sth_distributor| will be notified each time a new STH is observed.
43 explicit STHSetComponentInstallerTraits(
44 scoped_ptr<net::ct::STHObserver> sth_observer);
45 ~STHSetComponentInstallerTraits() override;
46
47 private:
48 friend class STHSetComponentInstallerTest;
49
50 // ComponentInstallerTraits implementation.
51 bool CanAutoUpdate() const override;
52 bool RequiresNetworkEncryption() const override;
53 bool OnCustomInstall(const base::DictionaryValue& manifest,
54 const base::FilePath& install_dir) override;
55 bool VerifyInstallation(const base::DictionaryValue& manifest,
56 const base::FilePath& install_dir) const override;
57 void ComponentReady(const base::Version& version,
58 const base::FilePath& install_dir,
59 scoped_ptr<base::DictionaryValue> manifest) override;
60 base::FilePath GetBaseDirectory() const override;
61 void GetHash(std::vector<uint8_t>* hash) const override;
62 std::string GetName() const override;
63
64 // Reads and parses the on-disk json.
65 void LoadSTHsFromDisk(const base::FilePath& sths_file_path,
66 const base::Version& version);
67
68 // Handle successful parsing of JSON by distributing the new STH.
69 void OnJsonParseSuccess(const std::string& log_id,
70 scoped_ptr<base::Value> parsed_json);
71
72 // STH parsing failed - do nothing.
73 void OnJsonParseError(const std::string& log_id, const std::string& error);
74
75 scoped_ptr<net::ct::STHObserver> sth_observer_;
76
77 DISALLOW_COPY_AND_ASSIGN(STHSetComponentInstallerTraits);
78 };
79
80 void RegisterSTHSetComponent(ComponentUpdateService* cus,
81 const base::FilePath& user_data_dir);
82
83 } // namespace component_updater
84
85 #endif // CHROME_BROWSER_COMPONENT_UPDATER_STH_SET_COMPONENT_INSTALLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698