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 |