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

Side by Side Diff: chrome/browser/installable/installable_logging.cc

Issue 2633603002: Disable app banners in incognito. (Closed)
Patch Set: Comment + rebase Created 3 years, 11 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
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[] = 62 static const char kUrlNotSupportedForWebApkMessage[] =
63 "a URL in the web manifest contains a username, password, or port"; 63 "a URL in the web manifest contains a username, password, or port";
64 static const char kInIncognitoMessage[] =
65 "the page is loaded in an incognito window";
64 66
65 } // namespace 67 } // namespace
66 68
67 void LogErrorToConsole(content::WebContents* web_contents, 69 void LogErrorToConsole(content::WebContents* web_contents,
68 InstallableStatusCode code, 70 InstallableStatusCode code,
69 const std::string& param) { 71 const std::string& param) {
70 if (!web_contents) 72 if (!web_contents)
71 return; 73 return;
72 74
73 content::ConsoleMessageLevel severity = content::CONSOLE_MESSAGE_LEVEL_ERROR; 75 content::ConsoleMessageLevel severity = content::CONSOLE_MESSAGE_LEVEL_ERROR;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 break; 140 break;
139 case NO_ID_SPECIFIED: 141 case NO_ID_SPECIFIED:
140 pattern = kNoIdSpecifiedMessage; 142 pattern = kNoIdSpecifiedMessage;
141 break; 143 break;
142 case IDS_DO_NOT_MATCH: 144 case IDS_DO_NOT_MATCH:
143 pattern = kIdsDoNotMatchMessage; 145 pattern = kIdsDoNotMatchMessage;
144 break; 146 break;
145 case URL_NOT_SUPPORTED_FOR_WEBAPK: 147 case URL_NOT_SUPPORTED_FOR_WEBAPK:
146 pattern = kUrlNotSupportedForWebApkMessage; 148 pattern = kUrlNotSupportedForWebApkMessage;
147 break; 149 break;
150 case IN_INCOGNITO:
151 pattern = kInIncognitoMessage;
152 break;
148 } 153 }
149 154
150 if (!pattern) 155 if (!pattern)
151 return; 156 return;
152 std::string message = param.empty() ? 157 std::string message = param.empty() ?
153 pattern : base::StringPrintf(pattern, param.c_str()); 158 pattern : base::StringPrintf(pattern, param.c_str());
154 web_contents->GetMainFrame()->AddMessageToConsole( 159 web_contents->GetMainFrame()->AddMessageToConsole(
155 severity, GetMessagePrefix() + message); 160 severity, GetMessagePrefix() + message);
156 } 161 }
OLDNEW
« no previous file with comments | « chrome/browser/installable/installable_logging.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698