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

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

Issue 10332071: Pass command line arguments onto platform apps which provide the right intent. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Doh Created 8 years, 7 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 | Annotate | Revision Log
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 "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 1747 matching lines...) Expand 10 before | Expand all | Expand 10 after
1758 if (!intent_service.GetString(keys::kIntentHref, &href)) { 1758 if (!intent_service.GetString(keys::kIntentHref, &href)) {
1759 *error = ASCIIToUTF16(errors::kInvalidIntentHref); 1759 *error = ASCIIToUTF16(errors::kInvalidIntentHref);
1760 return false; 1760 return false;
1761 } 1761 }
1762 } 1762 }
1763 1763
1764 // For packaged/hosted apps, empty href implies the respective launch URLs. 1764 // For packaged/hosted apps, empty href implies the respective launch URLs.
1765 if (href.empty()) { 1765 if (href.empty()) {
1766 if (is_hosted_app()) { 1766 if (is_hosted_app()) {
1767 href = launch_web_url(); 1767 href = launch_web_url();
1768 } else if (is_packaged_app() || is_platform_app()) { 1768 } else if (is_packaged_app()) {
1769 href = launch_local_path(); 1769 href = launch_local_path();
1770 } 1770 }
1771 } 1771 }
1772 1772
1773 // If we still don't have an href, the manifest is malformed. 1773 // If we still don't have an href, the manifest is malformed.
1774 if (href.empty()) { 1774 if (href.empty() && !is_platform_app()) {
1775 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( 1775 *error = ExtensionErrorUtils::FormatErrorMessageUTF16(
1776 errors::kInvalidIntentHrefEmpty, action_name); 1776 errors::kInvalidIntentHrefEmpty, action_name);
1777 return false; 1777 return false;
1778 } 1778 }
1779 1779
1780 GURL service_url(href); 1780 GURL service_url(href);
1781 if (is_hosted_app()) { 1781 if (is_hosted_app()) {
1782 // Hosted apps require an absolute URL for intents. 1782 // Hosted apps require an absolute URL for intents.
1783 if (!service_url.is_valid() || 1783 if (!service_url.is_valid() ||
1784 !(web_extent().MatchesURL(service_url))) { 1784 !(web_extent().MatchesURL(service_url))) {
1785 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( 1785 *error = ExtensionErrorUtils::FormatErrorMessageUTF16(
1786 errors::kInvalidIntentPageInHostedApp, action_name); 1786 errors::kInvalidIntentPageInHostedApp, action_name);
1787 return false; 1787 return false;
1788 } 1788 }
1789 service.service_url = service_url; 1789 service.service_url = service_url;
1790 } else { 1790 } else if (!is_platform_app()) {
1791 // We do not allow absolute intent URLs in non-hosted apps. 1791 // We do not allow absolute intent URLs in non-hosted apps.
1792 if (service_url.is_valid()) { 1792 if (service_url.is_valid()) {
1793 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( 1793 *error = ExtensionErrorUtils::FormatErrorMessageUTF16(
1794 errors::kCannotAccessPage, href); 1794 errors::kCannotAccessPage, href);
1795 return false; 1795 return false;
1796 } 1796 }
1797 service.service_url = GetResourceURL(href); 1797 service.service_url = GetResourceURL(href);
1798 } 1798 }
1799 1799
1800 if (intent_service.HasKey(keys::kIntentTitle) && 1800 if (intent_service.HasKey(keys::kIntentTitle) &&
(...skipping 1745 matching lines...) Expand 10 before | Expand all | Expand 10 after
3546 3546
3547 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( 3547 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo(
3548 const Extension* extension, 3548 const Extension* extension,
3549 const ExtensionPermissionSet* permissions, 3549 const ExtensionPermissionSet* permissions,
3550 Reason reason) 3550 Reason reason)
3551 : reason(reason), 3551 : reason(reason),
3552 extension(extension), 3552 extension(extension),
3553 permissions(permissions) {} 3553 permissions(permissions) {}
3554 3554
3555 } // namespace extensions 3555 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698