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/subresource_filter_component_installe
r.h" | 5 #include "chrome/browser/component_updater/subresource_filter_component_installe
r.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 std::vector<uint8_t>* hash) const { | 105 std::vector<uint8_t>* hash) const { |
106 hash->assign(std::begin(kPublicKeySHA256), std::end(kPublicKeySHA256)); | 106 hash->assign(std::begin(kPublicKeySHA256), std::end(kPublicKeySHA256)); |
107 } | 107 } |
108 | 108 |
109 std::string SubresourceFilterComponentInstallerTraits::GetName() const { | 109 std::string SubresourceFilterComponentInstallerTraits::GetName() const { |
110 return kSubresourceFilterSetFetcherManifestName; | 110 return kSubresourceFilterSetFetcherManifestName; |
111 } | 111 } |
112 | 112 |
113 // static | 113 // static |
114 std::string SubresourceFilterComponentInstallerTraits::GetInstallerTag() { | 114 std::string SubresourceFilterComponentInstallerTraits::GetInstallerTag() { |
115 std::string ruleset_flavor = subresource_filter::GetRulesetFlavor(); | 115 std::string ruleset_flavor = |
| 116 subresource_filter::GetActiveConfiguration().ruleset_flavor; |
116 if (ruleset_flavor.empty()) | 117 if (ruleset_flavor.empty()) |
117 return ruleset_flavor; | 118 return ruleset_flavor; |
118 | 119 |
119 // We allow 4 ruleset flavor identifiers: a, b, c, d | 120 // We allow 4 ruleset flavor identifiers: a, b, c, d |
120 if (ruleset_flavor.size() == 1 && ruleset_flavor.at(0) >= 'a' && | 121 if (ruleset_flavor.size() == 1 && ruleset_flavor.at(0) >= 'a' && |
121 ruleset_flavor.at(0) <= 'd') | 122 ruleset_flavor.at(0) <= 'd') |
122 return ruleset_flavor; | 123 return ruleset_flavor; |
123 | 124 |
124 // Return 'invalid' for any cases where we encounter an invalid installer | 125 // Return 'invalid' for any cases where we encounter an invalid installer |
125 // tag. This allows us to verify that no clients are encountering invalid | 126 // tag. This allows us to verify that no clients are encountering invalid |
(...skipping 21 matching lines...) Expand all Loading... |
147 return; | 148 return; |
148 std::unique_ptr<ComponentInstallerTraits> traits( | 149 std::unique_ptr<ComponentInstallerTraits> traits( |
149 new SubresourceFilterComponentInstallerTraits()); | 150 new SubresourceFilterComponentInstallerTraits()); |
150 // |cus| will take ownership of |installer| during installer->Register(cus). | 151 // |cus| will take ownership of |installer| during installer->Register(cus). |
151 DefaultComponentInstaller* installer = | 152 DefaultComponentInstaller* installer = |
152 new DefaultComponentInstaller(std::move(traits)); | 153 new DefaultComponentInstaller(std::move(traits)); |
153 installer->Register(cus, base::Closure()); | 154 installer->Register(cus, base::Closure()); |
154 } | 155 } |
155 | 156 |
156 } // namespace component_updater | 157 } // namespace component_updater |
OLD | NEW |