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 27110432f2c7a7b1330f8f3c1ffa4af7e1a2a252..b5beaeb7d1f5c15c99d3b87547c8aa1a1debc6da 100644 |
--- a/chrome/browser/ui/views/session_crashed_bubble_view.cc |
+++ b/chrome/browser/ui/views/session_crashed_bubble_view.cc |
@@ -8,6 +8,8 @@ |
#include "base/bind.h" |
#include "base/bind_helpers.h" |
+#include "base/command_line.h" |
+#include "base/metrics/field_trial.h" |
#include "base/prefs/pref_service.h" |
#include "chrome/browser/browser_process.h" |
#include "chrome/browser/chrome_notification_types.h" |
@@ -20,6 +22,7 @@ |
#include "chrome/browser/ui/tabs/tab_strip_model.h" |
#include "chrome/browser/ui/views/frame/browser_view.h" |
#include "chrome/browser/ui/views/toolbar/toolbar_view.h" |
+#include "chrome/common/chrome_switches.h" |
#include "chrome/common/pref_names.h" |
#include "chrome/common/url_constants.h" |
#include "chrome/installer/util/google_update_settings.h" |
@@ -61,6 +64,10 @@ const int kMarginHeight = kMarginWidth; |
const SkColor kLightGrayBackgroundColor = 0xFFF0F0F0; |
const SkColor kWhiteBackgroundColor = 0xFFFFFFFF; |
+// The Finch study name and group name that enables session crashed bubble UI. |
+const char kEnableBubbleUIFinchName[] = "EnableSessionCrashedBubbleUI"; |
+const char kEnableBubbleUIGroupEnabled[] = "Enabled"; |
+ |
bool ShouldOfferMetricsReporting() { |
// Stats collection only applies to Google Chrome builds. |
#if defined(GOOGLE_CHROME_BUILD) |
@@ -417,6 +424,18 @@ void SessionCrashedBubbleView::CloseBubble() { |
} |
bool ShowSessionCrashedBubble(Browser* browser) { |
- SessionCrashedBubbleView::Show(browser); |
- return true; |
+ // If user disables the bubble UI explicitly, don't show it. If not, the |
+ // bubble UI can be enabled by Finch experiment or by flag. |
+ if (CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kDisableSessionCrashedBubble)) |
+ return false; |
+ const std::string group_name = base::FieldTrialList::FindFullName( |
+ kEnableBubbleUIFinchName); |
+ if (group_name == kEnableBubbleUIGroupEnabled || |
+ CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kEnableSessionCrashedBubble)) { |
+ SessionCrashedBubbleView::Show(browser); |
+ return true; |
+ } |
+ return false; |
Alexei Svitkine (slow)
2014/05/27 15:42:46
Please follow the pattern suggested on the "Best P
yao
2014/05/27 16:42:01
Done.
|
} |