Chromium Code Reviews| Index: extensions/common/features/simple_feature.cc |
| diff --git a/extensions/common/features/simple_feature.cc b/extensions/common/features/simple_feature.cc |
| index 28c429b470ab50c6f84726d7388f460e6c296b08..2a498099b10b3e8b6d9627310ef432f8a6355e0e 100644 |
| --- a/extensions/common/features/simple_feature.cc |
| +++ b/extensions/common/features/simple_feature.cc |
| @@ -667,38 +667,49 @@ bool SimpleFeature::IsValidExtensionId(const std::string& extension_id) { |
| return (extension_id.length() == 32); |
| } |
| -void SimpleFeature::set_blacklist(std::vector<std::string>&& blacklist) { |
| - blacklist_ = blacklist; |
| +void SimpleFeature::set_blacklist( |
| + std::initializer_list<const char* const> blacklist) { |
| + blacklist_.clear(); |
|
Devlin
2016/07/27 15:36:49
These should only be called at feature constructio
dcheng
2016/07/27 16:07:47
The size impact of this is pretty negligible, mayb
|
| + for (const auto* entry : blacklist) |
| + blacklist_.push_back(entry); |
| } |
| void SimpleFeature::set_command_line_switch(std::string&& command_line_switch) { |
| command_line_switch_ = command_line_switch; |
| } |
| -void SimpleFeature::set_contexts(std::vector<Context>&& contexts) { |
| +void SimpleFeature::set_contexts(std::initializer_list<Context> contexts) { |
| contexts_ = contexts; |
| } |
| -void SimpleFeature::set_dependencies(std::vector<std::string>&& dependencies) { |
| - dependencies_ = dependencies; |
| +void SimpleFeature::set_dependencies( |
| + std::initializer_list<const char* const> dependencies) { |
| + dependencies_.clear(); |
| + for (const auto* entry : dependencies) |
| + dependencies_.push_back(entry); |
| } |
| -void SimpleFeature::set_extension_types(std::vector<Manifest::Type>&& types) { |
| +void SimpleFeature::set_extension_types( |
| + std::initializer_list<Manifest::Type> types) { |
| extension_types_ = types; |
| } |
| -void SimpleFeature::set_matches(const std::vector<std::string>& matches) { |
| +void SimpleFeature::set_matches( |
| + std::initializer_list<const char* const> matches) { |
| matches_.ClearPatterns(); |
| - for (const std::string& pattern : matches) |
| + for (const auto* pattern : matches) |
| matches_.AddPattern(URLPattern(URLPattern::SCHEME_ALL, pattern)); |
| } |
| -void SimpleFeature::set_platforms(std::vector<Platform>&& platforms) { |
| +void SimpleFeature::set_platforms(std::initializer_list<Platform> platforms) { |
| platforms_ = platforms; |
| } |
| -void SimpleFeature::set_whitelist(std::vector<std::string>&& whitelist) { |
| - whitelist_ = whitelist; |
| +void SimpleFeature::set_whitelist( |
| + std::initializer_list<const char* const> whitelist) { |
| + whitelist_.clear(); |
| + for (const auto* entry : whitelist) |
| + whitelist_.push_back(entry); |
| } |
| } // namespace extensions |