summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsaintlou@chromium.org <saintlou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-26 17:47:29 +0000
committersaintlou@chromium.org <saintlou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-26 17:47:29 +0000
commitdfab948377a9867c515476081f38e89b1156d063 (patch)
tree4162048139decc1c73753a27f5e7109ecc902ce7
parent3a605e80b401878e493ba82c4d5b58b2c47b11db (diff)
downloadchromium_src-dfab948377a9867c515476081f38e89b1156d063.zip
chromium_src-dfab948377a9867c515476081f38e89b1156d063.tar.gz
chromium_src-dfab948377a9867c515476081f38e89b1156d063.tar.bz2
Use ImagePainter to draw the location bar border.
In this way the dimension of the location bar can be set flexibly. Center the location bar vertically and make it a little shorter in height for touch ui. BUG=NONE TEST=NONE Review URL: http://codereview.chromium.org/7912004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102752 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/app/theme/large_omnibox_c.pngbin92 -> 0 bytes
-rw-r--r--chrome/app/theme/large_omnibox_l.pngbin208 -> 0 bytes
-rw-r--r--chrome/app/theme/large_omnibox_r.pngbin214 -> 0 bytes
-rw-r--r--chrome/app/theme/theme_resources_large.grd7
-rw-r--r--chrome/app/theme/theme_resources_standard.grd1
-rw-r--r--chrome/browser/ui/views/location_bar/location_bar_view.cc21
-rw-r--r--chrome/browser/ui/views/location_bar/location_bar_view.h2
-rw-r--r--chrome/browser/ui/views/toolbar_view.cc18
8 files changed, 36 insertions, 13 deletions
diff --git a/chrome/app/theme/large_omnibox_c.png b/chrome/app/theme/large_omnibox_c.png
deleted file mode 100644
index e5e8e33..0000000
--- a/chrome/app/theme/large_omnibox_c.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/large_omnibox_l.png b/chrome/app/theme/large_omnibox_l.png
deleted file mode 100644
index a7f7c46..0000000
--- a/chrome/app/theme/large_omnibox_l.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/large_omnibox_r.png b/chrome/app/theme/large_omnibox_r.png
deleted file mode 100644
index 6be8fb2..0000000
--- a/chrome/app/theme/large_omnibox_r.png
+++ /dev/null
Binary files differ
diff --git a/chrome/app/theme/theme_resources_large.grd b/chrome/app/theme/theme_resources_large.grd
index 3fa643f..a43d946 100644
--- a/chrome/app/theme/theme_resources_large.grd
+++ b/chrome/app/theme/theme_resources_large.grd
@@ -79,9 +79,10 @@
<include name="IDR_INFOBAR_THEME" file="large_infobar_theme.png" type="BINDATA" />
<include name="IDR_INFOBAR_TRANSLATE" file="large_infobar_translate.png" type="BINDATA" />
<include name="IDR_KEYWORD_SEARCH_MAGNIFIER" file="large_keyword_search_magnifier.png" type="BINDATA" />
- <include name="IDR_LOCATIONBG_C" file="large_omnibox_c.png" type="BINDATA" />
- <include name="IDR_LOCATIONBG_L" file="large_omnibox_l.png" type="BINDATA" />
- <include name="IDR_LOCATIONBG_R" file="large_omnibox_r.png" type="BINDATA" />
+ <include name="IDR_LOCATIONBG_C" file="omnibox_c.png" type="BINDATA" />
+ <include name="IDR_LOCATIONBG_L" file="omnibox_l.png" type="BINDATA" />
+ <include name="IDR_LOCATIONBG_R" file="omnibox_r.png" type="BINDATA" />
+ <include name="IDR_LOCATION_BAR_BORDER" file="omnibox_border.png" type="BINDATA" />
<include name="IDR_LOCATION_BAR_SELECTED_KEYWORD_BACKGROUND_C" file="large_keyword_search_bubble_c.png" type="BINDATA" />
<include name="IDR_LOCATION_BAR_SELECTED_KEYWORD_BACKGROUND_L" file="large_keyword_search_bubble_l.png" type="BINDATA" />
<include name="IDR_LOCATION_BAR_SELECTED_KEYWORD_BACKGROUND_R" file="large_keyword_search_bubble_r.png" type="BINDATA" />
diff --git a/chrome/app/theme/theme_resources_standard.grd b/chrome/app/theme/theme_resources_standard.grd
index 7339824..876a461 100644
--- a/chrome/app/theme/theme_resources_standard.grd
+++ b/chrome/app/theme/theme_resources_standard.grd
@@ -85,6 +85,7 @@
<include name="IDR_LOCATIONBG_C" file="omnibox_c.png" type="BINDATA" />
<include name="IDR_LOCATIONBG_L" file="omnibox_l.png" type="BINDATA" />
<include name="IDR_LOCATIONBG_R" file="omnibox_r.png" type="BINDATA" />
+ <include name="IDR_LOCATION_BAR_BORDER" file="omnibox_border.png" type="BINDATA" />
<include name="IDR_LOCATION_BAR_SELECTED_KEYWORD_BACKGROUND_C" file="keyword_search_bubble_c.png" type="BINDATA" />
<include name="IDR_LOCATION_BAR_SELECTED_KEYWORD_BACKGROUND_L" file="keyword_search_bubble_l.png" type="BINDATA" />
<include name="IDR_LOCATION_BAR_SELECTED_KEYWORD_BACKGROUND_R" file="keyword_search_bubble_r.png" type="BINDATA" />
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc
index b8c71bb..b5b7d0b 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -51,6 +51,7 @@
#include "ui/base/theme_provider.h"
#include "ui/gfx/canvas_skia.h"
#include "ui/gfx/color_utils.h"
+#include "ui/gfx/image/image.h"
#include "ui/gfx/skia_util.h"
#include "views/bubble/bubble_border.h"
#include "views/controls/label.h"
@@ -99,11 +100,10 @@ static const int kSelectedKeywordBackgroundImages[] = {
IDR_LOCATION_BAR_SELECTED_KEYWORD_BACKGROUND_R,
};
-static const int kNormalModeBackgroundImages[] = {
- IDR_LOCATIONBG_L,
- IDR_LOCATIONBG_C,
- IDR_LOCATIONBG_R,
-};
+// Height of the location bar's round corner region.
+static const int kBorderRoundCornerHeight = 6;
+// Width of location bar's round corner region.
+static const int kBorderRoundCornerWidth = 5;
// LocationBarView -----------------------------------------------------------
@@ -133,8 +133,15 @@ LocationBarView::LocationBarView(Browser* browser,
set_id(VIEW_ID_LOCATION_BAR);
set_focusable(true);
- if (mode_ == NORMAL)
- painter_.reset(new views::HorizontalPainter(kNormalModeBackgroundImages));
+ if (mode_ == NORMAL) {
+ painter_.reset(
+ views::Painter::CreateImagePainter(
+ *ResourceBundle::GetSharedInstance().GetImageNamed(
+ IDR_LOCATION_BAR_BORDER).ToSkBitmap(),
+ gfx::Insets(kBorderRoundCornerHeight, kBorderRoundCornerWidth,
+ kBorderRoundCornerHeight, kBorderRoundCornerWidth),
+ true));
+ }
edit_bookmarks_enabled_.Init(prefs::kEditBookmarksEnabled,
browser_->profile()->GetPrefs(), this);
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.h b/chrome/browser/ui/views/location_bar/location_bar_view.h
index d249074..c555e64 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.h
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.h
@@ -365,7 +365,7 @@ class LocationBarView : public LocationBar,
gfx::Font font_;
// An object used to paint the normal-mode background.
- scoped_ptr<views::HorizontalPainter> painter_;
+ scoped_ptr<views::Painter> painter_;
// An icon to the left of the edit field.
LocationIconView* location_icon_view_;
diff --git a/chrome/browser/ui/views/toolbar_view.cc b/chrome/browser/ui/views/toolbar_view.cc
index a8300cf..1d87be7 100644
--- a/chrome/browser/ui/views/toolbar_view.cc
+++ b/chrome/browser/ui/views/toolbar_view.cc
@@ -78,6 +78,11 @@ static const int kPopupBottomSpacingGlass = 1;
// corner of the wrench menu).
static const int kBadgeTopMargin = 2;
+#if defined(TOUCH_UI)
+// Extra vertical padding above the location bar.
+static const int kExtraVerticalPadding = 3;
+#endif
+
static SkBitmap* kPopupBackgroundEdge = NULL;
////////////////////////////////////////////////////////////////////////////////
@@ -528,8 +533,17 @@ void ToolbarView::Layout() {
int available_width = width() - kEdgeSpacing - app_menu_width -
browser_actions_width - location_x;
- location_bar_->SetBounds(location_x, child_y, std::max(available_width, 0),
- child_height);
+#if defined(TOUCH_UI)
+ // Center the location bar vertically.
+ int location_y = std::min(child_y + kExtraVerticalPadding, height());
+ int location_bar_height = std::max(height() - 2 * location_y, 0);
+#else
+ int location_y = child_y;
+ int location_bar_height = child_height;
+#endif
+
+ location_bar_->SetBounds(location_x, location_y, std::max(available_width, 0),
+ location_bar_height);
browser_actions_->SetBounds(location_bar_->x() + location_bar_->width(), 0,
browser_actions_width, height());