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

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

Issue 1845113003: Certificate Transparency: Start tracking logs' state (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
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 #include "chrome/browser/component_updater/sth_set_component_installer.h" 5 #include "chrome/browser/component_updater/sth_set_component_installer.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file_enumerator.h" 10 #include "base/files/file_enumerator.h"
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/files/file_util.h" 12 #include "base/files/file_util.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/path_service.h" 14 #include "base/path_service.h"
15 #include "base/strings/string_number_conversions.h" 15 #include "base/strings/string_number_conversions.h"
16 #include "base/values.h" 16 #include "base/values.h"
17 #include "base/version.h" 17 #include "base/version.h"
18 #include "chrome/browser/browser_process.h"
19 #include "chrome/browser/io_thread.h"
18 #include "components/component_updater/component_updater_paths.h" 20 #include "components/component_updater/component_updater_paths.h"
19 #include "components/safe_json/safe_json_parser.h" 21 #include "components/safe_json/safe_json_parser.h"
20 #include "content/public/browser/browser_thread.h" 22 #include "content/public/browser/browser_thread.h"
21 #include "crypto/sha2.h" 23 #include "crypto/sha2.h"
22 #include "net/cert/ct_known_logs_static.h" 24 #include "net/cert/ct_known_logs_static.h"
23 #include "net/cert/ct_log_response_parser.h" 25 #include "net/cert/ct_log_response_parser.h"
24 #include "net/cert/signed_tree_head.h" 26 #include "net/cert/signed_tree_head.h"
25 #include "net/cert/sth_distributor.h" 27 #include "net/cert/sth_distributor.h"
26 #include "net/cert/sth_observer.h" 28 #include "net/cert/sth_observer.h"
27 29
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 const std::string& log_id, 180 const std::string& log_id,
179 const std::string& error) { 181 const std::string& error) {
180 DVLOG(1) << "STH loading failed: " << error 182 DVLOG(1) << "STH loading failed: " << error
181 << " for log: " << base::HexEncode(log_id.data(), log_id.length()); 183 << " for log: " << base::HexEncode(log_id.data(), log_id.length());
182 } 184 }
183 185
184 void RegisterSTHSetComponent(ComponentUpdateService* cus, 186 void RegisterSTHSetComponent(ComponentUpdateService* cus,
185 const base::FilePath& user_data_dir) { 187 const base::FilePath& user_data_dir) {
186 DVLOG(1) << "Registering STH Set fetcher component."; 188 DVLOG(1) << "Registering STH Set fetcher component.";
187 189
188 // TODO(eranm): The next step in auditing CT logs (crbug.com/506227) is to
189 // pass the distributor to the IOThread so it can be used in a per-profile
190 // context for checking inclusion of SCTs.
191 scoped_ptr<net::ct::STHDistributor> distributor( 190 scoped_ptr<net::ct::STHDistributor> distributor(
192 new net::ct::STHDistributor()); 191 new net::ct::STHDistributor());
192 // Register the distributor as the STHReporter for the IOThread (see
193 // crbug.com/506227 for details).
194 DCHECK(g_browser_process->io_thread());
Ryan Sleevi 2016/04/21 14:05:15 This defeats the abstraction of lines 195-196 (con
Eran Messeri 2016/04/25 14:50:59 Apologies, but I am not sure I understand this com
Ryan Sleevi 2016/04/27 23:05:58 Yes. The point of using content::BrowserThread::P
195 content::BrowserThread::PostTask(
196 content::BrowserThread::IO, FROM_HERE,
197 base::Bind(&IOThread::RegisterSTHReporter,
198 base::Unretained(g_browser_process->io_thread()),
Ryan Sleevi 2016/04/21 14:05:15 g_browser_process has an incredibly high bar to ju
Eran Messeri 2016/04/25 14:50:59 I'm trying to share an STHDistributor instance bet
Ryan Sleevi 2016/04/27 23:05:58 Having objects live on multiple threads - whether
Sorin Jianu 2016/05/05 00:32:03 I have a minor concern regarding a coupling issue
199 distributor.get()));
193 200
194 scoped_ptr<ComponentInstallerTraits> traits( 201 scoped_ptr<ComponentInstallerTraits> traits(
195 new STHSetComponentInstallerTraits(std::move(distributor))); 202 new STHSetComponentInstallerTraits(std::move(distributor)));
196 // |cus| will take ownership of |installer| during installer->Register(cus). 203 // |cus| will take ownership of |installer| during installer->Register(cus).
197 DefaultComponentInstaller* installer = 204 DefaultComponentInstaller* installer =
198 new DefaultComponentInstaller(std::move(traits)); 205 new DefaultComponentInstaller(std::move(traits));
199 installer->Register(cus, base::Closure()); 206 installer->Register(cus, base::Closure());
200 } 207 }
201 208
202 } // namespace component_updater 209 } // namespace component_updater
OLDNEW
« no previous file with comments | « chrome/browser/BUILD.gn ('k') | chrome/browser/io_thread.h » ('j') | chrome/browser/io_thread.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698