OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/common/extensions/features/simple_feature.h" | 5 #include "chrome/common/extensions/features/simple_feature.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 } | 136 } |
137 | 137 |
138 void ParseURLPatterns(const DictionaryValue* value, | 138 void ParseURLPatterns(const DictionaryValue* value, |
139 const std::string& key, | 139 const std::string& key, |
140 URLPatternSet* set) { | 140 URLPatternSet* set) { |
141 const ListValue* matches = NULL; | 141 const ListValue* matches = NULL; |
142 if (value->GetList(key, &matches)) { | 142 if (value->GetList(key, &matches)) { |
143 for (size_t i = 0; i < matches->GetSize(); ++i) { | 143 for (size_t i = 0; i < matches->GetSize(); ++i) { |
144 std::string pattern; | 144 std::string pattern; |
145 CHECK(matches->GetString(i, &pattern)); | 145 CHECK(matches->GetString(i, &pattern)); |
146 set->AddPattern(URLPattern(URLPattern::SCHEME_ALL, pattern)); | 146 set->AddPattern( |
| 147 URLPattern(UserScript::ValidUserScriptSchemes(), pattern)); |
147 } | 148 } |
148 } | 149 } |
149 } | 150 } |
150 | 151 |
151 // Gets a human-readable name for the given extension type. | 152 // Gets a human-readable name for the given extension type. |
152 std::string GetDisplayTypeName(Manifest::Type type) { | 153 std::string GetDisplayTypeName(Manifest::Type type) { |
153 switch (type) { | 154 switch (type) { |
154 case Manifest::TYPE_UNKNOWN: | 155 case Manifest::TYPE_UNKNOWN: |
155 return "unknown"; | 156 return "unknown"; |
156 case Manifest::TYPE_EXTENSION: | 157 case Manifest::TYPE_EXTENSION: |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 DCHECK(id_hash.length() == base::kSHA1Length); | 438 DCHECK(id_hash.length() == base::kSHA1Length); |
438 const std::string hexencoded_id_hash = base::HexEncode(id_hash.c_str(), | 439 const std::string hexencoded_id_hash = base::HexEncode(id_hash.c_str(), |
439 id_hash.length()); | 440 id_hash.length()); |
440 if (whitelist_.find(hexencoded_id_hash) != whitelist_.end()) | 441 if (whitelist_.find(hexencoded_id_hash) != whitelist_.end()) |
441 return true; | 442 return true; |
442 | 443 |
443 return false; | 444 return false; |
444 } | 445 } |
445 | 446 |
446 } // namespace extensions | 447 } // namespace extensions |
OLD | NEW |