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 "extensions/common/features/simple_feature.h" | 5 #include "extensions/common/features/simple_feature.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 // static | 660 // static |
661 bool SimpleFeature::IsValidExtensionId(const std::string& extension_id) { | 661 bool SimpleFeature::IsValidExtensionId(const std::string& extension_id) { |
662 // Belt-and-suspenders philosophy here. We should be pretty confident by this | 662 // Belt-and-suspenders philosophy here. We should be pretty confident by this |
663 // point that we've validated the extension ID format, but in case something | 663 // point that we've validated the extension ID format, but in case something |
664 // slips through, we avoid a class of attack where creative ID manipulation | 664 // slips through, we avoid a class of attack where creative ID manipulation |
665 // leads to hash collisions. | 665 // leads to hash collisions. |
666 // 128 bits / 4 = 32 mpdecimal characters | 666 // 128 bits / 4 = 32 mpdecimal characters |
667 return (extension_id.length() == 32); | 667 return (extension_id.length() == 32); |
668 } | 668 } |
669 | 669 |
| 670 void SimpleFeature::set_blacklist(std::vector<std::string>&& blacklist) { |
| 671 blacklist_ = blacklist; |
| 672 } |
| 673 |
| 674 void SimpleFeature::set_command_line_switch(std::string&& command_line_switch) { |
| 675 command_line_switch_ = command_line_switch; |
| 676 } |
| 677 |
| 678 void SimpleFeature::set_contexts(std::vector<Context>&& contexts) { |
| 679 contexts_ = contexts; |
| 680 } |
| 681 |
| 682 void SimpleFeature::set_dependencies(std::vector<std::string>&& dependencies) { |
| 683 dependencies_ = dependencies; |
| 684 } |
| 685 |
| 686 void SimpleFeature::set_extension_types(std::vector<Manifest::Type>&& types) { |
| 687 extension_types_ = types; |
| 688 } |
| 689 |
670 void SimpleFeature::set_matches(const std::vector<std::string>& matches) { | 690 void SimpleFeature::set_matches(const std::vector<std::string>& matches) { |
671 matches_.ClearPatterns(); | 691 matches_.ClearPatterns(); |
672 for (const std::string& pattern : matches) | 692 for (const std::string& pattern : matches) |
673 matches_.AddPattern(URLPattern(URLPattern::SCHEME_ALL, pattern)); | 693 matches_.AddPattern(URLPattern(URLPattern::SCHEME_ALL, pattern)); |
674 } | 694 } |
675 | 695 |
| 696 void SimpleFeature::set_platforms(std::vector<Platform>&& platforms) { |
| 697 platforms_ = platforms; |
| 698 } |
| 699 |
| 700 void SimpleFeature::set_whitelist(std::vector<std::string>&& whitelist) { |
| 701 whitelist_ = whitelist; |
| 702 } |
| 703 |
676 } // namespace extensions | 704 } // namespace extensions |
OLD | NEW |