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

Unified Diff: chrome/browser/ui/views/toolbar/toolbar_button.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/toolbar/toolbar_button.cc
diff --git a/chrome/browser/ui/views/toolbar/toolbar_button.cc b/chrome/browser/ui/views/toolbar/toolbar_button.cc
index 835ccf2aa79112641295f60337ad902f7a8b45f1..46cdc9098b96f711b58dbe3562527aafb6223911 100644
--- a/chrome/browser/ui/views/toolbar/toolbar_button.cc
+++ b/chrome/browser/ui/views/toolbar/toolbar_button.cc
@@ -8,7 +8,7 @@
#include "base/location.h"
#include "base/single_thread_task_runner.h"
#include "base/thread_task_runner_handle.h"
-#include "chrome/browser/themes/theme_properties.h"
+#include "chrome/browser/ui/views/layout_constants.h"
#include "chrome/browser/ui/views/location_bar/location_bar_view.h"
#include "ui/accessibility/ax_view_state.h"
#include "ui/base/l10n/l10n_util.h"
@@ -59,9 +59,9 @@ gfx::Size ToolbarButton::GetPreferredSize() const {
gfx::Size size(image()->GetPreferredSize());
gfx::Size label_size = label()->GetPreferredSize();
if (label_size.width() > 0) {
- const int horizontal_item_padding = GetThemeProvider()->GetDisplayProperty(
- ThemeProperties::PROPERTY_LOCATION_BAR_HORIZONTAL_PADDING);
- size.Enlarge(label_size.width() + horizontal_item_padding, 0);
+ size.Enlarge(
+ label_size.width() + GetLayoutConstant(LOCATION_BAR_HORIZONTAL_PADDING),
+ 0);
}
// For non-material assets the entire size of the button is captured in the
// image resource. For Material Design the excess whitespace is being removed
@@ -69,9 +69,8 @@ gfx::Size ToolbarButton::GetPreferredSize() const {
if (ui::MaterialDesignController::IsModeMaterial()) {
ui::ThemeProvider* provider = GetThemeProvider();
if (provider && provider->UsingSystemTheme()) {
- int inset = provider->GetDisplayProperty(
- ThemeProperties::PROPERTY_TOOLBAR_BUTTON_BORDER_INSET);
- size.Enlarge(2 * inset, 2 * inset);
+ gfx::Insets insets(GetLayoutInsets(TOOLBAR_BUTTON));
+ size.Enlarge(insets.width(), insets.height());
}
}
return size;
@@ -190,12 +189,8 @@ ToolbarButton::CreateDefaultBorder() const {
views::LabelButton::CreateDefaultBorder();
ui::ThemeProvider* provider = GetThemeProvider();
- if (provider && provider->UsingSystemTheme()) {
- // Theme provided insets.
- int inset = provider->GetDisplayProperty(
- ThemeProperties::PROPERTY_TOOLBAR_BUTTON_BORDER_INSET);
- border->set_insets(gfx::Insets(inset, inset, inset, inset));
- }
+ if (provider && provider->UsingSystemTheme())
+ border->set_insets(GetLayoutInsets(TOOLBAR_BUTTON));
return border.Pass();
}
« no previous file with comments | « chrome/browser/ui/views/omnibox/omnibox_result_view.cc ('k') | chrome/browser/ui/views/toolbar/toolbar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698