diff options
author | finnur@google.com <finnur@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-26 21:18:39 +0000 |
---|---|---|
committer | finnur@google.com <finnur@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-26 21:18:39 +0000 |
commit | 2b861aca51727686bca140800841a9bd29485a91 (patch) | |
tree | 0d420561b3232cde67fa8d022d85c48514d20b67 /chrome/browser/views/about_chrome_view.cc | |
parent | c2225ca2a30866397a5451447ad5f4f55a2fc512 (diff) | |
download | chromium_src-2b861aca51727686bca140800841a9bd29485a91.zip chromium_src-2b861aca51727686bca140800841a9bd29485a91.tar.gz chromium_src-2b861aca51727686bca140800841a9bd29485a91.tar.bz2 |
Make the link in the About box clickable (Issue 657)
The URL in the About box was added as a last minute string addition. I have now made it clickable. I also converted the TextField for the main label into a regular label, since there is no need to copy anything anylonger.
Review URL: http://codereview.chromium.org/5013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2643 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/about_chrome_view.cc')
-rw-r--r-- | chrome/browser/views/about_chrome_view.cc | 43 |
1 files changed, 31 insertions, 12 deletions
diff --git a/chrome/browser/views/about_chrome_view.cc b/chrome/browser/views/about_chrome_view.cc index da99ff9..df8f0b6 100644 --- a/chrome/browser/views/about_chrome_view.cc +++ b/chrome/browser/views/about_chrome_view.cc @@ -11,6 +11,7 @@ #include "base/win_util.h" #include "chrome/app/locales/locale_settings.h" #include "chrome/app/theme/theme_resources.h" +#include "chrome/browser/browser_list.h" #include "chrome/common/gfx/color_utils.h" #include "chrome/browser/user_metrics.h" #include "chrome/browser/views/restart_message_box.h" @@ -42,6 +43,7 @@ AboutChromeView::AboutChromeView(Profile* profile) about_title_label_(NULL), version_label_(NULL), main_text_label_(NULL), + copyright_url_(NULL), check_button_status_(CHECKBUTTON_HIDDEN) { DCHECK(profile); Init(); @@ -124,18 +126,18 @@ void AboutChromeView::Init() { std::wstring main_text = l10n_util::GetString(IDS_ABOUT_VERSION_COMPANY_NAME) + L"\n" + l10n_util::GetString(IDS_ABOUT_VERSION_COPYRIGHT) + L"\n" + - l10n_util::GetStringF(IDS_ABOUT_VERSION_LICENSE, - l10n_util::GetString(IDS_ABOUT_VERSION_LICENSE_URL)); - - main_text_label_ = - new ChromeViews::TextField(ChromeViews::TextField::STYLE_MULTILINE); - main_text_label_->SetText(main_text); - main_text_label_->SetReadOnly(true); - main_text_label_->RemoveBorder(); - // Background color for the main label TextField. - SkColor main_label_background = color_utils::GetSysSkColor(COLOR_3DFACE); - main_text_label_->SetBackgroundColor(main_label_background); + l10n_util::GetString(IDS_ABOUT_VERSION_LICENSE); + + main_text_label_ = new ChromeViews::Label(main_text); + main_text_label_->SetHorizontalAlignment(ChromeViews::Label::ALIGN_LEFT); + main_text_label_->SetMultiLine(true); AddChildView(main_text_label_); + + // The copyright URL portion of the main label. + copyright_url_ = new ChromeViews::Link( + l10n_util::GetString(IDS_ABOUT_VERSION_LICENSE_URL)); + AddChildView(copyright_url_); + copyright_url_->SetController(this); } //////////////////////////////////////////////////////////////////////////////// @@ -185,13 +187,20 @@ void AboutChromeView::Layout() { // width and remaining height, minus a little margin on each side. int y_pos = background_image_height + kPanelVertMargin; sz.cx = panel_size.cx - 2 * kPanelHorizMargin; - sz.cy = panel_size.cy - y_pos; + sz.cy = main_text_label_->GetHeightForWidth(sz.cx); // Draw the text right below the background image. main_text_label_->SetBounds(kPanelHorizMargin, y_pos, sz.cx, sz.cy); + // Position the URL right below the main label. + copyright_url_->GetPreferredSize(&sz); + copyright_url_->SetBounds(kPanelHorizMargin, + main_text_label_->y() + main_text_label_->height(), + sz.cx, + sz.cy); + // Get the y-coordinate of our parent so we can position the text left of the // buttons at the bottom. CRect parent_bounds; @@ -353,6 +362,16 @@ ChromeViews::View* AboutChromeView::GetContentsView() { } //////////////////////////////////////////////////////////////////////////////// +// AboutChromeView, ChromeViews::LinkController implementation: + +void AboutChromeView::LinkActivated(ChromeViews::Link* source, + int event_flags) { + DCHECK(source == copyright_url_); + Browser* browser = BrowserList::GetLastActive(); + browser->OpenURL(GURL(source->GetText()), NEW_WINDOW, PageTransition::LINK); +} + +//////////////////////////////////////////////////////////////////////////////// // AboutChromeView, GoogleUpdateStatusListener implementation: void AboutChromeView::OnReportResults(GoogleUpdateUpgradeResult result, |