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

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

Issue 2794763002: New Sad Tab strings. (Closed)
Patch Set: add bullets Created 3 years, 9 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
Index: chrome/browser/ui/sad_tab.cc
diff --git a/chrome/browser/ui/sad_tab.cc b/chrome/browser/ui/sad_tab.cc
index 5c88b0cce6c8b5404117a9dfec25bbe1edf65efd..e9ad60fb7860e0cb7efa66e6c2130ded2ff01f37 100644
--- a/chrome/browser/ui/sad_tab.cc
+++ b/chrome/browser/ui/sad_tab.cc
@@ -95,7 +95,19 @@ bool SadTab::ShouldShow(base::TerminationStatus status) {
}
int SadTab::GetTitle() {
- return IDS_SAD_TAB_TITLE;
+ if (!show_feedback_button_)
+ return IDS_SAD_TAB_TITLE;
+ switch (kind_) {
+#if defined(OS_CHROMEOS)
+ case chrome::SAD_TAB_KIND_KILLED_BY_OOM:
+ return IDS_SAD_TAB_RELOAD_TITLE;
+#endif
+ case chrome::SAD_TAB_KIND_OOM:
+ return IDS_SAD_TAB_OOM_TITLE;
+ case chrome::SAD_TAB_KIND_CRASHED:
+ case chrome::SAD_TAB_KIND_KILLED:
+ return IDS_SAD_TAB_RELOAD_TITLE;
+ }
}
int SadTab::GetMessage() {
@@ -105,10 +117,15 @@ int SadTab::GetMessage() {
return IDS_KILLED_TAB_BY_OOM_MESSAGE;
#endif
case chrome::SAD_TAB_KIND_OOM:
- return IDS_SAD_TAB_OOM_MESSAGE;
+ if (show_feedback_button_)
+ return other_tabs_open_ ? IDS_SAD_TAB_OOM_MESSAGE_TABS
+ : IDS_SAD_TAB_OOM_MESSAGE_NOTABS;
+ else
+ return IDS_SAD_TAB_MESSAGE;
case chrome::SAD_TAB_KIND_CRASHED:
case chrome::SAD_TAB_KIND_KILLED:
- return IDS_SAD_TAB_MESSAGE;
+ return show_feedback_button_ ? IDS_SAD_TAB_RELOAD_TRY
+ : IDS_SAD_TAB_MESSAGE;
}
NOTREACHED();
return 0;
@@ -128,6 +145,39 @@ const char* SadTab::GetHelpLinkURL() {
: chrome::kCrashReasonURL;
}
+int SadTab::GetBulletText(size_t bullet_id) {
+ // Note: on macOS, Linux and ChromeOS, the first bullet is either one of
+ // IDS_SAD_TAB_RELOAD_CLOSE_TABS or IDS_SAD_TAB_RELOAD_CLOSE_NOTABS followed
+ // by one of these suggestions.
+ const int kBulletIds[] = {IDS_SAD_TAB_RELOAD_INCOGNITO,
+ IDS_SAD_TAB_RELOAD_RESTART_BROWSER,
+ IDS_SAD_TAB_RELOAD_RESTART_DEVICE};
+
+ if (!show_feedback_button_)
+ return 0;
+ switch (kind_) {
+#if defined(OS_CHROMEOS)
+ case chrome::SAD_TAB_KIND_KILLED_BY_OOM:
+ return 0;
+#endif
+ case chrome::SAD_TAB_KIND_OOM:
+ return 0;
+ case chrome::SAD_TAB_KIND_CRASHED:
+ case chrome::SAD_TAB_KIND_KILLED:
+#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_CHROMEOS)
+ if (bullet_id == 0)
+ return other_tabs_open_ ? IDS_SAD_TAB_RELOAD_CLOSE_TABS
+ : IDS_SAD_TAB_RELOAD_CLOSE_NOTABS;
+ bullet_id--;
+#endif
+ if (bullet_id > 2)
+ return 0;
+ return kBulletIds[bullet_id];
+ }
+ NOTREACHED();
+ return 0;
+}
+
void SadTab::RecordFirstPaint() {
DCHECK(!recorded_paint_);
recorded_paint_ = true;
@@ -183,7 +233,8 @@ SadTab::SadTab(content::WebContents* web_contents, SadTabKind kind)
: web_contents_(web_contents),
kind_(kind),
show_feedback_button_(ShouldShowFeedbackButton()),
- recorded_paint_(false) {
+ recorded_paint_(false),
+ other_tabs_open_(true) {
switch (kind) {
case chrome::SAD_TAB_KIND_CRASHED:
UMA_SAD_TAB_COUNTER("Tabs.SadTab.CrashCreated");

Powered by Google App Engine
This is Rietveld 408576698