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 "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/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 1734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1745 if (!intent_service.GetString(keys::kIntentHref, &href)) { | 1745 if (!intent_service.GetString(keys::kIntentHref, &href)) { |
| 1746 *error = ASCIIToUTF16(errors::kInvalidIntentHref); | 1746 *error = ASCIIToUTF16(errors::kInvalidIntentHref); |
| 1747 return false; | 1747 return false; |
| 1748 } | 1748 } |
| 1749 } | 1749 } |
| 1750 | 1750 |
| 1751 // For packaged/hosted apps, empty href implies the respective launch URLs. | 1751 // For packaged/hosted apps, empty href implies the respective launch URLs. |
| 1752 if (href.empty()) { | 1752 if (href.empty()) { |
| 1753 if (is_hosted_app()) { | 1753 if (is_hosted_app()) { |
| 1754 href = launch_web_url(); | 1754 href = launch_web_url(); |
| 1755 } else if (is_packaged_app() || is_platform_app()) { | 1755 } else if (is_packaged_app()) { |
| 1756 href = launch_local_path(); | 1756 href = launch_local_path(); |
| 1757 } | 1757 } |
| 1758 } | 1758 } |
| 1759 | 1759 |
| 1760 // If we still don't have an href, the manifest is malformed. | 1760 // If we still don't have an href, the manifest is malformed. |
| 1761 if (href.empty()) { | 1761 if (href.empty() && !is_platform_app()) { |
| 1762 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( | 1762 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( |
| 1763 errors::kInvalidIntentHrefEmpty, action_name); | 1763 errors::kInvalidIntentHrefEmpty, action_name); |
| 1764 return false; | 1764 return false; |
| 1765 } | 1765 } |
| 1766 | 1766 |
| 1767 GURL service_url(href); | 1767 GURL service_url(href); |
| 1768 if (is_hosted_app()) { | 1768 if (is_hosted_app()) { |
| 1769 // Hosted apps require an absolute URL for intents. | 1769 // Hosted apps require an absolute URL for intents. |
| 1770 if (!service_url.is_valid() || | 1770 if (!service_url.is_valid() || |
| 1771 !(web_extent().MatchesURL(service_url))) { | 1771 !(web_extent().MatchesURL(service_url))) { |
| 1772 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( | 1772 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( |
| 1773 errors::kInvalidIntentPageInHostedApp, action_name); | 1773 errors::kInvalidIntentPageInHostedApp, action_name); |
| 1774 return false; | 1774 return false; |
| 1775 } | 1775 } |
| 1776 service.service_url = service_url; | 1776 service.service_url = service_url; |
| 1777 } else { | 1777 } else { |
|
Mihai Parparita -not on Chrome
2012/05/15 00:39:28
Might as well make this into an explicit "else if
benwells
2012/05/18 03:36:02
Done.
| |
| 1778 // We do not allow absolute intent URLs in non-hosted apps. | 1778 // We do not allow absolute intent URLs in non-hosted apps. |
| 1779 if (service_url.is_valid()) { | 1779 if (service_url.is_valid()) { |
| 1780 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( | 1780 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( |
| 1781 errors::kCannotAccessPage, href); | 1781 errors::kCannotAccessPage, href); |
| 1782 return false; | 1782 return false; |
| 1783 } | 1783 } |
| 1784 service.service_url = GetResourceURL(href); | 1784 service.service_url = GetResourceURL(href); |
| 1785 } | 1785 } |
| 1786 | 1786 |
| 1787 if (intent_service.HasKey(keys::kIntentTitle) && | 1787 if (intent_service.HasKey(keys::kIntentTitle) && |
| (...skipping 1766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3554 already_disabled(false), | 3554 already_disabled(false), |
| 3555 extension(extension) {} | 3555 extension(extension) {} |
| 3556 | 3556 |
| 3557 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( | 3557 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( |
| 3558 const Extension* extension, | 3558 const Extension* extension, |
| 3559 const ExtensionPermissionSet* permissions, | 3559 const ExtensionPermissionSet* permissions, |
| 3560 Reason reason) | 3560 Reason reason) |
| 3561 : reason(reason), | 3561 : reason(reason), |
| 3562 extension(extension), | 3562 extension(extension), |
| 3563 permissions(permissions) {} | 3563 permissions(permissions) {} |
| OLD | NEW |