diff options
author | seanparent@google.com <seanparent@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-09 21:30:40 +0000 |
---|---|---|
committer | seanparent@google.com <seanparent@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-09 21:30:40 +0000 |
commit | 51e18a108cb9556644975c9e980bb6cd824c9f93 (patch) | |
tree | 0f15664b25cd2f11619a848bb93a4699c8c7c744 | |
parent | 9aeaf7d69326ebfd4f1942db10eff113cb01fc7c (diff) | |
download | chromium_src-51e18a108cb9556644975c9e980bb6cd824c9f93.zip chromium_src-51e18a108cb9556644975c9e980bb6cd824c9f93.tar.gz chromium_src-51e18a108cb9556644975c9e980bb6cd824c9f93.tar.bz2 |
Cleanup of about box
Removed redundent version from update string.
Added a line break to the ChromeOS version on test builds to improve appearence
(select and drag to see complete version).
Added margins to multiline edit fields without borders to make them match
single line edit fields in positioning.
Fixed an issue with setting the initial focus for GTK based windows. This
fixes the problem of the cursor showing up in the version field.
BUG=chromium-os:3571 1589 2967
TEST=none
Review URL: http://codereview.chromium.org/2620003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49322 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/app/generated_resources.grd | 7 | ||||
-rw-r--r-- | chrome/browser/views/about_chrome_view.cc | 24 | ||||
-rw-r--r-- | chrome/browser/views/about_chrome_view.h | 1 | ||||
-rw-r--r-- | views/controls/textfield/native_textfield_gtk.cc | 7 | ||||
-rw-r--r-- | views/window/window_gtk.cc | 7 | ||||
-rw-r--r-- | views/window/window_gtk.h | 1 |
6 files changed, 45 insertions, 2 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index b8618b9..7ce3454 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -4583,9 +4583,16 @@ Keep your key file in a safe place. You will need it to create new versions of y <message name="IDS_UPGRADE_SUCCESSFUL_NOVERSION" desc="Status label: Successfully upgraded"> <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> has been updated </message> + <if expr="pp_ifdef('chromeos')"> + <message name="IDS_UPGRADE_ALREADY_UP_TO_DATE" desc="Status label: Already up to date"> + <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> is up to date + </message> + </if> + <if expr="not pp_ifdef('chromeos')"> <message name="IDS_UPGRADE_ALREADY_UP_TO_DATE" desc="Status label: Already up to date"> <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> is up to date (<ph name="VERSION">$2<ex>0.1.131</ex></ph>) </message> + </if> <message name="IDS_UPGRADE_ERROR" desc="Status label: Error occurred during upgrade"> Update server not available (error: <ph name="ERROR_NUMBER">$1<ex>1</ex></ph>) </message> diff --git a/chrome/browser/views/about_chrome_view.cc b/chrome/browser/views/about_chrome_view.cc index 3fb92de..bff959a 100644 --- a/chrome/browser/views/about_chrome_view.cc +++ b/chrome/browser/views/about_chrome_view.cc @@ -208,7 +208,7 @@ void AboutChromeView::Init() { AddChildView(version_label_); #if defined(OS_CHROMEOS) - os_version_label_ = new views::Textfield(); + os_version_label_ = new views::Textfield(views::Textfield::STYLE_MULTILINE); os_version_label_->SetReadOnly(true); os_version_label_->RemoveBorder(); os_version_label_->SetTextColor(SK_ColorBLACK); @@ -587,6 +587,14 @@ bool AboutChromeView::IsDialogButtonVisible( return true; } +// (on ChromeOS) the default focus is ending up in the version field when +// the update button is hidden. This forces the focus to always be on the +// OK button (which is the dialog cancel button, see GetDialogButtonLabel +// above). +int AboutChromeView::GetDefaultDialogButton() const { + return MessageBoxFlags::DIALOGBUTTON_CANCEL; +} + bool AboutChromeView::CanResize() const { return false; } @@ -655,6 +663,14 @@ void AboutChromeView::LinkActivated(views::Link* source, void AboutChromeView::OnOSVersion( chromeos::VersionLoader::Handle handle, std::string version) { + + // This is a hack to "wrap" the very long Test Build version after + // the version number, the remaining text won't be visible but can + // be selected, copied, pasted. + std::string::size_type pos = version.find(" (Test Build"); + if (pos != std::string::npos) + version.replace(pos, 1, "\n"); + os_version_label_->SetText(UTF8ToUTF16(version)); } #endif @@ -734,10 +750,16 @@ void AboutChromeView::UpdateStatus(GoogleUpdateUpgradeResult result, UserMetrics::RecordAction( UserMetricsAction("UpgradeCheck_AlreadyUpToDate"), profile_); check_button_status_ = CHECKBUTTON_HIDDEN; +#if defined(OS_CHROMEOS) + std::wstring update_label_text = + l10n_util::GetStringF(IDS_UPGRADE_ALREADY_UP_TO_DATE, + l10n_util::GetString(IDS_PRODUCT_NAME)); +#else std::wstring update_label_text = l10n_util::GetStringF(IDS_UPGRADE_ALREADY_UP_TO_DATE, l10n_util::GetString(IDS_PRODUCT_NAME), current_version_); +#endif if (base::i18n::IsRTL()) { update_label_text.push_back( static_cast<wchar_t>(base::i18n::kLeftToRightMark)); diff --git a/chrome/browser/views/about_chrome_view.h b/chrome/browser/views/about_chrome_view.h index 56decd3..ebfa73b 100644 --- a/chrome/browser/views/about_chrome_view.h +++ b/chrome/browser/views/about_chrome_view.h @@ -63,6 +63,7 @@ class AboutChromeView : public views::View, MessageBoxFlags::DialogButton button) const; virtual bool IsDialogButtonVisible( MessageBoxFlags::DialogButton button) const; + virtual int GetDefaultDialogButton() const; virtual bool CanResize() const; virtual bool CanMaximize() const; virtual bool IsAlwaysOnTop() const; diff --git a/views/controls/textfield/native_textfield_gtk.cc b/views/controls/textfield/native_textfield_gtk.cc index f2f74a9..5da4b78 100644 --- a/views/controls/textfield/native_textfield_gtk.cc +++ b/views/controls/textfield/native_textfield_gtk.cc @@ -184,8 +184,13 @@ void NativeTextfieldGtk::UpdateBorder() { return; if (textfield_->IsMultiLine()) { - if (!textfield_->draw_border()) + if (!textfield_->draw_border()) { gtk_container_set_border_width(GTK_CONTAINER(native_view()), 0); + + // Use margin to match entry with no border + SetHorizontalMargins(kTextViewBorderWidth / 2 + 1, + kTextViewBorderWidth / 2 + 1); + } } else { if (!textfield_->draw_border()) gtk_entry_set_has_frame(GTK_ENTRY(native_view()), false); diff --git a/views/window/window_gtk.cc b/views/window/window_gtk.cc index 8a3e7b9..16d3148 100644 --- a/views/window/window_gtk.cc +++ b/views/window/window_gtk.cc @@ -366,6 +366,13 @@ gboolean WindowGtk::OnLeaveNotify(GtkWidget* widget, GdkEventCrossing* event) { return WidgetGtk::OnLeaveNotify(widget, event); } +void WindowGtk::SetInitialFocus() { + View* v = window_delegate_->GetInitiallyFocusedView(); + if (v) { + v->RequestFocus(); + } +} + // static WindowGtk* WindowGtk::GetWindowForNative(GtkWidget* widget) { gpointer user_data = g_object_get_data(G_OBJECT(widget), "chrome-window"); diff --git a/views/window/window_gtk.h b/views/window/window_gtk.h index fffa6cb..358116e 100644 --- a/views/window/window_gtk.h +++ b/views/window/window_gtk.h @@ -68,6 +68,7 @@ class WindowGtk : public WidgetGtk, public Window { virtual gboolean OnWindowStateEvent(GtkWidget* widget, GdkEventWindowState* event); virtual gboolean OnLeaveNotify(GtkWidget* widget, GdkEventCrossing* event); + virtual void SetInitialFocus(); // Gets the WindowGtk in the userdata section of the widget. static WindowGtk* GetWindowForNative(GtkWidget* widget); |