| 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 1758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1769 if (!intent_service.GetString(keys::kIntentHref, &href)) { | 1769 if (!intent_service.GetString(keys::kIntentHref, &href)) { |
| 1770 *error = ASCIIToUTF16(errors::kInvalidIntentHref); | 1770 *error = ASCIIToUTF16(errors::kInvalidIntentHref); |
| 1771 return false; | 1771 return false; |
| 1772 } | 1772 } |
| 1773 } | 1773 } |
| 1774 | 1774 |
| 1775 // For packaged/hosted apps, empty href implies the respective launch URLs. | 1775 // For packaged/hosted apps, empty href implies the respective launch URLs. |
| 1776 if (href.empty()) { | 1776 if (href.empty()) { |
| 1777 if (is_hosted_app()) { | 1777 if (is_hosted_app()) { |
| 1778 href = launch_web_url(); | 1778 href = launch_web_url(); |
| 1779 } else if (is_packaged_app() || is_platform_app()) { | 1779 } else if (is_packaged_app()) { |
| 1780 href = launch_local_path(); | 1780 href = launch_local_path(); |
| 1781 } | 1781 } |
| 1782 } | 1782 } |
| 1783 | 1783 |
| 1784 // If we still don't have an href, the manifest is malformed. | 1784 // If we still don't have an href, the manifest is malformed. |
| 1785 if (href.empty()) { | 1785 if (href.empty() && !is_platform_app()) { |
| 1786 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( | 1786 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( |
| 1787 errors::kInvalidIntentHrefEmpty, action_name); | 1787 errors::kInvalidIntentHrefEmpty, action_name); |
| 1788 return false; | 1788 return false; |
| 1789 } | 1789 } |
| 1790 | 1790 |
| 1791 GURL service_url(href); | 1791 GURL service_url(href); |
| 1792 if (is_hosted_app()) { | 1792 if (is_hosted_app()) { |
| 1793 // Hosted apps require an absolute URL for intents. | 1793 // Hosted apps require an absolute URL for intents. |
| 1794 if (!service_url.is_valid() || | 1794 if (!service_url.is_valid() || |
| 1795 !(web_extent().MatchesURL(service_url))) { | 1795 !(web_extent().MatchesURL(service_url))) { |
| 1796 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( | 1796 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( |
| 1797 errors::kInvalidIntentPageInHostedApp, action_name); | 1797 errors::kInvalidIntentPageInHostedApp, action_name); |
| 1798 return false; | 1798 return false; |
| 1799 } | 1799 } |
| 1800 service.service_url = service_url; | 1800 service.service_url = service_url; |
| 1801 } else { | 1801 } else if (!is_platform_app()) { |
| 1802 // We do not allow absolute intent URLs in non-hosted apps. | 1802 // We do not allow absolute intent URLs in non-hosted apps. |
| 1803 if (service_url.is_valid()) { | 1803 if (service_url.is_valid()) { |
| 1804 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( | 1804 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( |
| 1805 errors::kCannotAccessPage, href); | 1805 errors::kCannotAccessPage, href); |
| 1806 return false; | 1806 return false; |
| 1807 } | 1807 } |
| 1808 service.service_url = GetResourceURL(href); | 1808 service.service_url = GetResourceURL(href); |
| 1809 } | 1809 } |
| 1810 | 1810 |
| 1811 if (intent_service.HasKey(keys::kIntentTitle) && | 1811 if (intent_service.HasKey(keys::kIntentTitle) && |
| (...skipping 1745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3557 | 3557 |
| 3558 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( | 3558 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( |
| 3559 const Extension* extension, | 3559 const Extension* extension, |
| 3560 const ExtensionPermissionSet* permissions, | 3560 const ExtensionPermissionSet* permissions, |
| 3561 Reason reason) | 3561 Reason reason) |
| 3562 : reason(reason), | 3562 : reason(reason), |
| 3563 extension(extension), | 3563 extension(extension), |
| 3564 permissions(permissions) {} | 3564 permissions(permissions) {} |
| 3565 | 3565 |
| 3566 } // namespace extensions | 3566 } // namespace extensions |
| OLD | NEW |