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

Unified Diff: ash/common/shelf/shelf_button.cc

Issue 2676673005: ash: Clean up shelf GetAlignment() and IsHorizontalAlignment() calls (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « ash/common/shelf/overflow_bubble_view.cc ('k') | ash/common/shelf/shelf_layout_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/shelf/shelf_button.cc
diff --git a/ash/common/shelf/shelf_button.cc b/ash/common/shelf/shelf_button.cc
index 613f9cd0551a2a1ac66f1279490757e8e9f7d139..fe56d9e9d2a918fa02690eef05ef1c0eb294067d 100644
--- a/ash/common/shelf/shelf_button.cc
+++ b/ash/common/shelf/shelf_button.cc
@@ -12,7 +12,6 @@
#include "ash/common/shelf/shelf_constants.h"
#include "ash/common/shelf/shelf_view.h"
#include "ash/common/shelf/wm_shelf.h"
-#include "ash/common/shelf/wm_shelf_util.h"
#include "base/memory/ptr_util.h"
#include "base/time/time.h"
#include "grit/ash_resources.h"
@@ -209,7 +208,7 @@ class ShelfButton::BarView : public views::ImageView,
animating_ ? ShelfButtonAnimation::GetInstance()->GetAnimation()
: 1.0;
double scale = .35 + .65 * animation;
- if (IsHorizontalAlignment(wm_shelf_->GetAlignment())) {
+ if (wm_shelf_->IsHorizontalAlignment()) {
int width = base_bounds_.width() * scale;
bounds.set_width(std::min(width, kIconSize));
int x_offset = (base_bounds_.width() - bounds.width()) / 2;
@@ -404,8 +403,7 @@ void ShelfButton::GetAccessibleNodeData(ui::AXNodeData* node_data) {
void ShelfButton::Layout() {
const gfx::Rect button_bounds(GetContentsBounds());
WmShelf* wm_shelf = shelf_view_->wm_shelf();
- const bool is_horizontal_shelf =
- IsHorizontalAlignment(wm_shelf->GetAlignment());
+ const bool is_horizontal_shelf = wm_shelf->IsHorizontalAlignment();
const int icon_pad = ash::MaterialDesignController::IsShelfMaterial()
? (is_horizontal_shelf ? kIconPaddingHorizontalMD
: kIconPaddingVerticalMD)
@@ -537,7 +535,7 @@ void ShelfButton::NotifyClick(const ui::Event& event) {
void ShelfButton::UpdateState() {
UpdateBar();
const bool is_horizontal_shelf =
- IsHorizontalAlignment(shelf_view_->wm_shelf()->GetAlignment());
+ shelf_view_->wm_shelf()->IsHorizontalAlignment();
icon_view_->SetHorizontalAlignment(is_horizontal_shelf
? views::ImageView::CENTER
: views::ImageView::LEADING);
@@ -577,7 +575,7 @@ void ShelfButton::UpdateBar() {
image = *rb->GetImageNamed(bar_id).ToImageSkia();
}
ShelfAlignment shelf_alignment = wm_shelf->GetAlignment();
- if (!IsHorizontalAlignment(shelf_alignment)) {
+ if (!wm_shelf->IsHorizontalAlignment()) {
image = gfx::ImageSkiaOperations::CreateRotatedImage(
image, shelf_alignment == SHELF_ALIGNMENT_LEFT
? SkBitmapOperations::ROTATION_90_CW
« no previous file with comments | « ash/common/shelf/overflow_bubble_view.cc ('k') | ash/common/shelf/shelf_layout_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698