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

Unified Diff: chrome/browser/ui/sad_tab.cc

Issue 2885143009: Show feedback button on sad tab if sad tab has shown recently. (Closed)
Patch Set: Created 3 years, 7 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/sad_tab.cc
diff --git a/chrome/browser/ui/sad_tab.cc b/chrome/browser/ui/sad_tab.cc
index b08a44ad1c857bc3ccaded2d095ea13fea618414..b3babe77793fe34c89c065f7754f00de31ea0cd1 100644
--- a/chrome/browser/ui/sad_tab.cc
+++ b/chrome/browser/ui/sad_tab.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/ui/sad_tab.h"
#include "base/metrics/histogram_macros.h"
+#include "base/time/time.h"
#include "chrome/browser/net/referrer.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/chrome_pages.h"
@@ -59,10 +60,15 @@ constexpr char kCategoryTagCrash[] = "Crash";
bool ShouldShowFeedbackButton() {
#if defined(GOOGLE_CHROME_BUILD)
- const int kCrashesBeforeFeedbackIsDisplayed = 1;
+ const int kMinSecondsBetweenCrashesForFeedbackButton = 10;
- static int total_crashes = 0;
- return ++total_crashes > kCrashesBeforeFeedbackIsDisplayed;
+ static base::TimeTicks last_called = base::TimeTicks::UnixEpoch();
Will Harris 2017/05/18 00:58:08 static initalizer for this class is allowed?
sky 2017/05/18 16:37:58 Not sure on that, Nico likely knows.
Nico 2017/05/18 16:54:58 This is a function level static. Despite the simil
Will Harris 2017/05/18 22:59:47 Acknowledged. Changed to store the int64_t static
+
+ bool should_show = (base::TimeTicks().Now() - last_called).InSeconds() <
+ kMinSecondsBetweenCrashesForFeedbackButton;
+
+ last_called = base::TimeTicks().Now();
+ return should_show;
#else
return false;
#endif
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698