OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ev_whitelist_component_installer.h" | 5 #include "chrome/browser/component_updater/ev_whitelist_component_installer.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.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/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "base/path_service.h" | 15 #include "base/path_service.h" |
| 16 #include "chrome/browser/net/packed_ct_ev_whitelist.h" |
16 #include "components/component_updater/component_updater_paths.h" | 17 #include "components/component_updater/component_updater_paths.h" |
17 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
18 #include "net/ssl/ssl_config_service.h" | 19 #include "net/ssl/ssl_config_service.h" |
19 | 20 |
20 using component_updater::ComponentUpdateService; | 21 using component_updater::ComponentUpdateService; |
21 | 22 |
22 namespace { | 23 namespace { |
23 const base::FilePath::CharType kCompressedEVWhitelistFileName[] = | 24 const base::FilePath::CharType kCompressedEVWhitelistFileName[] = |
24 FILE_PATH_LITERAL("ev_hashes_whitelist.bin"); | 25 FILE_PATH_LITERAL("ev_hashes_whitelist.bin"); |
25 } // namespace | 26 } // namespace |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 .Append(kCompressedEVWhitelistFileName); | 59 .Append(kCompressedEVWhitelistFileName); |
59 } | 60 } |
60 | 61 |
61 void EVWhitelistComponentInstallerTraits::ComponentReady( | 62 void EVWhitelistComponentInstallerTraits::ComponentReady( |
62 const base::Version& version, | 63 const base::Version& version, |
63 const base::FilePath& path, | 64 const base::FilePath& path, |
64 scoped_ptr<base::DictionaryValue> manifest) { | 65 scoped_ptr<base::DictionaryValue> manifest) { |
65 VLOG(1) << "Component ready, version " << version.GetString() << " in " | 66 VLOG(1) << "Component ready, version " << version.GetString() << " in " |
66 << path.value(); | 67 << path.value(); |
67 | 68 |
68 // TODO(eranm): Uncomment once https://codereview.chromium.org/462543002/ | |
69 // is in. | |
70 /* | |
71 const base::FilePath whitelist_file = GetInstalledPath(path); | 69 const base::FilePath whitelist_file = GetInstalledPath(path); |
72 base::Callback<void(void)> set_cb = | |
73 base::Bind(&net::ct::SetEVWhitelistFromFile, whitelist_file); | |
74 content::BrowserThread::PostBlockingPoolTask( | 70 content::BrowserThread::PostBlockingPoolTask( |
75 FROM_HERE, | 71 FROM_HERE, base::Bind(&SetEVWhitelistFromFile, whitelist_file)); |
76 set_cb); | |
77 */ | |
78 } | 72 } |
79 | 73 |
80 bool EVWhitelistComponentInstallerTraits::VerifyInstallation( | 74 bool EVWhitelistComponentInstallerTraits::VerifyInstallation( |
81 const base::DictionaryValue& manifest, | 75 const base::DictionaryValue& manifest, |
82 const base::FilePath& install_dir) const { | 76 const base::FilePath& install_dir) const { |
83 const base::FilePath expected_file = GetInstalledPath(install_dir); | 77 const base::FilePath expected_file = GetInstalledPath(install_dir); |
84 VLOG(1) << "Verifying install: " << expected_file.value(); | 78 VLOG(1) << "Verifying install: " << expected_file.value(); |
85 if (!base::PathExists(expected_file)) { | 79 if (!base::PathExists(expected_file)) { |
86 VLOG(1) << "File missing."; | 80 VLOG(1) << "File missing."; |
87 return false; | 81 return false; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 113 |
120 scoped_ptr<ComponentInstallerTraits> traits( | 114 scoped_ptr<ComponentInstallerTraits> traits( |
121 new EVWhitelistComponentInstallerTraits()); | 115 new EVWhitelistComponentInstallerTraits()); |
122 // |cus| will take ownership of |installer| during installer->Register(cus). | 116 // |cus| will take ownership of |installer| during installer->Register(cus). |
123 DefaultComponentInstaller* installer = | 117 DefaultComponentInstaller* installer = |
124 new DefaultComponentInstaller(traits.Pass()); | 118 new DefaultComponentInstaller(traits.Pass()); |
125 installer->Register(cus); | 119 installer->Register(cus); |
126 } | 120 } |
127 | 121 |
128 } // namespace component_updater | 122 } // namespace component_updater |
OLD | NEW |