Chromium Code Reviews| 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/extension.h" | 5 #include "chrome/common/extensions/extension.h" |
| 6 | 6 |
| 7 #include <ostream> | 7 #include <ostream> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 namespace switch_utils = extensions::switch_utils; | 66 namespace switch_utils = extensions::switch_utils; |
| 67 | 67 |
| 68 using extensions::csp_validator::ContentSecurityPolicyIsLegal; | 68 using extensions::csp_validator::ContentSecurityPolicyIsLegal; |
| 69 using extensions::csp_validator::ContentSecurityPolicyIsSandboxed; | 69 using extensions::csp_validator::ContentSecurityPolicyIsSandboxed; |
| 70 using extensions::csp_validator::ContentSecurityPolicyIsSecure; | 70 using extensions::csp_validator::ContentSecurityPolicyIsSecure; |
| 71 | 71 |
| 72 namespace extensions { | 72 namespace extensions { |
| 73 | 73 |
| 74 namespace { | 74 namespace { |
| 75 | 75 |
| 76 const int kModernManifestVersion = 1; | 76 const int kModernManifestVersion = 2; |
| 77 const int kPEMOutputColumns = 65; | 77 const int kPEMOutputColumns = 65; |
| 78 | 78 |
| 79 const char kOverrideExtentUrlPatternFormat[] = "chrome://%s/*"; | 79 const char kOverrideExtentUrlPatternFormat[] = "chrome://%s/*"; |
| 80 | 80 |
| 81 // The maximum number of commands (including page action/browser actions) an | 81 // The maximum number of commands (including page action/browser actions) an |
| 82 // extension can have. | 82 // extension can have. |
| 83 const size_t kMaxCommandsPerExtension = 4; | 83 const size_t kMaxCommandsPerExtension = 4; |
| 84 | 84 |
| 85 // KEY MARKERS | 85 // KEY MARKERS |
| 86 const char kKeyBeginHeaderMarker[] = "-----BEGIN"; | 86 const char kKeyBeginHeaderMarker[] = "-----BEGIN"; |
| (...skipping 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1351 *error = ASCIIToUTF16(errors::kInvalidManifestVersion); | 1351 *error = ASCIIToUTF16(errors::kInvalidManifestVersion); |
| 1352 return false; | 1352 return false; |
| 1353 } | 1353 } |
| 1354 } | 1354 } |
| 1355 | 1355 |
| 1356 manifest_version_ = manifest_->GetManifestVersion(); | 1356 manifest_version_ = manifest_->GetManifestVersion(); |
| 1357 if (creation_flags_ & REQUIRE_MODERN_MANIFEST_VERSION && | 1357 if (creation_flags_ & REQUIRE_MODERN_MANIFEST_VERSION && |
| 1358 manifest_version_ < kModernManifestVersion && | 1358 manifest_version_ < kModernManifestVersion && |
| 1359 !CommandLine::ForCurrentProcess()->HasSwitch( | 1359 !CommandLine::ForCurrentProcess()->HasSwitch( |
| 1360 switches::kAllowLegacyExtensionManifests)) { | 1360 switches::kAllowLegacyExtensionManifests)) { |
| 1361 *error = ASCIIToUTF16(errors::kInvalidManifestVersion); | 1361 *error = ASCIIToUTF16(errors::kInvalidManifestVersionOld); |
|
Mihai Parparita -not on Chrome
2012/08/31 20:50:16
You could make kModernManifestVersion into a forma
Aaron Boodman
2012/08/31 21:03:17
Done.
| |
| 1362 return false; | 1362 return false; |
| 1363 } | |
| 1364 | |
| 1365 if (location() == LOAD && manifest_version_ == 1) { | |
| 1366 install_warnings_.push_back(Extension::InstallWarning( | |
| 1367 Extension::InstallWarning::FORMAT_HTML, | |
| 1368 l10n_util::GetStringFUTF8( | |
| 1369 IDS_EXTENSION_MANIFEST_VERSION_OLD, | |
| 1370 ASCIIToUTF16("<a href='http://code.google.com/chrome/extensions/" | |
| 1371 "manifestVersion.html' target='_blank'>"), | |
| 1372 ASCIIToUTF16("</a>")))); | |
| 1373 } | 1363 } |
| 1374 | 1364 |
| 1375 return true; | 1365 return true; |
| 1376 } | 1366 } |
| 1377 | 1367 |
| 1378 bool Extension::LoadHomepageURL(string16* error) { | 1368 bool Extension::LoadHomepageURL(string16* error) { |
| 1379 if (!manifest_->HasKey(keys::kHomepageURL)) | 1369 if (!manifest_->HasKey(keys::kHomepageURL)) |
| 1380 return true; | 1370 return true; |
| 1381 std::string tmp; | 1371 std::string tmp; |
| 1382 if (!manifest_->GetString(keys::kHomepageURL, &tmp)) { | 1372 if (!manifest_->GetString(keys::kHomepageURL, &tmp)) { |
| (...skipping 2565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3948 | 3938 |
| 3949 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( | 3939 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( |
| 3950 const Extension* extension, | 3940 const Extension* extension, |
| 3951 const PermissionSet* permissions, | 3941 const PermissionSet* permissions, |
| 3952 Reason reason) | 3942 Reason reason) |
| 3953 : reason(reason), | 3943 : reason(reason), |
| 3954 extension(extension), | 3944 extension(extension), |
| 3955 permissions(permissions) {} | 3945 permissions(permissions) {} |
| 3956 | 3946 |
| 3957 } // namespace extensions | 3947 } // namespace extensions |
| OLD | NEW |