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

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

Issue 2794763002: New Sad Tab strings. (Closed)
Patch Set: right number of spaces as per UI review 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
Index: chrome/browser/ui/sad_tab.cc
diff --git a/chrome/browser/ui/sad_tab.cc b/chrome/browser/ui/sad_tab.cc
index c9b3cc42b84f52312360d917de5b546a74228aac..ec3e4d5be23e133f5d30026668a68f4eea498c26 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
sky 2017/05/14 13:46:16 chromium style guide says no else after return.
Will Harris 2017/05/17 18:25:19 Done.
+ 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;
@@ -184,7 +234,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