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

Unified Diff: chrome/browser/ui/views/session_crashed_bubble_view.cc

Issue 341823005: Collects stats on how user interacts with the bubble. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add callk to super's virtual function Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/session_crashed_bubble_view.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/session_crashed_bubble_view.cc
diff --git a/chrome/browser/ui/views/session_crashed_bubble_view.cc b/chrome/browser/ui/views/session_crashed_bubble_view.cc
index 0b12796e6690b4ba948149c407898b7b0335b26b..58cc89e12362e7da1e6b00b9b91f15baa6bbd2a2 100644
--- a/chrome/browser/ui/views/session_crashed_bubble_view.cc
+++ b/chrome/browser/ui/views/session_crashed_bubble_view.cc
@@ -10,6 +10,7 @@
#include "base/bind_helpers.h"
#include "base/command_line.h"
#include "base/metrics/field_trial.h"
+#include "base/metrics/histogram.h"
#include "base/prefs/pref_service.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h"
@@ -65,6 +66,22 @@ const SkColor kTextColor = SkColorSetRGB(102, 102, 102);
const char kEnableBubbleUIFinchName[] = "EnableSessionCrashedBubbleUI";
const char kEnableBubbleUIGroupEnabled[] = "Enabled";
+enum SessionCrashedBubbleHistogramValue {
+ SESSION_CRASHED_BUBBLE_SHOWN,
+ SESSION_CRASHED_BUBBLE_ERROR,
+ SESSION_CRASHED_BUBBLE_RESTORED,
+ SESSION_CRASHED_BUBBLE_ALREADY_UMA_OPTIN,
+ SESSION_CRASHED_BUBBLE_UMA_OPTIN,
+ SESSION_CRASHED_BUBBLE_HELP,
+ SESSION_CRASHED_BUBBLE_IGNORED,
+ SESSION_CRASHED_BUBBLE_MAX,
+};
+
+void RecordBubbleHistogramValue(SessionCrashedBubbleHistogramValue value) {
+ UMA_HISTOGRAM_ENUMERATION(
+ "SessionCrashed.Bubble", value, SESSION_CRASHED_BUBBLE_MAX);
+}
+
// Whether or not the bubble UI should be used.
bool IsBubbleUIEnabled() {
const base::CommandLine& command_line = *CommandLine::ForCurrentProcess();
@@ -118,8 +135,8 @@ void SessionCrashedBubbleView::Show(Browser* browser) {
// Stats collection only applies to Google Chrome builds.
#if defined(GOOGLE_CHROME_BUILD)
- // Schedule a task to run ShouldOfferMetricsReporting() on FILE thread, since
- // GoogleUpdateSettings::GetCollectStatsConsent() does IO. Then, call
+ // Schedule a task to run GoogleUpdateSettings::GetCollectStatsConsent() on
+ // FILE thread, since it does IO. Then, call
// SessionCrashedBubbleView::ShowForReal with the result.
content::BrowserThread::PostTaskAndReplyWithResult(
content::BrowserThread::FILE,
@@ -142,28 +159,36 @@ void SessionCrashedBubbleView::ShowForReal(
bool offer_uma_optin = false;
#if defined(GOOGLE_CHROME_BUILD)
- if (!uma_opted_in_already)
+ if (uma_opted_in_already) {
+ RecordBubbleHistogramValue(SESSION_CRASHED_BUBBLE_ALREADY_UMA_OPTIN);
+ } else {
offer_uma_optin = g_browser_process->local_state()->FindPreference(
prefs::kMetricsReportingEnabled)->IsUserModifiable();
+ }
#endif // defined(GOOGLE_CHROME_BUILD)
Browser* browser = browser_observer->browser();
- if (!browser)
+ if (!browser) {
+ RecordBubbleHistogramValue(SESSION_CRASHED_BUBBLE_ERROR);
return;
+ }
views::View* anchor_view =
BrowserView::GetBrowserViewForBrowser(browser)->toolbar()->app_menu();
content::WebContents* web_contents =
browser->tab_strip_model()->GetActiveWebContents();
- if (!web_contents)
+ if (!web_contents) {
+ RecordBubbleHistogramValue(SESSION_CRASHED_BUBBLE_ERROR);
return;
+ }
SessionCrashedBubbleView* crash_bubble =
new SessionCrashedBubbleView(anchor_view, browser, web_contents,
offer_uma_optin);
views::BubbleDelegateView::CreateBubble(crash_bubble)->Show();
+ RecordBubbleHistogramValue(SESSION_CRASHED_BUBBLE_SHOWN);
}
SessionCrashedBubbleView::SessionCrashedBubbleView(
@@ -178,7 +203,8 @@ SessionCrashedBubbleView::SessionCrashedBubbleView(
restore_button_(NULL),
uma_option_(NULL),
offer_uma_optin_(offer_uma_optin),
- started_navigation_(false) {
+ started_navigation_(false),
+ restored_(false) {
set_close_on_deactivate(false);
registrar_.Add(
this,
@@ -208,6 +234,12 @@ bool SessionCrashedBubbleView::ShouldShowCloseButton() const {
return true;
}
+void SessionCrashedBubbleView::OnWidgetDestroying(views::Widget* widget) {
+ if (!restored_)
+ RecordBubbleHistogramValue(SESSION_CRASHED_BUBBLE_IGNORED);
+ BubbleDelegateView::OnWidgetDestroying(widget);
+}
+
void SessionCrashedBubbleView::Init() {
// Description text label.
views::Label* text_label = new views::Label(
@@ -327,6 +359,8 @@ void SessionCrashedBubbleView::ButtonPressed(views::Button* sender,
const ui::Event& event) {
DCHECK_EQ(sender, restore_button_);
RestorePreviousSession(sender);
+ RecordBubbleHistogramValue(SESSION_CRASHED_BUBBLE_RESTORED);
+ restored_ = true;
msw 2014/07/10 19:58:37 nit: you should probably record the histogram valu
yao 2014/07/10 20:19:12 Done.
}
void SessionCrashedBubbleView::StyledLabelLinkClicked(const gfx::Range& range,
@@ -337,6 +371,7 @@ void SessionCrashedBubbleView::StyledLabelLinkClicked(const gfx::Range& range,
NEW_FOREGROUND_TAB,
content::PAGE_TRANSITION_LINK,
false));
+ RecordBubbleHistogramValue(SESSION_CRASHED_BUBBLE_HELP);
}
void SessionCrashedBubbleView::DidStartNavigationToPendingEntry(
@@ -352,7 +387,7 @@ void SessionCrashedBubbleView::DidFinishLoad(
content::RenderViewHost* render_view_host) {
if (started_navigation_)
CloseBubble();
-}
+ }
msw 2014/07/10 19:58:37 nit: revert this (indent was correct).
yao 2014/07/10 20:19:12 Done.
void SessionCrashedBubbleView::WasShown() {
GetWidget()->Show();
@@ -387,6 +422,7 @@ void SessionCrashedBubbleView::RestorePreviousSession(views::Button* sender) {
OptionsUtil::ResolveMetricsReportingEnabled(true);
g_browser_process->local_state()->SetBoolean(
prefs::kMetricsReportingEnabled, true);
+ RecordBubbleHistogramValue(SESSION_CRASHED_BUBBLE_UMA_OPTIN);
}
CloseBubble();
}
« no previous file with comments | « chrome/browser/ui/views/session_crashed_bubble_view.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698