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

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

Issue 2798983002: Introduce subresource_filter::Configuration. (Closed)
Patch Set: Rebase. Created 3 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
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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
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
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
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698