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 | |
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
-rw-r--r-- | chrome/app/generated_resources.grd | 2 | ||||
-rw-r--r-- | chrome/browser/views/about_chrome_view.cc | 43 | ||||
-rw-r--r-- | chrome/browser/views/about_chrome_view.h | 8 |
3 files changed, 39 insertions, 14 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index a5ed6e5..84517f7 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -1507,7 +1507,7 @@ each locale. --> Developer Build </message> <message name="IDS_ABOUT_VERSION_LICENSE" desc="The line that shows the license text (what appears in front of the URL)"> - Portions of this software were licensed from third parties as described at: <ph name="URL">$1<ex>http://www.google.com/LICENSE</ex></ph> + Portions of this software were licensed from third parties as described at: </message> <!-- Javascript Dialog Box strings --> 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, diff --git a/chrome/browser/views/about_chrome_view.h b/chrome/browser/views/about_chrome_view.h index 7ef9608..1cfd949 100644 --- a/chrome/browser/views/about_chrome_view.h +++ b/chrome/browser/views/about_chrome_view.h @@ -9,6 +9,7 @@ #include "chrome/views/dialog_delegate.h" #include "chrome/views/image_view.h" #include "chrome/views/label.h" +#include "chrome/views/link.h" #include "chrome/views/view.h" namespace ChromeViews { @@ -28,6 +29,7 @@ class Profile; //////////////////////////////////////////////////////////////////////////////// class AboutChromeView : public ChromeViews::View, public ChromeViews::DialogDelegate, + public ChromeViews::LinkController, public GoogleUpdateStatusListener { public: explicit AboutChromeView(Profile* profile); @@ -57,6 +59,9 @@ class AboutChromeView : public ChromeViews::View, virtual bool Accept(); virtual ChromeViews::View* GetContentsView(); + // Overridden from ChromeViews::LinkController: + virtual void LinkActivated(ChromeViews::Link* source, int event_flags); + // Overridden from GoogleUpdateStatusListener: virtual void OnReportResults(GoogleUpdateUpgradeResult result, GoogleUpdateErrorCode error_code, @@ -80,7 +85,8 @@ class AboutChromeView : public ChromeViews::View, ChromeViews::ImageView* about_dlg_background_; ChromeViews::Label* about_title_label_; ChromeViews::TextField* version_label_; - ChromeViews::TextField* main_text_label_; + ChromeViews::Label* main_text_label_; + ChromeViews::Link* copyright_url_; // UI elements we add to the parent view. scoped_ptr<ChromeViews::Throbber> throbber_; ChromeViews::ImageView success_indicator_; |