summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/bookmark_app_helper.cc
diff options
context:
space:
mode:
authorcalamity@chromium.org <calamity@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-08 08:45:29 +0000
committercalamity@chromium.org <calamity@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-08 08:45:29 +0000
commit9208654a6e331fd562c8d37325ed969044d76760 (patch)
treef287a5e2313fed9bc12732b6dec13bd0d6c01c13 /chrome/browser/extensions/bookmark_app_helper.cc
parentfb585cb37ecc33c59c33453632a98e856dbab7d6 (diff)
downloadchromium_src-9208654a6e331fd562c8d37325ed969044d76760.zip
chromium_src-9208654a6e331fd562c8d37325ed969044d76760.tar.gz
chromium_src-9208654a6e331fd562c8d37325ed969044d76760.tar.bz2
Make valid bookmark apps URLs consistent with valid Extension launch URLs.
This CL makes the allowed bookmark app URLs match the valid extension launch web URLs. This would cause the menu item to indicate a bookmark app could be created when the URL was not a valid hosted app URL. BUG=318607 Review URL: https://codereview.chromium.org/220163009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@262354 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/bookmark_app_helper.cc')
-rw-r--r--chrome/browser/extensions/bookmark_app_helper.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/chrome/browser/extensions/bookmark_app_helper.cc b/chrome/browser/extensions/bookmark_app_helper.cc
index 3c5b43d..c08faf4 100644
--- a/chrome/browser/extensions/bookmark_app_helper.cc
+++ b/chrome/browser/extensions/bookmark_app_helper.cc
@@ -17,6 +17,7 @@
#include "content/public/browser/notification_source.h"
#include "content/public/browser/web_contents.h"
#include "extensions/common/extension.h"
+#include "extensions/common/url_pattern.h"
#include "skia/ext/image_operations.h"
#include "skia/ext/platform_canvas.h"
#include "third_party/skia/include/core/SkBitmap.h"
@@ -291,4 +292,10 @@ void CreateOrUpdateBookmarkApp(ExtensionService* service,
installer->InstallWebApp(web_app_info);
}
+bool IsValidBookmarkAppUrl(const GURL& url) {
+ URLPattern origin_only_pattern(Extension::kValidWebExtentSchemes);
+ origin_only_pattern.SetMatchAllURLs(true);
+ return url.is_valid() && origin_only_pattern.MatchesURL(url);
+}
+
} // namespace extensions