Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(511)

Side by Side Diff: chrome/common/extensions/extension.cc

Issue 10909239: Rename PACKAGED_APP references to LEGACY_PACKAGED_APP (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 } 491 }
492 492
493 bool Extension::is_platform_app() const { 493 bool Extension::is_platform_app() const {
494 return manifest_->is_platform_app(); 494 return manifest_->is_platform_app();
495 } 495 }
496 496
497 bool Extension::is_hosted_app() const { 497 bool Extension::is_hosted_app() const {
498 return manifest()->is_hosted_app(); 498 return manifest()->is_hosted_app();
499 } 499 }
500 500
501 bool Extension::is_packaged_app() const { 501 bool Extension::is_legacy_packaged_app() const {
502 return manifest()->is_packaged_app(); 502 return manifest()->is_legacy_packaged_app();
503 } 503 }
504 504
505 bool Extension::is_theme() const { 505 bool Extension::is_theme() const {
506 return manifest()->is_theme(); 506 return manifest()->is_theme();
507 } 507 }
508 508
509 GURL Extension::GetBackgroundURL() const { 509 GURL Extension::GetBackgroundURL() const {
510 if (background_scripts_.empty()) 510 if (background_scripts_.empty())
511 return background_url_; 511 return background_url_;
512 return GetResourceURL(extension_filenames::kGeneratedBackgroundPageFilename); 512 return GetResourceURL(extension_filenames::kGeneratedBackgroundPageFilename);
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 GURL url(launch_url); 1149 GURL url(launch_url);
1150 URLPattern pattern(kValidWebExtentSchemes); 1150 URLPattern pattern(kValidWebExtentSchemes);
1151 if (!url.is_valid() || !pattern.SetScheme(url.scheme())) { 1151 if (!url.is_valid() || !pattern.SetScheme(url.scheme())) {
1152 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( 1152 *error = ExtensionErrorUtils::FormatErrorMessageUTF16(
1153 errors::kInvalidLaunchValue, 1153 errors::kInvalidLaunchValue,
1154 keys::kLaunchWebURL); 1154 keys::kLaunchWebURL);
1155 return false; 1155 return false;
1156 } 1156 }
1157 1157
1158 launch_web_url_ = launch_url; 1158 launch_web_url_ = launch_url;
1159 } else if (is_packaged_app() || is_hosted_app()) { 1159 } else if (is_legacy_packaged_app() || is_hosted_app()) {
1160 *error = ASCIIToUTF16(errors::kLaunchURLRequired); 1160 *error = ASCIIToUTF16(errors::kLaunchURLRequired);
1161 return false; 1161 return false;
1162 } 1162 }
1163 1163
1164 // If there is no extent, we default the extent based on the launch URL. 1164 // If there is no extent, we default the extent based on the launch URL.
1165 if (web_extent().is_empty() && !launch_web_url().empty()) { 1165 if (web_extent().is_empty() && !launch_web_url().empty()) {
1166 GURL launch_url(launch_web_url()); 1166 GURL launch_url(launch_web_url());
1167 URLPattern pattern(kValidWebExtentSchemes); 1167 URLPattern pattern(kValidWebExtentSchemes);
1168 if (!pattern.SetScheme("*")) { 1168 if (!pattern.SetScheme("*")) {
1169 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( 1169 *error = ExtensionErrorUtils::FormatErrorMessageUTF16(
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after
1943 if (!intent_service.GetString(keys::kIntentHref, &href)) { 1943 if (!intent_service.GetString(keys::kIntentHref, &href)) {
1944 *error = ASCIIToUTF16(errors::kInvalidIntentHref); 1944 *error = ASCIIToUTF16(errors::kInvalidIntentHref);
1945 return false; 1945 return false;
1946 } 1946 }
1947 } 1947 }
1948 1948
1949 // For packaged/hosted apps, empty href implies the respective launch URLs. 1949 // For packaged/hosted apps, empty href implies the respective launch URLs.
1950 if (href.empty()) { 1950 if (href.empty()) {
1951 if (is_hosted_app()) { 1951 if (is_hosted_app()) {
1952 href = launch_web_url(); 1952 href = launch_web_url();
1953 } else if (is_packaged_app()) { 1953 } else if (is_legacy_packaged_app()) {
1954 href = launch_local_path(); 1954 href = launch_local_path();
1955 } 1955 }
1956 } 1956 }
1957 1957
1958 // If there still is not an href, the manifest is malformed, unless this is a 1958 // If there still is not an href, the manifest is malformed, unless this is a
1959 // platform app in which case the href should not be present. 1959 // platform app in which case the href should not be present.
1960 if (href.empty() && !is_platform_app()) { 1960 if (href.empty() && !is_platform_app()) {
1961 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( 1961 *error = ExtensionErrorUtils::FormatErrorMessageUTF16(
1962 errors::kInvalidIntentHrefEmpty, action_name); 1962 errors::kInvalidIntentHrefEmpty, action_name);
1963 return false; 1963 return false;
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
2564 #endif 2564 #endif
2565 2565
2566 if (is_override || !overrides->GetStringWithoutPathExpansion(*iter, &val)) { 2566 if (is_override || !overrides->GetStringWithoutPathExpansion(*iter, &val)) {
2567 *error = ASCIIToUTF16(errors::kInvalidChromeURLOverrides); 2567 *error = ASCIIToUTF16(errors::kInvalidChromeURLOverrides);
2568 return false; 2568 return false;
2569 } 2569 }
2570 // Replace the entry with a fully qualified chrome-extension:// URL. 2570 // Replace the entry with a fully qualified chrome-extension:// URL.
2571 chrome_url_overrides_[page] = GetResourceURL(val); 2571 chrome_url_overrides_[page] = GetResourceURL(val);
2572 2572
2573 // For component extensions, add override URL to extent patterns. 2573 // For component extensions, add override URL to extent patterns.
2574 if (is_packaged_app() && location() == COMPONENT) { 2574 if (is_legacy_packaged_app() && location() == COMPONENT) {
2575 URLPattern pattern(URLPattern::SCHEME_CHROMEUI); 2575 URLPattern pattern(URLPattern::SCHEME_CHROMEUI);
2576 std::string url = base::StringPrintf(kOverrideExtentUrlPatternFormat, 2576 std::string url = base::StringPrintf(kOverrideExtentUrlPatternFormat,
2577 page.c_str()); 2577 page.c_str());
2578 if (pattern.Parse(url) != URLPattern::PARSE_SUCCESS) { 2578 if (pattern.Parse(url) != URLPattern::PARSE_SUCCESS) {
2579 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( 2579 *error = ExtensionErrorUtils::FormatErrorMessageUTF16(
2580 errors::kInvalidURLPatternError, url); 2580 errors::kInvalidURLPatternError, url);
2581 return false; 2581 return false;
2582 } 2582 }
2583 extent_.AddPattern(pattern); 2583 extent_.AddPattern(pattern);
2584 } 2584 }
(...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after
3732 return SYNC_TYPE_EXTENSION; 3732 return SYNC_TYPE_EXTENSION;
3733 3733
3734 case Extension::TYPE_USER_SCRIPT: 3734 case Extension::TYPE_USER_SCRIPT:
3735 // We only want to sync user scripts with gallery update URLs. 3735 // We only want to sync user scripts with gallery update URLs.
3736 if (UpdatesFromGallery()) 3736 if (UpdatesFromGallery())
3737 return SYNC_TYPE_EXTENSION; 3737 return SYNC_TYPE_EXTENSION;
3738 else 3738 else
3739 return SYNC_TYPE_NONE; 3739 return SYNC_TYPE_NONE;
3740 3740
3741 case Extension::TYPE_HOSTED_APP: 3741 case Extension::TYPE_HOSTED_APP:
3742 case Extension::TYPE_PACKAGED_APP: 3742 case Extension::TYPE_LEGACY_PACKAGED_APP:
3743 return SYNC_TYPE_APP; 3743 return SYNC_TYPE_APP;
3744 3744
3745 default: 3745 default:
3746 return SYNC_TYPE_NONE; 3746 return SYNC_TYPE_NONE;
3747 } 3747 }
3748 } 3748 }
3749 3749
3750 bool Extension::IsSyncable() const { 3750 bool Extension::IsSyncable() const {
3751 // TODO(akalin): Figure out if we need to allow some other types. 3751 // TODO(akalin): Figure out if we need to allow some other types.
3752 3752
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
3962 3962
3963 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( 3963 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo(
3964 const Extension* extension, 3964 const Extension* extension,
3965 const PermissionSet* permissions, 3965 const PermissionSet* permissions,
3966 Reason reason) 3966 Reason reason)
3967 : reason(reason), 3967 : reason(reason),
3968 extension(extension), 3968 extension(extension),
3969 permissions(permissions) {} 3969 permissions(permissions) {}
3970 3970
3971 } // namespace extensions 3971 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698