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 "extensions/common/extension.h" | 5 #include "extensions/common/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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 if (is_hosted_app()) | 334 if (is_hosted_app()) |
335 return false; | 335 return false; |
336 | 336 |
337 return true; | 337 return true; |
338 } | 338 } |
339 | 339 |
340 bool Extension::ShouldNotBeVisible() const { | 340 bool Extension::ShouldNotBeVisible() const { |
341 // Don't show component extensions because they are only extensions as an | 341 // Don't show component extensions because they are only extensions as an |
342 // implementation detail of Chrome. | 342 // implementation detail of Chrome. |
343 if (extensions::Manifest::IsComponentLocation(location()) && | 343 if (extensions::Manifest::IsComponentLocation(location()) && |
344 !CommandLine::ForCurrentProcess()->HasSwitch( | 344 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
345 switches::kShowComponentExtensionOptions)) { | 345 switches::kShowComponentExtensionOptions)) { |
346 return true; | 346 return true; |
347 } | 347 } |
348 | 348 |
349 // Always show unpacked extensions and apps. | 349 // Always show unpacked extensions and apps. |
350 if (Manifest::IsUnpackedLocation(location())) | 350 if (Manifest::IsUnpackedLocation(location())) |
351 return false; | 351 return false; |
352 | 352 |
353 // Don't show apps that aren't visible in either launcher or ntp. | 353 // Don't show apps that aren't visible in either launcher or ntp. |
354 if (is_app() && !ShouldDisplayInAppLauncher() && !ShouldDisplayInNewTabPage()) | 354 if (is_app() && !ShouldDisplayInAppLauncher() && !ShouldDisplayInNewTabPage()) |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 if (!manifest_->GetInteger(keys::kManifestVersion, &manifest_version) || | 707 if (!manifest_->GetInteger(keys::kManifestVersion, &manifest_version) || |
708 manifest_version < 1) { | 708 manifest_version < 1) { |
709 *error = base::ASCIIToUTF16(errors::kInvalidManifestVersion); | 709 *error = base::ASCIIToUTF16(errors::kInvalidManifestVersion); |
710 return false; | 710 return false; |
711 } | 711 } |
712 } | 712 } |
713 | 713 |
714 manifest_version_ = manifest_->GetManifestVersion(); | 714 manifest_version_ = manifest_->GetManifestVersion(); |
715 if (manifest_version_ < kModernManifestVersion && | 715 if (manifest_version_ < kModernManifestVersion && |
716 ((creation_flags_ & REQUIRE_MODERN_MANIFEST_VERSION && | 716 ((creation_flags_ & REQUIRE_MODERN_MANIFEST_VERSION && |
717 !CommandLine::ForCurrentProcess()->HasSwitch( | 717 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
718 switches::kAllowLegacyExtensionManifests)) || | 718 switches::kAllowLegacyExtensionManifests)) || |
719 GetType() == Manifest::TYPE_PLATFORM_APP)) { | 719 GetType() == Manifest::TYPE_PLATFORM_APP)) { |
720 *error = ErrorUtils::FormatErrorMessageUTF16( | 720 *error = ErrorUtils::FormatErrorMessageUTF16( |
721 errors::kInvalidManifestVersionOld, | 721 errors::kInvalidManifestVersionOld, |
722 base::IntToString(kModernManifestVersion), | 722 base::IntToString(kModernManifestVersion), |
723 is_platform_app() ? "apps" : "extensions"); | 723 is_platform_app() ? "apps" : "extensions"); |
724 return false; | 724 return false; |
725 } | 725 } |
726 | 726 |
727 return true; | 727 return true; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
775 | 775 |
776 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( | 776 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( |
777 const Extension* extension, | 777 const Extension* extension, |
778 const PermissionSet* permissions, | 778 const PermissionSet* permissions, |
779 Reason reason) | 779 Reason reason) |
780 : reason(reason), | 780 : reason(reason), |
781 extension(extension), | 781 extension(extension), |
782 permissions(permissions) {} | 782 permissions(permissions) {} |
783 | 783 |
784 } // namespace extensions | 784 } // namespace extensions |
OLD | NEW |