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

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

Issue 2014573002: Certificate Transparency: Wire the TreeStateTracker up. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 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_COMPONENT_UPDATER_STH_SET_COMPONENT_INSTALLER_H_ 5 #ifndef CHROME_BROWSER_COMPONENT_UPDATER_STH_SET_COMPONENT_INSTALLER_H_
6 #define CHROME_BROWSER_COMPONENT_UPDATER_STH_SET_COMPONENT_INSTALLER_H_ 6 #define CHROME_BROWSER_COMPONENT_UPDATER_STH_SET_COMPONENT_INSTALLER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 22 matching lines...) Expand all
33 // Transparency logs recognized in Chrome. 33 // Transparency logs recognized in Chrome.
34 // The STHs are in JSON format. 34 // The STHs are in JSON format.
35 // To identify the log each STH belongs to, the name of the file is 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. 36 // hex-encoded Log ID of the log that produced this STH.
37 // 37 //
38 // Notifications of each of the new STHs are sent to the net::ct::STHObserver, 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. 39 // so that it can take appropriate steps, including possible persistence.
40 class STHSetComponentInstallerTraits : public ComponentInstallerTraits { 40 class STHSetComponentInstallerTraits : public ComponentInstallerTraits {
41 public: 41 public:
42 // The |sth_distributor| will be notified each time a new STH is observed. 42 // The |sth_distributor| will be notified each time a new STH is observed.
43 explicit STHSetComponentInstallerTraits( 43 explicit STHSetComponentInstallerTraits(net::ct::STHObserver* sth_observer);
44 std::unique_ptr<net::ct::STHObserver> sth_observer);
45 ~STHSetComponentInstallerTraits() override; 44 ~STHSetComponentInstallerTraits() override;
46 45
47 private: 46 private:
48 friend class STHSetComponentInstallerTest; 47 friend class STHSetComponentInstallerTest;
49 48
50 // ComponentInstallerTraits implementation. 49 // ComponentInstallerTraits implementation.
51 bool CanAutoUpdate() const override; 50 bool CanAutoUpdate() const override;
52 bool RequiresNetworkEncryption() const override; 51 bool RequiresNetworkEncryption() const override;
53 bool OnCustomInstall(const base::DictionaryValue& manifest, 52 bool OnCustomInstall(const base::DictionaryValue& manifest,
54 const base::FilePath& install_dir) override; 53 const base::FilePath& install_dir) override;
(...skipping 11 matching lines...) Expand all
66 void LoadSTHsFromDisk(const base::FilePath& sths_file_path, 65 void LoadSTHsFromDisk(const base::FilePath& sths_file_path,
67 const base::Version& version); 66 const base::Version& version);
68 67
69 // Handle successful parsing of JSON by distributing the new STH. 68 // Handle successful parsing of JSON by distributing the new STH.
70 void OnJsonParseSuccess(const std::string& log_id, 69 void OnJsonParseSuccess(const std::string& log_id,
71 std::unique_ptr<base::Value> parsed_json); 70 std::unique_ptr<base::Value> parsed_json);
72 71
73 // STH parsing failed - do nothing. 72 // STH parsing failed - do nothing.
74 void OnJsonParseError(const std::string& log_id, const std::string& error); 73 void OnJsonParseError(const std::string& log_id, const std::string& error);
75 74
76 std::unique_ptr<net::ct::STHObserver> sth_observer_; 75 net::ct::STHObserver* sth_observer_;
Sorin Jianu 2016/05/25 16:17:48 Would it be possible to use a smart pointer? Same
Eran Messeri 2016/05/25 16:26:18 The two smart pointers I could use here are: uniqu
77 76
78 DISALLOW_COPY_AND_ASSIGN(STHSetComponentInstallerTraits); 77 DISALLOW_COPY_AND_ASSIGN(STHSetComponentInstallerTraits);
79 }; 78 };
80 79
81 void RegisterSTHSetComponent(ComponentUpdateService* cus, 80 void RegisterSTHSetComponent(ComponentUpdateService* cus,
82 const base::FilePath& user_data_dir); 81 const base::FilePath& user_data_dir);
83 82
84 } // namespace component_updater 83 } // namespace component_updater
85 84
86 #endif // CHROME_BROWSER_COMPONENT_UPDATER_STH_SET_COMPONENT_INSTALLER_H_ 85 #endif // CHROME_BROWSER_COMPONENT_UPDATER_STH_SET_COMPONENT_INSTALLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698