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 'master' 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 return !url.has_username() && !url.has_password();
18 }
19
20 } // anonymous namespace
21
22 bool AreWebManifestUrlsWebApkCompatible(const content::Manifest& manifest) {
23 for (const content::Manifest::Icon& icon : manifest.icons) {
24 if (!IsUrlWebApkCompatible(icon.src))
25 return false;
26 }
27
28 // Do not check "related_applications" URLs because they are not used by
29 // WebAPKs.
30
31 return IsUrlWebApkCompatible(manifest.start_url) &&
32 IsUrlWebApkCompatible(manifest.scope);
33 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698