summaryrefslogtreecommitdiffstats
path: root/ash/shelf/shelf_layout_manager.cc
diff options
context:
space:
mode:
Diffstat (limited to 'ash/shelf/shelf_layout_manager.cc')
-rw-r--r--ash/shelf/shelf_layout_manager.cc68
1 files changed, 18 insertions, 50 deletions
diff --git a/ash/shelf/shelf_layout_manager.cc b/ash/shelf/shelf_layout_manager.cc
index 2a24805..6d72a4a 100644
--- a/ash/shelf/shelf_layout_manager.cc
+++ b/ash/shelf/shelf_layout_manager.cc
@@ -94,16 +94,8 @@ const int ShelfLayoutManager::kWorkspaceAreaAutoHideInset = 5;
const int ShelfLayoutManager::kAutoHideSize = 3;
// static
-const int ShelfLayoutManager::kShelfSize = 47;
-
-// static
const int ShelfLayoutManager::kShelfItemInset = 3;
-int ShelfLayoutManager::GetPreferredShelfSize() {
- return ash::switches::UseAlternateShelfLayout() ?
- ShelfLayoutManager::kShelfSize : kShelfPreferredSize;
-}
-
// ShelfLayoutManager::AutoHideEventFilter -------------------------------------
// Notifies ShelfLayoutManager any time the mouse moves.
@@ -758,9 +750,9 @@ void ShelfLayoutManager::GetShelfSize(int* width, int* height) {
gfx::Size status_size(
shelf_->status_area_widget()->GetWindowBoundsInScreen().size());
if (IsHorizontalAlignment())
- *height = GetPreferredShelfSize();
+ *height = kShelfSize;
else
- *width = GetPreferredShelfSize();
+ *width = kShelfSize;
}
void ShelfLayoutManager::AdjustBoundsBasedOnAlignment(int inset,
@@ -812,27 +804,21 @@ void ShelfLayoutManager::CalculateTargetBounds(
gfx::Rect(available_bounds.x(), available_bounds.y(),
available_bounds.width(), shelf_height));
- int status_inset = std::max(0, GetPreferredShelfSize() -
- PrimaryAxisValue(status_size.height(), status_size.width()));
-
- if (ash::switches::UseAlternateShelfLayout()) {
- status_inset = 0;
- if (IsHorizontalAlignment())
- status_size.set_height(kShelfSize);
- else
- status_size.set_width(kShelfSize);
- }
+ if (IsHorizontalAlignment())
+ status_size.set_height(kShelfSize);
+ else
+ status_size.set_width(kShelfSize);
target_bounds->status_bounds_in_shelf = SelectValueForShelfAlignment(
gfx::Rect(base::i18n::IsRTL() ? 0 : shelf_width - status_size.width(),
- status_inset, status_size.width(), status_size.height()),
- gfx::Rect(shelf_width - (status_size.width() + status_inset),
+ 0, status_size.width(), status_size.height()),
+ gfx::Rect(shelf_width - status_size.width(),
shelf_height - status_size.height(), status_size.width(),
status_size.height()),
- gfx::Rect(status_inset, shelf_height - status_size.height(),
+ gfx::Rect(0, shelf_height - status_size.height(),
status_size.width(), status_size.height()),
gfx::Rect(base::i18n::IsRTL() ? 0 : shelf_width - status_size.width(),
- shelf_height - (status_size.height() + status_inset),
+ shelf_height - status_size.height(),
status_size.width(), status_size.height()));
target_bounds->work_area_insets = SelectValueForShelfAlignment(
@@ -901,7 +887,7 @@ void ShelfLayoutManager::UpdateTargetBoundsForGesture(
// changed since then, e.g. because the tray-menu was shown because of the
// drag), then allow the drag some resistance-free region at first to make
// sure the shelf sticks with the finger until the shelf is visible.
- resistance_free_region = GetPreferredShelfSize() - kAutoHideSize;
+ resistance_free_region = kShelfSize - kAutoHideSize;
}
bool resist = SelectValueForShelfAlignment(
@@ -932,16 +918,7 @@ void ShelfLayoutManager::UpdateTargetBoundsForGesture(
available_bounds.bottom() - shelf_height);
}
- if (ash::switches::UseAlternateShelfLayout()) {
- target_bounds->status_bounds_in_shelf.set_y(0);
- } else {
- // The statusbar should be in the center of the shelf.
- gfx::Rect status_y = target_bounds->shelf_bounds_in_root;
- status_y.set_y(0);
- status_y.ClampToCenteredSize(
- target_bounds->status_bounds_in_shelf.size());
- target_bounds->status_bounds_in_shelf.set_y(status_y.y());
- }
+ target_bounds->status_bounds_in_shelf.set_y(0);
} else {
// Move and size the shelf with the gesture.
int shelf_width = target_bounds->shelf_bounds_in_root.width();
@@ -957,21 +934,12 @@ void ShelfLayoutManager::UpdateTargetBoundsForGesture(
available_bounds.right() - shelf_width);
}
- if (ash::switches::UseAlternateShelfLayout()) {
- if (right_aligned)
- target_bounds->status_bounds_in_shelf.set_x(0);
- else
- target_bounds->status_bounds_in_shelf.set_x(
- target_bounds->shelf_bounds_in_root.width() -
- kShelfSize);
- } else {
- // The statusbar should be in the center of the shelf.
- gfx::Rect status_x = target_bounds->shelf_bounds_in_root;
- status_x.set_x(0);
- status_x.ClampToCenteredSize(
- target_bounds->status_bounds_in_shelf.size());
- target_bounds->status_bounds_in_shelf.set_x(status_x.x());
- }
+ if (right_aligned)
+ target_bounds->status_bounds_in_shelf.set_x(0);
+ else
+ target_bounds->status_bounds_in_shelf.set_x(
+ target_bounds->shelf_bounds_in_root.width() -
+ kShelfSize);
}
}