| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/extension.h" | 5 #include "chrome/common/extensions/extension.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 #include "extensions/common/url_pattern_set.h" | 35 #include "extensions/common/url_pattern_set.h" |
| 36 #include "grit/chromium_strings.h" | 36 #include "grit/chromium_strings.h" |
| 37 #include "grit/theme_resources.h" | 37 #include "grit/theme_resources.h" |
| 38 #include "third_party/skia/include/core/SkBitmap.h" | 38 #include "third_party/skia/include/core/SkBitmap.h" |
| 39 #include "url/url_util.h" | 39 #include "url/url_util.h" |
| 40 | 40 |
| 41 #if defined(OS_WIN) | 41 #if defined(OS_WIN) |
| 42 #include "grit/generated_resources.h" | 42 #include "grit/generated_resources.h" |
| 43 #endif | 43 #endif |
| 44 | 44 |
| 45 namespace keys = extension_manifest_keys; | 45 namespace keys = extensions::manifest_keys; |
| 46 namespace values = extension_manifest_values; | 46 namespace values = extension_manifest_values; |
| 47 namespace errors = extension_manifest_errors; | 47 namespace errors = extension_manifest_errors; |
| 48 | 48 |
| 49 namespace extensions { | 49 namespace extensions { |
| 50 | 50 |
| 51 namespace { | 51 namespace { |
| 52 | 52 |
| 53 const int kModernManifestVersion = 2; | 53 const int kModernManifestVersion = 2; |
| 54 const int kPEMOutputColumns = 65; | 54 const int kPEMOutputColumns = 65; |
| 55 | 55 |
| (...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 if (manifest_->value()->HasKey(keys::kManifestVersion)) { | 745 if (manifest_->value()->HasKey(keys::kManifestVersion)) { |
| 746 int manifest_version = 1; | 746 int manifest_version = 1; |
| 747 if (!manifest_->GetInteger(keys::kManifestVersion, &manifest_version) || | 747 if (!manifest_->GetInteger(keys::kManifestVersion, &manifest_version) || |
| 748 manifest_version < 1) { | 748 manifest_version < 1) { |
| 749 *error = ASCIIToUTF16(errors::kInvalidManifestVersion); | 749 *error = ASCIIToUTF16(errors::kInvalidManifestVersion); |
| 750 return false; | 750 return false; |
| 751 } | 751 } |
| 752 } | 752 } |
| 753 | 753 |
| 754 manifest_version_ = manifest_->GetManifestVersion(); | 754 manifest_version_ = manifest_->GetManifestVersion(); |
| 755 if (creation_flags_ & REQUIRE_MODERN_MANIFEST_VERSION && | 755 if (manifest_version_ < kModernManifestVersion && |
| 756 manifest_version_ < kModernManifestVersion && | 756 ((creation_flags_ & REQUIRE_MODERN_MANIFEST_VERSION && |
| 757 !CommandLine::ForCurrentProcess()->HasSwitch( | 757 !CommandLine::ForCurrentProcess()->HasSwitch( |
| 758 switches::kAllowLegacyExtensionManifests)) { | 758 switches::kAllowLegacyExtensionManifests)) || |
| 759 GetType() == Manifest::TYPE_PLATFORM_APP)) { |
| 759 *error = ErrorUtils::FormatErrorMessageUTF16( | 760 *error = ErrorUtils::FormatErrorMessageUTF16( |
| 760 errors::kInvalidManifestVersionOld, | 761 errors::kInvalidManifestVersionOld, |
| 761 base::IntToString(kModernManifestVersion)); | 762 base::IntToString(kModernManifestVersion), |
| 763 is_platform_app() ? "apps" : "extensions"); |
| 762 return false; | 764 return false; |
| 763 } | 765 } |
| 764 | 766 |
| 765 return true; | 767 return true; |
| 766 } | 768 } |
| 767 | 769 |
| 768 ExtensionInfo::ExtensionInfo(const base::DictionaryValue* manifest, | 770 ExtensionInfo::ExtensionInfo(const base::DictionaryValue* manifest, |
| 769 const std::string& id, | 771 const std::string& id, |
| 770 const base::FilePath& path, | 772 const base::FilePath& path, |
| 771 Manifest::Location location) | 773 Manifest::Location location) |
| (...skipping 22 matching lines...) Expand all Loading... |
| 794 | 796 |
| 795 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( | 797 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( |
| 796 const Extension* extension, | 798 const Extension* extension, |
| 797 const PermissionSet* permissions, | 799 const PermissionSet* permissions, |
| 798 Reason reason) | 800 Reason reason) |
| 799 : reason(reason), | 801 : reason(reason), |
| 800 extension(extension), | 802 extension(extension), |
| 801 permissions(permissions) {} | 803 permissions(permissions) {} |
| 802 | 804 |
| 803 } // namespace extensions | 805 } // namespace extensions |
| OLD | NEW |