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

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 '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
« no previous file with comments | « chrome/browser/installable/installable_logging.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 kUrlNotSupportedForWebApkMessage[] =
dominickn 2016/08/29 00:15:41 Nit: you removed checking the username for a port,
63 "a URL in the web manifest contains a username, password, or port";
62 64
63 } // namespace 65 } // namespace
64 66
65 void LogErrorToConsole(content::WebContents* web_contents, 67 void LogErrorToConsole(content::WebContents* web_contents,
66 InstallableStatusCode code, 68 InstallableStatusCode code,
67 const std::string& param) { 69 const std::string& param) {
68 if (!web_contents) 70 if (!web_contents)
69 return; 71 return;
70 72
71 content::ConsoleMessageLevel severity = content::CONSOLE_MESSAGE_LEVEL_ERROR; 73 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: 135 case PLATFORM_NOT_SUPPORTED_ON_ANDROID:
134 pattern = kPlatformNotSupportedOnAndroidMessage; 136 pattern = kPlatformNotSupportedOnAndroidMessage;
135 severity = content::CONSOLE_MESSAGE_LEVEL_WARNING; 137 severity = content::CONSOLE_MESSAGE_LEVEL_WARNING;
136 break; 138 break;
137 case NO_ID_SPECIFIED: 139 case NO_ID_SPECIFIED:
138 pattern = kNoIdSpecifiedMessage; 140 pattern = kNoIdSpecifiedMessage;
139 break; 141 break;
140 case IDS_DO_NOT_MATCH: 142 case IDS_DO_NOT_MATCH:
141 pattern = kIdsDoNotMatchMessage; 143 pattern = kIdsDoNotMatchMessage;
142 break; 144 break;
145 case URL_NOT_SUPPORTED_FOR_WEBAPK:
146 pattern = kUrlNotSupportedForWebApkMessage;
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
« no previous file with comments | « chrome/browser/installable/installable_logging.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698