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

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: Merge branch 'webapk_updater_non_installable' into webapk_installable_checker 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 "could not download the specified icon"; 52 "could not download the specified icon";
53 static const char kNoIconAvailableMessage[] = 53 static const char kNoIconAvailableMessage[] =
54 "no icon available to display"; 54 "no icon available to display";
55 static const char kPlatformNotSupportedOnAndroidMessage[] = 55 static const char kPlatformNotSupportedOnAndroidMessage[] =
56 "the specified application platform is not supported on Android"; 56 "the specified application platform is not supported on Android";
57 static const char kNoIdSpecifiedMessage[] = 57 static const char kNoIdSpecifiedMessage[] =
58 "no Play store ID provided"; 58 "no Play store ID provided";
59 static const char kIdsDoNotMatchMessage[] = 59 static const char kIdsDoNotMatchMessage[] =
60 "a Play Store app URL and Play Store ID were specified in the manifest, " 60 "a Play Store app URL and Play Store ID were specified in the manifest, "
61 "but they do not match"; 61 "but they do not match";
62 static const char kUrlUsernameAndPasswordNotSupportedForWebApkMessage[] =
63 "usernames and passwords in URLs in the web manifest are not supported for "
64 "WebAPKs";
65 static const char kUrlPortNotSupportedForWebApkMessage[] =
66 "explicit port in URLs in the web manifest is not supported for WebAPKs";
62 67
63 } // namespace 68 } // namespace
64 69
65 void LogErrorToConsole(content::WebContents* web_contents, 70 void LogErrorToConsole(content::WebContents* web_contents,
66 InstallableStatusCode code, 71 InstallableStatusCode code,
67 const std::string& param) { 72 const std::string& param) {
68 if (!web_contents) 73 if (!web_contents)
69 return; 74 return;
70 75
71 content::ConsoleMessageLevel severity = content::CONSOLE_MESSAGE_LEVEL_ERROR; 76 content::ConsoleMessageLevel severity = content::CONSOLE_MESSAGE_LEVEL_ERROR;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 case PLATFORM_NOT_SUPPORTED_ON_ANDROID: 138 case PLATFORM_NOT_SUPPORTED_ON_ANDROID:
134 pattern = kPlatformNotSupportedOnAndroidMessage; 139 pattern = kPlatformNotSupportedOnAndroidMessage;
135 severity = content::CONSOLE_MESSAGE_LEVEL_WARNING; 140 severity = content::CONSOLE_MESSAGE_LEVEL_WARNING;
136 break; 141 break;
137 case NO_ID_SPECIFIED: 142 case NO_ID_SPECIFIED:
138 pattern = kNoIdSpecifiedMessage; 143 pattern = kNoIdSpecifiedMessage;
139 break; 144 break;
140 case IDS_DO_NOT_MATCH: 145 case IDS_DO_NOT_MATCH:
141 pattern = kIdsDoNotMatchMessage; 146 pattern = kIdsDoNotMatchMessage;
142 break; 147 break;
148 case URL_USERNAME_AND_PASSWORD_NOT_SUPPORTED_FOR_WEBAPK:
149 pattern = kUrlUsernameAndPasswordNotSupportedForWebApkMessage;
150 break;
151 case URL_PORT_NOT_SUPPORTED_FOR_WEBAPK:
152 pattern = kUrlPortNotSupportedForWebApkMessage;
153 break;
143 } 154 }
144 155
145 if (!pattern) 156 if (!pattern)
146 return; 157 return;
147 std::string message = param.empty() ? 158 std::string message = param.empty() ?
148 pattern : base::StringPrintf(pattern, param.c_str()); 159 pattern : base::StringPrintf(pattern, param.c_str());
149 web_contents->GetMainFrame()->AddMessageToConsole( 160 web_contents->GetMainFrame()->AddMessageToConsole(
150 severity, GetMessagePrefix() + message); 161 severity, GetMessagePrefix() + message);
151 } 162 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698