summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views
diff options
context:
space:
mode:
authorjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-23 20:40:10 +0000
committerjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-23 20:40:10 +0000
commitc8865483c216fbcaede15c4cd45e369643c8639b (patch)
tree075c9828944f3dff7c6ac6e0475eb878eef1e31c /chrome/browser/views
parent351355117f4cb4ee805961920a7c9d2ad0ae944c (diff)
downloadchromium_src-c8865483c216fbcaede15c4cd45e369643c8639b.zip
chromium_src-c8865483c216fbcaede15c4cd45e369643c8639b.tar.gz
chromium_src-c8865483c216fbcaede15c4cd45e369643c8639b.tar.bz2
This CL adds an infobar instructing users they can do search directly from the location bar when they navigate to their default search engine.The infobar is dismissed and not shown again if the user does a search from the omnibox or dismiss the infobar.This is part of a UX experiment and is behind a switch.BUG=NoneTEST=Start Chrome with a fresh profile. Navigate to www.google.com. An info bar should be shown. Click the 'show me' button, the location bar should display a message explaining search can be made from it.
Review URL: http://codereview.chromium.org/159242 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21438 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views')
-rw-r--r--chrome/browser/views/infobars/infobars.cc44
1 files changed, 37 insertions, 7 deletions
diff --git a/chrome/browser/views/infobars/infobars.cc b/chrome/browser/views/infobars/infobars.cc
index 8c67150..c404d0e 100644
--- a/chrome/browser/views/infobars/infobars.cc
+++ b/chrome/browser/views/infobars/infobars.cc
@@ -30,8 +30,16 @@ static const int kIconLabelSpacing = 5;
static const int kButtonSpacing = 5;
static const int kWordSpacing = 2;
-static const SkColor kBackgroundColorTop = SkColorSetRGB(255, 242, 183);
-static const SkColor kBackgroundColorBottom = SkColorSetRGB(250, 230, 145);
+static const SkColor kInfoBackgroundColorTop = SkColorSetRGB(170, 214, 112);
+static const SkColor kInfoBackgroundColorBottom = SkColorSetRGB(146, 205, 114);
+
+static const SkColor kWarningBackgroundColorTop = SkColorSetRGB(255, 242, 183);
+static const SkColor kWarningBackgroundColorBottom =
+ SkColorSetRGB(250, 230, 145);
+
+static const SkColor kErrorBackgroundColorTop = kWarningBackgroundColorTop;
+static const SkColor kErrorBackgroundColorBottom =
+ kWarningBackgroundColorBottom;
static const int kSeparatorLineHeight = 1;
@@ -57,10 +65,29 @@ int OffsetY(views::View* parent, const gfx::Size prefsize) {
class InfoBarBackground : public views::Background {
public:
- InfoBarBackground() {
+ InfoBarBackground(InfoBarDelegate::Type infobar_type) {
+ SkColor top_color;
+ SkColor bottom_color;
+ switch (infobar_type) {
+ case InfoBarDelegate::INFO_TYPE:
+ top_color = kInfoBackgroundColorTop;
+ bottom_color = kInfoBackgroundColorBottom;
+ break;
+ case InfoBarDelegate::WARNING_TYPE:
+ top_color = kWarningBackgroundColorTop;
+ bottom_color = kWarningBackgroundColorBottom;
+ break;
+ case InfoBarDelegate::ERROR_TYPE:
+ top_color = kErrorBackgroundColorTop;
+ bottom_color = kErrorBackgroundColorBottom;
+ break;
+ default:
+ NOTREACHED();
+ break;
+ }
gradient_background_.reset(
- views::Background::CreateVerticalGradientBackground(
- kBackgroundColorTop, kBackgroundColorBottom));
+ views::Background::CreateVerticalGradientBackground(top_color,
+ bottom_color));
}
// Overridden from views::View:
@@ -90,7 +117,7 @@ InfoBar::InfoBar(InfoBarDelegate* delegate)
// We delete ourselves when we're removed from the view hierarchy.
SetParentOwned(false);
- set_background(new InfoBarBackground);
+ set_background(new InfoBarBackground(delegate->GetInfoBarType()));
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
close_button_->SetImage(views::CustomButton::BS_NORMAL,
@@ -172,8 +199,11 @@ void InfoBar::RemoveInfoBar() const {
// InfoBar, views::ButtonListener implementation: ------------------
void InfoBar::ButtonPressed(views::Button* sender) {
- if (sender == close_button_)
+ if (sender == close_button_) {
+ if (delegate_)
+ delegate_->InfoBarDismissed();
RemoveInfoBar();
+ }
}
// InfoBar, AnimationDelegate implementation: ----------------------------------