| OLD | NEW |
| 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_log_response_parser.h" | 24 #include "net/cert/ct_log_response_parser.h" |
| 23 #include "net/cert/signed_tree_head.h" | 25 #include "net/cert/signed_tree_head.h" |
| 24 #include "net/cert/sth_distributor.h" | 26 #include "net/cert/sth_distributor.h" |
| 25 #include "net/cert/sth_observer.h" | 27 #include "net/cert/sth_observer.h" |
| 26 | 28 |
| 27 using component_updater::ComponentUpdateService; | 29 using component_updater::ComponentUpdateService; |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 | 184 |
| 183 void RegisterSTHSetComponent(ComponentUpdateService* cus, | 185 void RegisterSTHSetComponent(ComponentUpdateService* cus, |
| 184 const base::FilePath& user_data_dir) { | 186 const base::FilePath& user_data_dir) { |
| 185 DVLOG(1) << "Registering STH Set fetcher component."; | 187 DVLOG(1) << "Registering STH Set fetcher component."; |
| 186 | 188 |
| 187 // TODO(eranm): The next step in auditing CT logs (crbug.com/506227) is to | 189 // TODO(eranm): The next step in auditing CT logs (crbug.com/506227) is to |
| 188 // pass the distributor to the IOThread so it can be used in a per-profile | 190 // pass the distributor to the IOThread so it can be used in a per-profile |
| 189 // context for checking inclusion of SCTs. | 191 // context for checking inclusion of SCTs. |
| 190 std::unique_ptr<net::ct::STHDistributor> distributor( | 192 std::unique_ptr<net::ct::STHDistributor> distributor( |
| 191 new net::ct::STHDistributor()); | 193 new net::ct::STHDistributor()); |
| 194 // Register the distributor as the STHReporter for the IOThread (see |
| 195 // crbug.com/506227 for details). |
| 196 DCHECK(g_browser_process->io_thread()); |
| 197 content::BrowserThread::PostTask( |
| 198 content::BrowserThread::IO, FROM_HERE, |
| 199 base::Bind(&IOThread::RegisterSTHReporter, |
| 200 base::Unretained(g_browser_process->io_thread()), |
| 201 distributor.get())); |
| 192 | 202 |
| 193 std::unique_ptr<ComponentInstallerTraits> traits( | 203 std::unique_ptr<ComponentInstallerTraits> traits( |
| 194 new STHSetComponentInstallerTraits(std::move(distributor))); | 204 new STHSetComponentInstallerTraits(std::move(distributor))); |
| 195 // |cus| will take ownership of |installer| during installer->Register(cus). | 205 // |cus| will take ownership of |installer| during installer->Register(cus). |
| 196 DefaultComponentInstaller* installer = | 206 DefaultComponentInstaller* installer = |
| 197 new DefaultComponentInstaller(std::move(traits)); | 207 new DefaultComponentInstaller(std::move(traits)); |
| 198 installer->Register(cus, base::Closure()); | 208 installer->Register(cus, base::Closure()); |
| 199 } | 209 } |
| 200 | 210 |
| 201 } // namespace component_updater | 211 } // namespace component_updater |
| OLD | NEW |