summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views
diff options
context:
space:
mode:
authormirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-24 22:36:49 +0000
committermirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-24 22:36:49 +0000
commit7a3db3e89031b54abe5109a1151a643a3dee4db5 (patch)
tree64b0a6212c30bf068f515cba615044d99156e3d1 /chrome/browser/views
parent08c4d78142363907a813876b33d39b8d8bb06441 (diff)
downloadchromium_src-7a3db3e89031b54abe5109a1151a643a3dee4db5.zip
chromium_src-7a3db3e89031b54abe5109a1151a643a3dee4db5.tar.gz
chromium_src-7a3db3e89031b54abe5109a1151a643a3dee4db5.tar.bz2
Change search engine dialog image to be transparent, and use this image flipped as the RTL dialog top.
BUG=none TEST=search engine dialog looks fine in LTR and RTL modes Review URL: http://codereview.chromium.org/3171028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57248 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views')
-rw-r--r--chrome/browser/views/first_run_search_engine_view.cc23
-rw-r--r--chrome/browser/views/first_run_search_engine_view.h3
2 files changed, 19 insertions, 7 deletions
diff --git a/chrome/browser/views/first_run_search_engine_view.cc b/chrome/browser/views/first_run_search_engine_view.cc
index 30947db..6fb8081 100644
--- a/chrome/browser/views/first_run_search_engine_view.cc
+++ b/chrome/browser/views/first_run_search_engine_view.cc
@@ -15,6 +15,7 @@
#include "chrome/browser/profile.h"
#include "chrome/browser/search_engines/template_url.h"
#include "chrome/browser/search_engines/template_url_prepopulate_data.h"
+#include "gfx/canvas.h"
#include "gfx/font.h"
#include "grit/browser_resources.h"
#include "grit/chromium_strings.h"
@@ -142,6 +143,16 @@ void FirstRunSearchEngineView::ButtonPressed(views::Button* sender,
MessageLoop::current()->Quit();
}
+void FirstRunSearchEngineView::Paint(gfx::Canvas* canvas) {
+ // Fill in behind the background image with the standard gray toolbar color.
+ canvas->FillRectInt(SkColorSetRGB(237, 238, 237), 0, 0, width(),
+ background_image_->height());
+ // The rest of the dialog background should be white.
+ DCHECK(height() > background_image_->height());
+ canvas->FillRectInt(SK_ColorWHITE, 0, background_image_->height(), width(),
+ height() - background_image_->height());
+}
+
void FirstRunSearchEngineView::OnTemplateURLModelChanged() {
using views::ImageView;
@@ -244,20 +255,18 @@ void FirstRunSearchEngineView::SetupControls() {
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
background_image_ = new views::ImageView();
+ background_image_->SetImage(rb.GetBitmapNamed(IDR_SEARCH_ENGINE_DIALOG_TOP));
+ background_image_->EnableCanvasFlippingForRTLUI(true);
if (text_direction_is_rtl_) {
- background_image_->SetImage(rb.GetBitmapNamed(
- IDR_SEARCH_ENGINE_DIALOG_TOP_RTL));
+ background_image_->SetHorizontalAlignment(ImageView::LEADING);
} else {
- background_image_->SetImage(rb.GetBitmapNamed(
- IDR_SEARCH_ENGINE_DIALOG_TOP));
+ background_image_->SetHorizontalAlignment(ImageView::TRAILING);
}
- background_image_->SetHorizontalAlignment(ImageView::TRAILING);
+
AddChildView(background_image_);
int label_width = GetPreferredSize().width() - 2 * kPanelHorizMargin;
- set_background(Background::CreateSolidBackground(SK_ColorWHITE));
-
// Add title and text asking the user to choose a search engine:
title_label_ = new Label(l10n_util::GetString(
IDS_FR_SEARCH_MAIN_LABEL));
diff --git a/chrome/browser/views/first_run_search_engine_view.h b/chrome/browser/views/first_run_search_engine_view.h
index 725de1b..72adc51 100644
--- a/chrome/browser/views/first_run_search_engine_view.h
+++ b/chrome/browser/views/first_run_search_engine_view.h
@@ -103,6 +103,9 @@ class FirstRunSearchEngineView
// Overridden from views::ButtonListener:
virtual void ButtonPressed(views::Button* sender, const views::Event& event);
+ // Override from View so we can draw the gray background at dialog top.
+ virtual void Paint(gfx::Canvas* canvas);
+
// Overridden from TemplateURLModelObserver. When the search engines have
// loaded from the profile, we can populate the logos in the dialog box
// to present to the user.