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 <map> | 7 #include <map> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 Manifest::Type type_to_check = (type == Manifest::TYPE_USER_SCRIPT) ? | 324 Manifest::Type type_to_check = (type == Manifest::TYPE_USER_SCRIPT) ? |
325 Manifest::TYPE_EXTENSION : type; | 325 Manifest::TYPE_EXTENSION : type; |
326 if (!extension_types_.empty() && | 326 if (!extension_types_.empty() && |
327 extension_types_.find(type_to_check) == extension_types_.end()) { | 327 extension_types_.find(type_to_check) == extension_types_.end()) { |
328 return CreateAvailability(INVALID_TYPE, type); | 328 return CreateAvailability(INVALID_TYPE, type); |
329 } | 329 } |
330 | 330 |
331 if (IsIdInBlacklist(extension_id)) | 331 if (IsIdInBlacklist(extension_id)) |
332 return CreateAvailability(FOUND_IN_BLACKLIST, type); | 332 return CreateAvailability(FOUND_IN_BLACKLIST, type); |
333 | 333 |
334 // TODO(benwells): don't grant all component extensions. | |
335 // See http://crbug.com/370375 for more details. | |
336 // Component extensions can access any feature. | |
337 // NOTE: Deliberately does not match EXTERNAL_COMPONENT. | |
338 if (component_extensions_auto_granted_ && location == Manifest::COMPONENT) | |
339 return CreateAvailability(IS_AVAILABLE, type); | |
340 | |
341 if (!whitelist_.empty()) { | 334 if (!whitelist_.empty()) { |
342 if (!IsIdInWhitelist(extension_id)) { | 335 if (!IsIdInWhitelist(extension_id)) { |
343 // TODO(aa): This is gross. There should be a better way to test the | 336 // TODO(aa): This is gross. There should be a better way to test the |
344 // whitelist. | 337 // whitelist. |
345 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 338 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
346 if (!command_line->HasSwitch(switches::kWhitelistedExtensionID)) | 339 if (!command_line->HasSwitch(switches::kWhitelistedExtensionID)) |
347 return CreateAvailability(NOT_FOUND_IN_WHITELIST, type); | 340 return CreateAvailability(NOT_FOUND_IN_WHITELIST, type); |
348 | 341 |
349 std::string whitelist_switch_value = | 342 std::string whitelist_switch_value = |
350 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 343 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 if (!dependency) | 558 if (!dependency) |
566 return CreateAvailability(NOT_PRESENT); | 559 return CreateAvailability(NOT_PRESENT); |
567 Availability dependency_availability = checker.Run(dependency); | 560 Availability dependency_availability = checker.Run(dependency); |
568 if (!dependency_availability.is_available()) | 561 if (!dependency_availability.is_available()) |
569 return dependency_availability; | 562 return dependency_availability; |
570 } | 563 } |
571 return CreateAvailability(IS_AVAILABLE); | 564 return CreateAvailability(IS_AVAILABLE); |
572 } | 565 } |
573 | 566 |
574 } // namespace extensions | 567 } // namespace extensions |
OLD | NEW |