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

Side by Side Diff: chrome/browser/installable/installable_logging.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: Created 4 years, 4 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 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/browser/installable/installable_logging.h" 5 #include "chrome/browser/installable/installable_logging.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "content/public/browser/render_frame_host.h" 9 #include "content/public/browser/render_frame_host.h"
10 #include "content/public/browser/web_contents.h" 10 #include "content/public/browser/web_contents.h"
(...skipping 16 matching lines...) Expand all
27 static const char kNotInMainFrameMessage[] = 27 static const char kNotInMainFrameMessage[] =
28 "the page is not loaded in the main frame"; 28 "the page is not loaded in the main frame";
29 static const char kNotFromSecureOriginMessage[] = 29 static const char kNotFromSecureOriginMessage[] =
30 "the page is not served from a secure origin"; 30 "the page is not served from a secure origin";
31 static const char kNoManifestMessage[] = 31 static const char kNoManifestMessage[] =
32 "the page has no manifest <link> URL"; 32 "the page has no manifest <link> URL";
33 static const char kManifestEmptyMessage[] = 33 static const char kManifestEmptyMessage[] =
34 "the manifest could not be fetched, is empty, or could not be parsed"; 34 "the manifest could not be fetched, is empty, or could not be parsed";
35 static const char kStartUrlNotValidMessage[] = 35 static const char kStartUrlNotValidMessage[] =
36 "the start URL in manifest is not valid"; 36 "the start URL in manifest is not valid";
37 static const char kUrlUsernameAndPasswordNotSupportedMessage[] =
dominickn 2016/08/17 22:54:43 Move to the end to match the order in the enum. Al
38 "usernames and passwords in URLs in the web manifest are not supported";
37 static const char kManifestMissingNameOrShortNameMessage[] = 39 static const char kManifestMissingNameOrShortNameMessage[] =
38 "one of manifest name or short name must be specified"; 40 "one of manifest name or short name must be specified";
39 static const char kManifestDisplayNotSupportedMessage[] = 41 static const char kManifestDisplayNotSupportedMessage[] =
40 "the manifest display property must be set to 'standalone' or 'fullscreen'"; 42 "the manifest display property must be set to 'standalone' or 'fullscreen'";
41 static const char kManifestMissingSuitableIconMessage[] = 43 static const char kManifestMissingSuitableIconMessage[] =
42 "the manifest does not contain a suitable icon - PNG format of at least " 44 "the manifest does not contain a suitable icon - PNG format of at least "
43 "%spx is required, and the sizes attribute must be set"; 45 "%spx is required, and the sizes attribute must be set";
44 static const char kNoMatchingServiceWorkerMessage[] = 46 static const char kNoMatchingServiceWorkerMessage[] =
45 "no matching service worker detected. You may need to reload the page, or " 47 "no matching service worker detected. You may need to reload the page, or "
46 "check that the service worker for the current page also controls the " 48 "check that the service worker for the current page also controls the "
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 break; 104 break;
103 case NO_MANIFEST: 105 case NO_MANIFEST:
104 pattern = kNoManifestMessage; 106 pattern = kNoManifestMessage;
105 break; 107 break;
106 case MANIFEST_EMPTY: 108 case MANIFEST_EMPTY:
107 pattern = kManifestEmptyMessage; 109 pattern = kManifestEmptyMessage;
108 break; 110 break;
109 case START_URL_NOT_VALID: 111 case START_URL_NOT_VALID:
110 pattern = kStartUrlNotValidMessage; 112 pattern = kStartUrlNotValidMessage;
111 break; 113 break;
114 case URL_USERNAME_AND_PASSWORD_NOT_SUPPORTED:
115 pattern = kUrlUsernameAndPasswordNotSupportedMessage;
116 break;
112 case MANIFEST_MISSING_NAME_OR_SHORT_NAME: 117 case MANIFEST_MISSING_NAME_OR_SHORT_NAME:
113 pattern = kManifestMissingNameOrShortNameMessage; 118 pattern = kManifestMissingNameOrShortNameMessage;
114 break; 119 break;
115 case MANIFEST_DISPLAY_NOT_SUPPORTED: 120 case MANIFEST_DISPLAY_NOT_SUPPORTED:
116 pattern = kManifestDisplayNotSupportedMessage; 121 pattern = kManifestDisplayNotSupportedMessage;
117 break; 122 break;
118 case MANIFEST_MISSING_SUITABLE_ICON: 123 case MANIFEST_MISSING_SUITABLE_ICON:
119 pattern = kManifestMissingSuitableIconMessage; 124 pattern = kManifestMissingSuitableIconMessage;
120 break; 125 break;
121 case NO_MATCHING_SERVICE_WORKER: 126 case NO_MATCHING_SERVICE_WORKER:
(...skipping 20 matching lines...) Expand all
142 break; 147 break;
143 } 148 }
144 149
145 if (!pattern) 150 if (!pattern)
146 return; 151 return;
147 std::string message = param.empty() ? 152 std::string message = param.empty() ?
148 pattern : base::StringPrintf(pattern, param.c_str()); 153 pattern : base::StringPrintf(pattern, param.c_str());
149 web_contents->GetMainFrame()->AddMessageToConsole( 154 web_contents->GetMainFrame()->AddMessageToConsole(
150 severity, GetMessagePrefix() + message); 155 severity, GetMessagePrefix() + message);
151 } 156 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698