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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 | 306 |
307 return std::string(); | 307 return std::string(); |
308 } | 308 } |
309 | 309 |
310 Feature::Availability SimpleFeature::IsAvailableToManifest( | 310 Feature::Availability SimpleFeature::IsAvailableToManifest( |
311 const std::string& extension_id, | 311 const std::string& extension_id, |
312 Manifest::Type type, | 312 Manifest::Type type, |
313 Location location, | 313 Location location, |
314 int manifest_version, | 314 int manifest_version, |
315 Platform platform) const { | 315 Platform platform) const { |
316 // Component extensions can access any feature. | |
317 if (location == COMPONENT_LOCATION) | |
318 return CreateAvailability(IS_AVAILABLE, type); | |
319 | |
320 if (!whitelist_.empty()) { | 316 if (!whitelist_.empty()) { |
321 if (!IsIdInWhitelist(extension_id)) { | 317 if (!IsIdInWhitelist(extension_id)) { |
322 // TODO(aa): This is gross. There should be a better way to test the | 318 // TODO(aa): This is gross. There should be a better way to test the |
323 // whitelist. | 319 // whitelist. |
324 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 320 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
325 if (!command_line->HasSwitch(switches::kWhitelistedExtensionID)) | 321 if (!command_line->HasSwitch(switches::kWhitelistedExtensionID)) |
326 return CreateAvailability(NOT_FOUND_IN_WHITELIST, type); | 322 return CreateAvailability(NOT_FOUND_IN_WHITELIST, type); |
327 | 323 |
328 std::string whitelist_switch_value = | 324 std::string whitelist_switch_value = |
329 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 325 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 | 500 |
505 if (whitelist.find(extension_id) != whitelist.end() || | 501 if (whitelist.find(extension_id) != whitelist.end() || |
506 whitelist.find(HashExtensionId(extension_id)) != whitelist.end()) { | 502 whitelist.find(HashExtensionId(extension_id)) != whitelist.end()) { |
507 return true; | 503 return true; |
508 } | 504 } |
509 | 505 |
510 return false; | 506 return false; |
511 } | 507 } |
512 | 508 |
513 } // namespace extensions | 509 } // namespace extensions |
OLD | NEW |