Commit 38ada396 authored by mad's avatar mad Committed by Commit bot

Small fixes to SRTPrompt.

Add histograms.xml info for the SRTPrompt, and don't create a browser if we are not going to prompt the user.

TBR=noelutz
For a simple histogram string rename in chrome\browser\safe_browsing\srt_global_error_win.cc

Review URL: https://codereview.chromium.org/607573002

Cr-Commit-Position: refs/heads/master@{#296858}
parent b54744da
...@@ -141,23 +141,23 @@ void ReportAndClearExitCode(int exit_code, const std::string& version) { ...@@ -141,23 +141,23 @@ void ReportAndClearExitCode(int exit_code, const std::string& version) {
Browser* browser = chrome::FindLastActiveWithHostDesktopType(desktop_type); Browser* browser = chrome::FindLastActiveWithHostDesktopType(desktop_type);
if (browser) { if (browser) {
Profile* profile = browser->profile(); Profile* profile = browser->profile();
// Don't show the prompt again if it's been shown before for this profile.
DCHECK(profile); DCHECK(profile);
// Now that we have a profile, make sure we have a tabbed browser since we
// need to anchor the bubble to the toolbar's wrench menu. Create one if
// none exist already.
if (browser->type() != Browser::TYPE_TABBED) {
browser = chrome::FindTabbedBrowser(profile, false, desktop_type);
if (!browser)
browser = new Browser(Browser::CreateParams(profile, desktop_type));
}
const std::string prompt_version = const std::string prompt_version =
profile->GetPrefs()->GetString(prefs::kSwReporterPromptVersion); profile->GetPrefs()->GetString(prefs::kSwReporterPromptVersion);
// Don't show the prompt again if it's been shown before.
if (prompt_version.empty()) { if (prompt_version.empty()) {
profile->GetPrefs()->SetString(prefs::kSwReporterPromptVersion, profile->GetPrefs()->SetString(prefs::kSwReporterPromptVersion,
version); version);
profile->GetPrefs()->SetInteger(prefs::kSwReporterPromptReason, profile->GetPrefs()->SetInteger(prefs::kSwReporterPromptReason,
exit_code); exit_code);
// Now that we have a profile, make sure we have a tabbed browser since
// we need to anchor the bubble to the toolbar's wrench menu. Create one
// if none exist already.
if (browser->type() != Browser::TYPE_TABBED) {
browser = chrome::FindTabbedBrowser(profile, false, desktop_type);
if (!browser)
browser = new Browser(Browser::CreateParams(profile, desktop_type));
}
GlobalErrorService* global_error_service = GlobalErrorService* global_error_service =
GlobalErrorServiceFactory::GetForProfile(profile); GlobalErrorServiceFactory::GetForProfile(profile);
SRTGlobalError* global_error = new SRTGlobalError(global_error_service); SRTGlobalError* global_error = new SRTGlobalError(global_error_service);
......
...@@ -30,7 +30,8 @@ enum SRTPromptHistogramValue { ...@@ -30,7 +30,8 @@ enum SRTPromptHistogramValue {
}; };
void RecordSRTPromptHistogram(SRTPromptHistogramValue value) { void RecordSRTPromptHistogram(SRTPromptHistogramValue value) {
UMA_HISTOGRAM_ENUMERATION("SRTPrompt", value, SRT_PROMPT_MAX); UMA_HISTOGRAM_ENUMERATION(
"SoftwareReporter.PromptUsage", value, SRT_PROMPT_MAX);
} }
} // namespace } // namespace
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment