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

Unified Diff: ash/system/tray/tray_background_view.cc

Issue 1877543002: Revise the shelf alignment locking mechanism. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update and cleanup tests. Created 4 years, 8 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/system/tray/system_tray_unittest.cc ('k') | ash/system/tray/tray_image_item.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/system/tray/tray_background_view.cc
diff --git a/ash/system/tray/tray_background_view.cc b/ash/system/tray/tray_background_view.cc
index e0f2fec679aa372da34eae374f7c4a7e66dad5d0..0997d77fea2414dde5fd2963ee90781750368712 100644
--- a/ash/system/tray/tray_background_view.cc
+++ b/ash/system/tray/tray_background_view.cc
@@ -7,6 +7,7 @@
#include "ash/root_window_controller.h"
#include "ash/screen_util.h"
#include "ash/shelf/shelf_layout_manager.h"
+#include "ash/shelf/shelf_util.h"
#include "ash/shelf/shelf_widget.h"
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
@@ -192,7 +193,7 @@ void TrayBackgroundView::TrayContainer::ViewHierarchyChanged(
void TrayBackgroundView::TrayContainer::UpdateLayout() {
// Adjust the size of status tray dark background by adding additional
// empty border.
- if (alignment_ == SHELF_ALIGNMENT_BOTTOM) {
+ if (IsHorizontalAlignment(alignment_)) {
SetBorder(views::Border::CreateEmptyBorder(
kPaddingFromEdgeOfShelf,
kPaddingFromEdgeOfShelf,
@@ -403,7 +404,7 @@ void TrayBackgroundView::SetTrayBorder() {
// Tray views are laid out right-to-left or bottom-to-top
bool on_edge = (this == parent->child_at(0));
int left_edge, top_edge, right_edge, bottom_edge;
- if (shelf_alignment() == SHELF_ALIGNMENT_BOTTOM) {
+ if (IsHorizontalAlignment(shelf_alignment())) {
top_edge = ShelfLayoutManager::kShelfItemInset;
left_edge = 0;
bottom_edge = kShelfSize -
@@ -450,7 +451,7 @@ bool TrayBackgroundView::RequiresNotificationWhenAnimatorDestroyed() const {
void TrayBackgroundView::HideTransformation() {
gfx::Transform transform;
- if (shelf_alignment_ == SHELF_ALIGNMENT_BOTTOM)
+ if (IsHorizontalAlignment(shelf_alignment_))
transform.Translate(width(), 0.0f);
else
transform.Translate(0.0f, height());
@@ -559,15 +560,10 @@ gfx::Rect TrayBackgroundView::GetBubbleAnchorRect(
}
TrayBubbleView::AnchorAlignment TrayBackgroundView::GetAnchorAlignment() const {
- switch (shelf_alignment_) {
- case SHELF_ALIGNMENT_BOTTOM:
- return TrayBubbleView::ANCHOR_ALIGNMENT_BOTTOM;
- case SHELF_ALIGNMENT_LEFT:
- return TrayBubbleView::ANCHOR_ALIGNMENT_LEFT;
- case SHELF_ALIGNMENT_RIGHT:
- return TrayBubbleView::ANCHOR_ALIGNMENT_RIGHT;
- }
- NOTREACHED();
+ if (shelf_alignment_ == SHELF_ALIGNMENT_LEFT)
+ return TrayBubbleView::ANCHOR_ALIGNMENT_LEFT;
+ if (shelf_alignment_ == SHELF_ALIGNMENT_RIGHT)
+ return TrayBubbleView::ANCHOR_ALIGNMENT_RIGHT;
return TrayBubbleView::ANCHOR_ALIGNMENT_BOTTOM;
}
« no previous file with comments | « ash/system/tray/system_tray_unittest.cc ('k') | ash/system/tray/tray_image_item.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698