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

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

Issue 2178833002: Add new app banner metrics using InstallableStatusCode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@banner-integrate-checker-no-refptr
Patch Set: Rebase 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 void LogErrorToConsole(content::WebContents* web_contents, 65 void LogErrorToConsole(content::WebContents* web_contents,
66 InstallableErrorCode code, 66 InstallableErrorCode code,
67 const std::string& param) { 67 const std::string& param) {
68 if (!web_contents) 68 if (!web_contents)
69 return; 69 return;
70 70
71 content::ConsoleMessageLevel severity = content::CONSOLE_MESSAGE_LEVEL_ERROR; 71 content::ConsoleMessageLevel severity = content::CONSOLE_MESSAGE_LEVEL_ERROR;
72 const char* pattern = nullptr; 72 const char* pattern = nullptr;
73 switch (code) { 73 switch (code) {
74 case NO_ERROR_DETECTED: 74 case NO_ERROR_DETECTED:
75 // These codes are solely used for UMA reporting.
76 case ALREADY_INSTALLED:
77 case INSUFFICIENT_ENGAGEMENT:
78 case PACKAGE_NAME_OR_START_URL_EMPTY:
79 case PREVIOUSLY_BLOCKED:
80 case PREVIOUSLY_IGNORED:
81 case SHOWING_NATIVE_APP_BANNER:
82 case SHOWING_WEB_APP_BANNER:
83 case FAILED_TO_CREATE_BANNER:
75 case MAX_ERROR_CODE: 84 case MAX_ERROR_CODE:
76 return; 85 return;
77 case RENDERER_EXITING: 86 case RENDERER_EXITING:
78 pattern = kRendererExitingMessage; 87 pattern = kRendererExitingMessage;
79 break; 88 break;
80 case RENDERER_CANCELLED: 89 case RENDERER_CANCELLED:
81 pattern = kRendererCancelledMessage; 90 pattern = kRendererCancelledMessage;
82 severity = content::CONSOLE_MESSAGE_LEVEL_LOG; 91 severity = content::CONSOLE_MESSAGE_LEVEL_LOG;
83 break; 92 break;
84 case USER_NAVIGATED: 93 case USER_NAVIGATED:
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 break; 142 break;
134 } 143 }
135 144
136 if (!pattern) 145 if (!pattern)
137 return; 146 return;
138 std::string message = param.empty() ? 147 std::string message = param.empty() ?
139 pattern : base::StringPrintf(pattern, param.c_str()); 148 pattern : base::StringPrintf(pattern, param.c_str());
140 web_contents->GetMainFrame()->AddMessageToConsole( 149 web_contents->GetMainFrame()->AddMessageToConsole(
141 severity, GetMessagePrefix() + message); 150 severity, GetMessagePrefix() + message);
142 } 151 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698