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/api/extension_api.h" | 5 #include "chrome/common/extensions/api/extension_api.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 } | 264 } |
265 | 265 |
266 // Populate |url_matching_apis_|. | 266 // Populate |url_matching_apis_|. |
267 ListValue* matches = NULL; | 267 ListValue* matches = NULL; |
268 if (schema->GetList("matches", &matches)) { | 268 if (schema->GetList("matches", &matches)) { |
269 URLPatternSet pattern_set; | 269 URLPatternSet pattern_set; |
270 for (size_t i = 0; i < matches->GetSize(); ++i) { | 270 for (size_t i = 0; i < matches->GetSize(); ++i) { |
271 std::string pattern; | 271 std::string pattern; |
272 CHECK(matches->GetString(i, &pattern)); | 272 CHECK(matches->GetString(i, &pattern)); |
273 pattern_set.AddPattern( | 273 pattern_set.AddPattern( |
274 URLPattern(UserScript::kValidUserScriptSchemes, pattern)); | 274 URLPattern(UserScript::ValidUserScriptSchemes(), pattern)); |
275 } | 275 } |
276 url_matching_apis_[schema_namespace] = pattern_set; | 276 url_matching_apis_[schema_namespace] = pattern_set; |
277 } | 277 } |
278 | 278 |
279 // Populate feature maps. | 279 // Populate feature maps. |
280 // TODO(aa): Consider not storing features that can never run on the current | 280 // TODO(aa): Consider not storing features that can never run on the current |
281 // machine (e.g., because of platform restrictions). | 281 // machine (e.g., because of platform restrictions). |
282 bool uses_feature_system = false; | 282 bool uses_feature_system = false; |
283 schema->GetBoolean("uses_feature_system", &uses_feature_system); | 283 schema->GetBoolean("uses_feature_system", &uses_feature_system); |
284 if (!uses_feature_system) | 284 if (!uses_feature_system) |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
787 | 787 |
788 void ExtensionAPI::LoadAllSchemas() { | 788 void ExtensionAPI::LoadAllSchemas() { |
789 while (unloaded_schemas_.size()) { | 789 while (unloaded_schemas_.size()) { |
790 std::map<std::string, base::StringPiece>::iterator it = | 790 std::map<std::string, base::StringPiece>::iterator it = |
791 unloaded_schemas_.begin(); | 791 unloaded_schemas_.begin(); |
792 LoadSchema(it->first, it->second); | 792 LoadSchema(it->first, it->second); |
793 } | 793 } |
794 } | 794 } |
795 | 795 |
796 } // namespace extensions | 796 } // namespace extensions |
OLD | NEW |