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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 return CreateAvailability(INVALID_MIN_MANIFEST_VERSION, type); | 420 return CreateAvailability(INVALID_MIN_MANIFEST_VERSION, type); |
421 | 421 |
422 if (max_manifest_version_ != 0 && manifest_version > max_manifest_version_) | 422 if (max_manifest_version_ != 0 && manifest_version > max_manifest_version_) |
423 return CreateAvailability(INVALID_MAX_MANIFEST_VERSION, type); | 423 return CreateAvailability(INVALID_MAX_MANIFEST_VERSION, type); |
424 | 424 |
425 if (!command_line_switch_.empty() && | 425 if (!command_line_switch_.empty() && |
426 !IsCommandLineSwitchEnabled(command_line_switch_)) { | 426 !IsCommandLineSwitchEnabled(command_line_switch_)) { |
427 return CreateAvailability(MISSING_COMMAND_LINE_SWITCH, type); | 427 return CreateAvailability(MISSING_COMMAND_LINE_SWITCH, type); |
428 } | 428 } |
429 | 429 |
430 if (channel_ && check_channel_ && *channel_ < GetCurrentChannel()) | 430 if (channel_ && *channel_ < GetCurrentChannel()) |
431 return CreateAvailability(UNSUPPORTED_CHANNEL, *channel_); | 431 return CreateAvailability(UNSUPPORTED_CHANNEL, *channel_); |
432 | 432 |
433 return CheckDependencies(base::Bind(&IsAvailableToManifestForBind, | 433 return CheckDependencies(base::Bind(&IsAvailableToManifestForBind, |
434 extension_id, | 434 extension_id, |
435 type, | 435 type, |
436 location, | 436 location, |
437 manifest_version, | 437 manifest_version, |
438 platform)); | 438 platform)); |
439 } | 439 } |
440 | 440 |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 bool SimpleFeature::IsValidExtensionId(const std::string& extension_id) { | 653 bool SimpleFeature::IsValidExtensionId(const std::string& extension_id) { |
654 // Belt-and-suspenders philosophy here. We should be pretty confident by this | 654 // Belt-and-suspenders philosophy here. We should be pretty confident by this |
655 // point that we've validated the extension ID format, but in case something | 655 // point that we've validated the extension ID format, but in case something |
656 // slips through, we avoid a class of attack where creative ID manipulation | 656 // slips through, we avoid a class of attack where creative ID manipulation |
657 // leads to hash collisions. | 657 // leads to hash collisions. |
658 // 128 bits / 4 = 32 mpdecimal characters | 658 // 128 bits / 4 = 32 mpdecimal characters |
659 return (extension_id.length() == 32); | 659 return (extension_id.length() == 32); |
660 } | 660 } |
661 | 661 |
662 } // namespace extensions | 662 } // namespace extensions |
OLD | NEW |