summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorglen@google.com <glen@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-01 22:32:50 +0000
committerglen@google.com <glen@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-01 22:32:50 +0000
commit5e9c8899e1c3d26cbf82024ff24559882a588194 (patch)
tree8ecfd6f19b1eab662b98ddc5d87708ab11b33820 /chrome/browser
parentcd542e1a631294858a81b83bbe6a4c8deaacfa00 (diff)
downloadchromium_src-5e9c8899e1c3d26cbf82024ff24559882a588194.zip
chromium_src-5e9c8899e1c3d26cbf82024ff24559882a588194.tar.gz
chromium_src-5e9c8899e1c3d26cbf82024ff24559882a588194.tar.bz2
Let the logo display correctly on the History and Downloads pages in RTL. This really should be using our GridLayout, but GridLayout had trouble both handling our row-spanned images, and cropping the image correctly when the column got too small (it center-cropped it). In the interests of not adding complication for Beta, I just modified the existing code.
BUG=1304459 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@267 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/native_ui_contents.cc49
-rw-r--r--chrome/browser/native_ui_contents.h3
2 files changed, 35 insertions, 17 deletions
diff --git a/chrome/browser/native_ui_contents.cc b/chrome/browser/native_ui_contents.cc
index 977aae8..3988ae0 100644
--- a/chrome/browser/native_ui_contents.cc
+++ b/chrome/browser/native_ui_contents.cc
@@ -497,6 +497,16 @@ SearchableUIContainer::SearchableUIContainer(
title_image_ = new ChromeViews::ImageView();
title_image_->SetVisible(false);
+ // Get the product logo
+ if (!kProductLogo) {
+ kProductLogo = resource_bundle.GetBitmapNamed(IDR_PRODUCT_LOGO);
+ }
+
+ product_logo_ = new ChromeViews::ImageView();
+ product_logo_->SetVisible(true);
+ product_logo_->SetImage(*kProductLogo);
+ AddChildView(product_logo_);
+
search_field_ = new ChromeViews::TextField;
search_field_->SetFont(ResourceBundle::GetSharedInstance().GetFont(
ResourceBundle::WebFont));
@@ -510,11 +520,6 @@ SearchableUIContainer::SearchableUIContainer(
throbber_ = new ChromeViews::SmoothedThrobber(50);
- // Get the product logo
- if (!kProductLogo) {
- kProductLogo = resource_bundle.GetBitmapNamed(IDR_PRODUCT_LOGO);
- }
-
GridLayout* layout = new GridLayout(this);
// View owns the LayoutManager and will delete it along with all the columns
// we create here.
@@ -601,6 +606,28 @@ ChromeViews::View* SearchableUIContainer::GetContents() {
return scroll_view_->GetContents();
}
+void SearchableUIContainer::Layout() {
+ View::Layout();
+
+ CSize search_button_size;
+ search_button_->GetPreferredSize(&search_button_size);
+
+ CSize product_logo_size;
+ product_logo_->GetPreferredSize(&product_logo_size);
+
+ int field_width = kDestinationSearchOffset +
+ kDestinationSearchWidth +
+ kDestinationSmallerMargin +
+ static_cast<int>(search_button_size.cx) +
+ kDestinationSmallerMargin;
+
+ product_logo_->SetBounds(std::max(GetWidth() - kProductLogo->width() -
+ kProductLogoPadding,
+ field_width),
+ kProductLogoPadding,
+ product_logo_size.cx, product_logo_size.cy);
+}
+
void SearchableUIContainer::Paint(ChromeCanvas* canvas) {
SkColor top_color(kBackground);
canvas->FillRectInt(top_color, 0, 0,
@@ -611,18 +638,6 @@ void SearchableUIContainer::Paint(ChromeCanvas* canvas) {
canvas->FillRectInt(SkColorSetRGB(196, 196, 196),
0, scroll_view_->GetY() - 1, GetWidth(), 1);
-
- // Lay out the product logo.
- CSize search_button_size;
- search_button_->GetPreferredSize(&search_button_size);
-
- canvas->DrawBitmapInt(*kProductLogo,
- std::max(GetWidth() - kProductLogo->width() - kProductLogoPadding,
- kDestinationSearchOffset + kDestinationSearchWidth +
- kDestinationSmallerMargin +
- static_cast<int>(search_button_size.cx) +
- kDestinationSmallerMargin),
- kProductLogoPadding);
}
ChromeViews::TextField* SearchableUIContainer::GetSearchField() const {
diff --git a/chrome/browser/native_ui_contents.h b/chrome/browser/native_ui_contents.h
index 37b8596e..f933d69 100644
--- a/chrome/browser/native_ui_contents.h
+++ b/chrome/browser/native_ui_contents.h
@@ -267,6 +267,8 @@ class SearchableUIContainer : public ChromeViews::View,
void SetContents(ChromeViews::View* contents);
ChromeViews::View* GetContents();
+ virtual void Layout();
+
// Overriden to paint the container.
virtual void Paint(ChromeCanvas* canvas);
@@ -304,6 +306,7 @@ class SearchableUIContainer : public ChromeViews::View,
Delegate* delegate_;
ChromeViews::Link* title_link_;
ChromeViews::ImageView* title_image_;
+ ChromeViews::ImageView* product_logo_;
ChromeViews::TextField* search_field_;
ChromeViews::NativeButton* search_button_;
ChromeViews::ScrollView* scroll_view_;