| 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 1772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1783 if (!intent_service.GetString(keys::kIntentHref, &href)) { | 1783 if (!intent_service.GetString(keys::kIntentHref, &href)) { |
| 1784 *error = ASCIIToUTF16(errors::kInvalidIntentHref); | 1784 *error = ASCIIToUTF16(errors::kInvalidIntentHref); |
| 1785 return false; | 1785 return false; |
| 1786 } | 1786 } |
| 1787 } | 1787 } |
| 1788 | 1788 |
| 1789 // For packaged/hosted apps, empty href implies the respective launch URLs. | 1789 // For packaged/hosted apps, empty href implies the respective launch URLs. |
| 1790 if (href.empty()) { | 1790 if (href.empty()) { |
| 1791 if (is_hosted_app()) { | 1791 if (is_hosted_app()) { |
| 1792 href = launch_web_url(); | 1792 href = launch_web_url(); |
| 1793 } else if (is_packaged_app() || is_platform_app()) { | 1793 } else if (is_packaged_app()) { |
| 1794 href = launch_local_path(); | 1794 href = launch_local_path(); |
| 1795 } | 1795 } |
| 1796 } | 1796 } |
| 1797 | 1797 |
| 1798 // If we still don't have an href, the manifest is malformed. | 1798 // If we still don't have an href, the manifest is malformed. |
| 1799 if (href.empty()) { | 1799 if (href.empty() && !is_platform_app()) { |
| 1800 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( | 1800 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( |
| 1801 errors::kInvalidIntentHrefEmpty, action_name); | 1801 errors::kInvalidIntentHrefEmpty, action_name); |
| 1802 return false; | 1802 return false; |
| 1803 } | 1803 } |
| 1804 | 1804 |
| 1805 GURL service_url(href); | 1805 GURL service_url(href); |
| 1806 if (is_hosted_app()) { | 1806 if (is_hosted_app()) { |
| 1807 // Hosted apps require an absolute URL for intents. | 1807 // Hosted apps require an absolute URL for intents. |
| 1808 if (!service_url.is_valid() || | 1808 if (!service_url.is_valid() || |
| 1809 !(web_extent().MatchesURL(service_url))) { | 1809 !(web_extent().MatchesURL(service_url))) { |
| 1810 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( | 1810 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( |
| 1811 errors::kInvalidIntentPageInHostedApp, action_name); | 1811 errors::kInvalidIntentPageInHostedApp, action_name); |
| 1812 return false; | 1812 return false; |
| 1813 } | 1813 } |
| 1814 service.service_url = service_url; | 1814 service.service_url = service_url; |
| 1815 } else { | 1815 } else if (!is_platform_app()) { |
| 1816 // We do not allow absolute intent URLs in non-hosted apps. | 1816 // We do not allow absolute intent URLs in non-hosted apps. |
| 1817 if (service_url.is_valid()) { | 1817 if (service_url.is_valid()) { |
| 1818 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( | 1818 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( |
| 1819 errors::kCannotAccessPage, href); | 1819 errors::kCannotAccessPage, href); |
| 1820 return false; | 1820 return false; |
| 1821 } | 1821 } |
| 1822 service.service_url = GetResourceURL(href); | 1822 service.service_url = GetResourceURL(href); |
| 1823 } | 1823 } |
| 1824 | 1824 |
| 1825 if (intent_service.HasKey(keys::kIntentTitle) && | 1825 if (intent_service.HasKey(keys::kIntentTitle) && |
| (...skipping 1747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3573 | 3573 |
| 3574 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( | 3574 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( |
| 3575 const Extension* extension, | 3575 const Extension* extension, |
| 3576 const ExtensionPermissionSet* permissions, | 3576 const ExtensionPermissionSet* permissions, |
| 3577 Reason reason) | 3577 Reason reason) |
| 3578 : reason(reason), | 3578 : reason(reason), |
| 3579 extension(extension), | 3579 extension(extension), |
| 3580 permissions(permissions) {} | 3580 permissions(permissions) {} |
| 3581 | 3581 |
| 3582 } // namespace extensions | 3582 } // namespace extensions |
| OLD | NEW |