diff options
author | kuan@chromium.org <kuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-10 18:51:33 +0000 |
---|---|---|
committer | kuan@chromium.org <kuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-10 18:51:33 +0000 |
commit | 62cf690a77564be902cf481803a9a7e3d52f7c55 (patch) | |
tree | 3792385594c7eaf77294a7fae3dacaa3ada4c3d4 /chrome/browser/views/sad_tab_view.cc | |
parent | e3615577169f4e84cdf274493d876fea060020f9 (diff) | |
download | chromium_src-62cf690a77564be902cf481803a9a7e3d52f7c55.zip chromium_src-62cf690a77564be902cf481803a9a7e3d52f7c55.tar.gz chromium_src-62cf690a77564be902cf481803a9a7e3d52f7c55.tar.bz2 |
implement "Learn more" link in "Aw snap" page.
this changelist is only for windows.
BUG=21726
TEST=verify that "Learn More" link shows up centralized beneath crash message and when clicked, opens the url specified in bug.
Review URL: http://codereview.chromium.org/377016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31573 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/sad_tab_view.cc')
-rw-r--r-- | chrome/browser/views/sad_tab_view.cc | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/chrome/browser/views/sad_tab_view.cc b/chrome/browser/views/sad_tab_view.cc index 2c5ee30..da2c6fde 100644 --- a/chrome/browser/views/sad_tab_view.cc +++ b/chrome/browser/views/sad_tab_view.cc @@ -8,7 +8,9 @@ #include "app/l10n_util.h" #include "app/resource_bundle.h" #include "base/gfx/size.h" +#include "chrome/browser/browser_list.h" #include "grit/generated_resources.h" +#include "grit/locale_settings.h" #include "grit/theme_resources.h" #include "skia/ext/skia_utils.h" #include "third_party/skia/include/effects/SkGradientShader.h" @@ -31,8 +33,15 @@ std::wstring SadTabView::title_; std::wstring SadTabView::message_; int SadTabView::title_width_; -SadTabView::SadTabView() { +SadTabView::SadTabView() + : learn_more_link_(NULL) { InitClass(); + + learn_more_link_ = new views::Link(l10n_util::GetString(IDS_LEARN_MORE)); + learn_more_link_->SetFont(*message_font_); + learn_more_link_->MakeReadableOverBackgroundColor(kBackgroundColor); + learn_more_link_->SetController(this); + AddChildView(learn_more_link_); } void SadTabView::Paint(gfx::Canvas* canvas) { @@ -56,6 +65,9 @@ void SadTabView::Paint(gfx::Canvas* canvas) { message_bounds_.x(), message_bounds_.y(), message_bounds_.width(), message_bounds_.height(), gfx::Canvas::MULTI_LINE); + + learn_more_link_->SetBounds(link_bounds_.x(), link_bounds_.y(), + link_bounds_.width(), link_bounds_.height()); } void SadTabView::Layout() { @@ -78,6 +90,20 @@ void SadTabView::Layout() { int message_x = (width() - message_width) / 2; int message_y = title_bounds_.bottom() + kTitleMessageSpacing; message_bounds_.SetRect(message_x, message_y, message_width, message_height); + + gfx::Size sz = learn_more_link_->GetPreferredSize(); + gfx::Insets insets = learn_more_link_->GetInsets(); + link_bounds_.SetRect((width() - sz.width()) / 2, + message_bounds_.bottom() + kTitleMessageSpacing - + insets.top(), sz.width(), sz.height()); +} + +void SadTabView::LinkActivated(views::Link* source, int event_flags) { + if (source == learn_more_link_) { + Browser* browser = BrowserList::GetLastActive(); + browser->OpenURL(GURL(l10n_util::GetStringUTF16(IDS_CRASH_REASON_URL)), + GURL(), CURRENT_TAB, PageTransition::LINK); + } } // static |