Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(842)

Unified Diff: chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc

Issue 10384007: First stab at touch optimized omnibox auto-complete per sgabriel's mocks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments. Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc
diff --git a/chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc b/chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc
index 04fd0983e5a4f744d1ddbe6b6421615776873458..e8f58140ec17e2dff76ba8d224f4dc3b8f5946df 100644
--- a/chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc
+++ b/chrome/browser/ui/views/location_bar/icon_label_bubble_view.cc
@@ -12,12 +12,23 @@
#include "ui/views/controls/image_view.h"
#include "ui/views/controls/label.h"
+namespace {
+
// Amount of padding at the edges of the bubble.
-static const int kBubbleOuterPadding = LocationBarView::kEdgeItemPadding -
- LocationBarView::kBubbleHorizontalPadding;
+//
+// This can't be statically initialized because
+// LocationBarView::GetEdgeItemPadding() depends on whether we are
+// using desktop or touch layout, and this in turn depends on the
+// command line.
+int GetBubbleOuterPadding() {
+ return LocationBarView::GetEdgeItemPadding() -
+ LocationBarView::kBubbleHorizontalPadding;
+}
// Amount of padding after the label.
-static const int kLabelPadding = 5;
+const int kLabelPadding = 5;
+
+} // namespace
IconLabelBubbleView::IconLabelBubbleView(const int background_images[],
int contained_image,
@@ -61,7 +72,7 @@ gfx::Size IconLabelBubbleView::GetPreferredSize() {
}
void IconLabelBubbleView::Layout() {
- image_->SetBounds(kBubbleOuterPadding +
+ image_->SetBounds(GetBubbleOuterPadding() +
(is_extension_icon_ ? LocationBarView::kIconInternalPadding : 0), 0,
image_->GetPreferredSize().width(), height());
const int label_height = label_->GetPreferredSize().height();
@@ -79,10 +90,11 @@ gfx::Size IconLabelBubbleView::GetNonLabelSize() const {
int IconLabelBubbleView::GetPreLabelWidth() const {
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
- return kBubbleOuterPadding + rb.GetBitmapNamed(IDR_OMNIBOX_SEARCH)->width() +
- LocationBarView::kItemPadding;
+ return GetBubbleOuterPadding() +
+ rb.GetBitmapNamed(IDR_OMNIBOX_SEARCH)->width() +
+ LocationBarView::GetItemPadding();
}
int IconLabelBubbleView::GetNonLabelWidth() const {
- return GetPreLabelWidth() + kBubbleOuterPadding;
+ return GetPreLabelWidth() + GetBubbleOuterPadding();
}

Powered by Google App Engine
This is Rietveld 408576698