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

Unified Diff: chrome/browser/ui/views/sad_tab_view.cc

Issue 8574074: Add reload button. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Replace conditional returns with DCHECKS. Formatting tweaks. Created 9 years, 1 month 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 | « chrome/browser/ui/views/sad_tab_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 17a55a502854088c295fc91c1e2b4ba68d57d126..40e440a2a09ff7954137395aa06a4ac091e25380 100644
--- a/chrome/browser/ui/views/sad_tab_view.cc
+++ b/chrome/browser/ui/views/sad_tab_view.cc
@@ -18,6 +18,7 @@
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/font.h"
#include "ui/views/layout/grid_layout.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,19 @@ 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_) {
+ DCHECK(tab_contents_);
+ 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);
- } 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 +81,13 @@ void SadTabView::LinkClicked(views::Link* source, int event_flags) {
}
}
+void SadTabView::ButtonPressed(views::Button* source,
+ const views::Event& event) {
+ DCHECK(tab_contents_);
+ DCHECK(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 +129,14 @@ void SadTabView::ViewHierarchyChanged(bool is_add,
layout->AddView(message_);
if (tab_contents_) {
+ layout->StartRowWithPadding(0, column_set_id, 0, kPadding);
+ reload_button_ = new views::TextButton(
+ this,
+ l10n_util::GetStringUTF16(IDS_SAD_TAB_RELOAD_LABEL));
+ reload_button_->set_border(new views::TextButtonNativeThemeBorder(
+ reload_button_));
+ layout->AddView(reload_button_);
+
help_link_ = CreateLink(l10n_util::GetStringUTF16(
(kind_ == CRASHED) ? IDS_SAD_TAB_HELP_LINK : IDS_LEARN_MORE));
@@ -177,3 +198,5 @@ views::Link* SadTabView::CreateLink(const string16& text) {
link->set_listener(this);
return link;
}
+
+
« no previous file with comments | « chrome/browser/ui/views/sad_tab_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698