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

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: make int64_t static 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..d510d3591ae8c593c0a6f6a3662b0abb34f8d477 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,19 @@ 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 int64_t last_called_ts = 0;
+ base::TimeTicks last_called(base::TimeTicks::UnixEpoch());
+
+ if (last_called_ts)
+ last_called = base::TimeTicks::FromInternalValue(last_called_ts);
+
+ bool should_show = (base::TimeTicks().Now() - last_called).InSeconds() <
+ kMinSecondsBetweenCrashesForFeedbackButton;
+
+ last_called_ts = base::TimeTicks().Now().ToInternalValue();
+ 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