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

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

Issue 1338103002: Create c/b/ui/views/layout_constants.*. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments Created 5 years, 3 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 45b646c7115d4f96341167c51967eaba23b51276..ed09f59f1616ebb12ab6dd6e5a0d9b8c75f9f557 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
@@ -5,9 +5,8 @@
#include "chrome/browser/ui/views/location_bar/icon_label_bubble_view.h"
#include "base/strings/utf_string_conversions.h"
-#include "chrome/browser/themes/theme_properties.h"
+#include "chrome/browser/ui/views/layout_constants.h"
#include "ui/base/resource/resource_bundle.h"
-#include "ui/base/theme_provider.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/color_utils.h"
#include "ui/views/controls/image_view.h"
@@ -105,12 +104,10 @@ void IconLabelBubbleView::Layout() {
image_->SetBounds(std::min((width() - image_width) / 2,
GetBubbleOuterPadding(!is_extension_icon_)),
0, image_->GetPreferredSize().width(), height());
- const int horizontal_item_padding = GetThemeProvider()->GetDisplayProperty(
- ThemeProperties::PROPERTY_LOCATION_BAR_HORIZONTAL_PADDING);
- int pre_label_width =
- GetBubbleOuterPadding(true) +
- (image_width ? (image_width + horizontal_item_padding) : 0);
+ const int padding = GetLayoutConstant(LOCATION_BAR_HORIZONTAL_PADDING);
+ int pre_label_width =
+ GetBubbleOuterPadding(true) + (image_width ? (image_width + padding) : 0);
label_->SetBounds(pre_label_width, 0,
width() - pre_label_width - GetBubbleOuterPadding(false),
height());
@@ -120,11 +117,10 @@ gfx::Size IconLabelBubbleView::GetSizeForLabelWidth(int width) const {
gfx::Size size(image_->GetPreferredSize());
if (ShouldShowBackground()) {
const int image_width = image_->GetPreferredSize().width();
- const int horizontal_item_padding = GetThemeProvider()->GetDisplayProperty(
- ThemeProperties::PROPERTY_LOCATION_BAR_HORIZONTAL_PADDING);
+ const int padding = GetLayoutConstant(LOCATION_BAR_HORIZONTAL_PADDING);
const int non_label_width =
GetBubbleOuterPadding(true) +
- (image_width ? (image_width + horizontal_item_padding) : 0) +
+ (image_width ? (image_width + padding) : 0) +
GetBubbleOuterPadding(false);
size = gfx::Size(WidthMultiplier() * (width + non_label_width), 0);
size.SetToMax(background_painter_->GetMinimumSize());
@@ -134,15 +130,9 @@ gfx::Size IconLabelBubbleView::GetSizeForLabelWidth(int width) const {
}
int IconLabelBubbleView::GetBubbleOuterPadding(bool by_icon) const {
- ui::ThemeProvider* theme_provider = GetThemeProvider();
- const int bubble_horizontal_padding = theme_provider->GetDisplayProperty(
- ThemeProperties::PROPERTY_LOCATION_BAR_BUBBLE_HORIZONTAL_PADDING);
- const int horizontal_item_padding = theme_provider->GetDisplayProperty(
- ThemeProperties::PROPERTY_LOCATION_BAR_HORIZONTAL_PADDING);
- const int right_padding = theme_provider->GetDisplayProperty(
- ThemeProperties::PROPERTY_ICON_LABEL_VIEW_TRAILING_PADDING);
- return horizontal_item_padding - bubble_horizontal_padding +
- (by_icon ? 0 : right_padding);
+ return GetLayoutConstant(LOCATION_BAR_HORIZONTAL_PADDING) -
+ GetLayoutConstant(LOCATION_BAR_BUBBLE_HORIZONTAL_PADDING) +
+ (by_icon ? 0 : GetLayoutConstant(ICON_LABEL_VIEW_TRAILING_PADDING));
}
void IconLabelBubbleView::SetLabelBackgroundColor(
« no previous file with comments | « chrome/browser/ui/views/layout_constants.cc ('k') | chrome/browser/ui/views/location_bar/location_bar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698