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

Side by Side Diff: chrome/browser/android/webapk/webapk_web_manifest_checker.cc

Issue 2248293002: Do not install WebAPKs with web manifests with invalid URL components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge branch 'webapk_updater_non_installable' into webapk_installable_checker Created 4 years, 3 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
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/android/webapk/webapk_web_manifest_checker.h"
6
7 #include "content/public/common/manifest.h"
8 #include "url/gurl.h"
9
10 namespace {
11
12 // Returns whether a URL in the Web Manifest is WebAPK compatible.
13 bool IsUrlWebApkCompatible(const GURL& url) {
14 // WebAPK web manifests are stored on the Chrome WebAPK server. Do not
15 // generate WebAPKs for Web Manifests with URLs with a user name or password
16 // in order to avoid storing user names and passwords on the WebAPK server.
17 if (url.has_username() || url.has_password())
18 return false;
19
20 // For the sake of simplicity we do not generate WebAPKs for Web Manifests
21 // with URLs with a custom port.
22 return !url.has_port();
23 }
24
25 } // anonymous namespace
26
27 bool AreWebManifestUrlsWebApkCompatible(const content::Manifest& manifest) {
28 for (const content::Manifest::Icon& icon : manifest.icons) {
29 if (!IsUrlWebApkCompatible(icon.src))
30 return false;
31 }
32
33 // Do not check "related_applications" URLs because they are not used by
34 // WebAPKs.
35
36 return IsUrlWebApkCompatible(manifest.start_url) &&
37 IsUrlWebApkCompatible(manifest.scope);
38 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698