Chromium Code Reviews| Index: chrome/browser/ui/views/sad_tab_view.cc |
| diff --git a/chrome/browser/ui/views/sad_tab_view.cc b/chrome/browser/ui/views/sad_tab_view.cc |
| index 2c006e67a9725973f7edf1343cc3047ee6b7f002..24e1f025d6cfea4b4a80e6c68002769814b2a472 100644 |
| --- a/chrome/browser/ui/views/sad_tab_view.cc |
| +++ b/chrome/browser/ui/views/sad_tab_view.cc |
| @@ -17,6 +17,7 @@ |
| #include "ui/base/l10n/l10n_util.h" |
| #include "ui/base/resource/resource_bundle.h" |
| #include "ui/gfx/font.h" |
| +#include "views/controls/button/text_button.h" |
| #include "views/controls/image_view.h" |
| #include "views/controls/label.h" |
| #include "views/controls/link.h" |
| @@ -60,14 +61,20 @@ SadTabView::SadTabView(TabContents* tab_contents, Kind kind) |
| SadTabView::~SadTabView() {} |
| void SadTabView::LinkClicked(views::Link* source, int event_flags) { |
| - if (tab_contents_ != NULL && source == help_link_) { |
| + if (tab_contents_ == NULL) |
|
Peter Kasting
2011/11/21 21:31:06
Honestly, can we ever create a SadTabView() with a
kevers
2011/11/22 13:52:02
Done.
|
| + return; |
| + if (source == help_link_) { |
| GURL help_url = |
| google_util::AppendGoogleLocaleParam(GURL(kind_ == CRASHED ? |
| chrome::kCrashReasonURL : |
| chrome::kKillReasonURL)); |
| - tab_contents_->OpenURL( |
| - help_url, GURL(), CURRENT_TAB, content::PAGE_TRANSITION_LINK); |
|
kevers
2011/11/21 17:42:49
This version of OpenURL has been deprecated. Sinc
|
| - } else if (tab_contents_ != NULL && source == feedback_link_) { |
| + tab_contents_->OpenURL(OpenURLParams( |
| + help_url, |
| + GURL(), |
| + CURRENT_TAB, |
| + content::PAGE_TRANSITION_LINK, |
| + false /* is renderer initiated */)); |
| + } else if (source == feedback_link_) { |
| browser::ShowHtmlBugReportView( |
| Browser::GetBrowserForController(&tab_contents_->controller(), NULL), |
| l10n_util::GetStringUTF8(IDS_KILLED_TAB_FEEDBACK_MESSAGE), |
| @@ -75,6 +82,15 @@ void SadTabView::LinkClicked(views::Link* source, int event_flags) { |
| } |
| } |
| +void SadTabView::ButtonPressed( |
| + views::Button* source, |
|
Peter Kasting
2011/11/21 21:31:06
Nit: Move to previous line, align next arg
kevers
2011/11/22 13:52:02
Done.
|
| + const views::Event& event) { |
| + if (tab_contents_ == NULL) |
|
Peter Kasting
2011/11/21 21:31:06
Nit: We only add the reload button if |tab_content
kevers
2011/11/22 13:52:02
Done.
|
| + return; |
| + if (source == reload_button_) |
| + tab_contents_->controller().Reload(true); |
| +} |
| + |
| void SadTabView::Layout() { |
| // Specify the maximum message width explicitly. |
| message_->SizeToFit(static_cast<int>(width() * kMessageSize)); |
| @@ -116,6 +132,11 @@ void SadTabView::ViewHierarchyChanged(bool is_add, |
| layout->AddView(message_); |
| if (tab_contents_) { |
| + layout->StartRowWithPadding(0, column_set_id, 0, kPadding); |
| + reload_button_ = CreateButton( |
|
Peter Kasting
2011/11/21 21:31:06
Nit: Since this function is only called once, inli
kevers
2011/11/22 13:52:02
Done.
|
| + l10n_util::GetStringUTF16(IDS_SAD_TAB_RELOAD_LABEL)); |
| + layout->AddView(reload_button_); |
| + |
| help_link_ = CreateLink(l10n_util::GetStringUTF16( |
| (kind_ == CRASHED) ? IDS_SAD_TAB_HELP_LINK : IDS_LEARN_MORE)); |
| @@ -177,3 +198,10 @@ views::Link* SadTabView::CreateLink(const string16& text) { |
| link->set_listener(this); |
| return link; |
| } |
| + |
| +views::TextButton* SadTabView::CreateButton(const string16& text) { |
| + views::TextButton* button = new views::TextButton(this, text); |
| + button->set_border(new views::TextButtonNativeThemeBorder(button)); |
| + return button; |
| +} |
| + |