| 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 1743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1754 if (!intent_service.GetString(keys::kIntentHref, &href)) { | 1754 if (!intent_service.GetString(keys::kIntentHref, &href)) { |
| 1755 *error = ASCIIToUTF16(errors::kInvalidIntentHref); | 1755 *error = ASCIIToUTF16(errors::kInvalidIntentHref); |
| 1756 return false; | 1756 return false; |
| 1757 } | 1757 } |
| 1758 } | 1758 } |
| 1759 | 1759 |
| 1760 // For packaged/hosted apps, empty href implies the respective launch URLs. | 1760 // For packaged/hosted apps, empty href implies the respective launch URLs. |
| 1761 if (href.empty()) { | 1761 if (href.empty()) { |
| 1762 if (is_hosted_app()) { | 1762 if (is_hosted_app()) { |
| 1763 href = launch_web_url(); | 1763 href = launch_web_url(); |
| 1764 } else if (is_packaged_app() || is_platform_app()) { | 1764 } else if (is_packaged_app()) { |
| 1765 href = launch_local_path(); | 1765 href = launch_local_path(); |
| 1766 } | 1766 } |
| 1767 } | 1767 } |
| 1768 | 1768 |
| 1769 // If we still don't have an href, the manifest is malformed. | 1769 // If we still don't have an href, the manifest is malformed. |
| 1770 if (href.empty()) { | 1770 if (href.empty() && !is_platform_app()) { |
| 1771 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( | 1771 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( |
| 1772 errors::kInvalidIntentHrefEmpty, action_name); | 1772 errors::kInvalidIntentHrefEmpty, action_name); |
| 1773 return false; | 1773 return false; |
| 1774 } | 1774 } |
| 1775 | 1775 |
| 1776 GURL service_url(href); | 1776 GURL service_url(href); |
| 1777 if (is_hosted_app()) { | 1777 if (is_hosted_app()) { |
| 1778 // Hosted apps require an absolute URL for intents. | 1778 // Hosted apps require an absolute URL for intents. |
| 1779 if (!service_url.is_valid() || | 1779 if (!service_url.is_valid() || |
| 1780 !(web_extent().MatchesURL(service_url))) { | 1780 !(web_extent().MatchesURL(service_url))) { |
| 1781 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( | 1781 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( |
| 1782 errors::kInvalidIntentPageInHostedApp, action_name); | 1782 errors::kInvalidIntentPageInHostedApp, action_name); |
| 1783 return false; | 1783 return false; |
| 1784 } | 1784 } |
| 1785 service.service_url = service_url; | 1785 service.service_url = service_url; |
| 1786 } else { | 1786 } else if (!is_platform_app()) { |
| 1787 // We do not allow absolute intent URLs in non-hosted apps. | 1787 // We do not allow absolute intent URLs in non-hosted apps. |
| 1788 if (service_url.is_valid()) { | 1788 if (service_url.is_valid()) { |
| 1789 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( | 1789 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( |
| 1790 errors::kCannotAccessPage, href); | 1790 errors::kCannotAccessPage, href); |
| 1791 return false; | 1791 return false; |
| 1792 } | 1792 } |
| 1793 service.service_url = GetResourceURL(href); | 1793 service.service_url = GetResourceURL(href); |
| 1794 } | 1794 } |
| 1795 | 1795 |
| 1796 if (intent_service.HasKey(keys::kIntentTitle) && | 1796 if (intent_service.HasKey(keys::kIntentTitle) && |
| (...skipping 1766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3563 already_disabled(false), | 3563 already_disabled(false), |
| 3564 extension(extension) {} | 3564 extension(extension) {} |
| 3565 | 3565 |
| 3566 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( | 3566 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( |
| 3567 const Extension* extension, | 3567 const Extension* extension, |
| 3568 const ExtensionPermissionSet* permissions, | 3568 const ExtensionPermissionSet* permissions, |
| 3569 Reason reason) | 3569 Reason reason) |
| 3570 : reason(reason), | 3570 : reason(reason), |
| 3571 extension(extension), | 3571 extension(extension), |
| 3572 permissions(permissions) {} | 3572 permissions(permissions) {} |
| OLD | NEW |