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

Unified Diff: ash/shelf/shelf_layout_manager.cc

Issue 198063003: Revert of Shelf Cleanup (- binary files) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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/shelf/shelf_layout_manager.h ('k') | ash/shelf/shelf_model.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/shelf/shelf_layout_manager.cc
diff --git a/ash/shelf/shelf_layout_manager.cc b/ash/shelf/shelf_layout_manager.cc
index 1988f20b4237f389f546e659adf6b34bb201ffab..f13ea079023459d5b94dccd053abe87324ffcd63 100644
--- a/ash/shelf/shelf_layout_manager.cc
+++ b/ash/shelf/shelf_layout_manager.cc
@@ -96,7 +96,15 @@
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 -------------------------------------
@@ -728,9 +736,9 @@
gfx::Size status_size(
shelf_->status_area_widget()->GetWindowBoundsInScreen().size());
if (IsHorizontalAlignment())
- *height = kShelfSize;
+ *height = GetPreferredShelfSize();
else
- *width = kShelfSize;
+ *width = GetPreferredShelfSize();
}
void ShelfLayoutManager::AdjustBoundsBasedOnAlignment(int inset,
@@ -782,11 +790,16 @@
gfx::Rect(available_bounds.x(), available_bounds.y(),
available_bounds.width(), shelf_height));
- int status_inset = 0;
- if (IsHorizontalAlignment())
- status_size.set_height(kShelfSize);
- else
- status_size.set_width(kShelfSize);
+ 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);
+ }
target_bounds->status_bounds_in_shelf = SelectValueForShelfAlignment(
gfx::Rect(base::i18n::IsRTL() ? 0 : shelf_width - status_size.width(),
@@ -866,7 +879,7 @@
// 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 = kShelfSize - kAutoHideSize;
+ resistance_free_region = GetPreferredShelfSize() - kAutoHideSize;
}
bool resist = SelectValueForShelfAlignment(
@@ -897,7 +910,16 @@
available_bounds.bottom() - shelf_height);
}
- target_bounds->status_bounds_in_shelf.set_y(0);
+ 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());
+ }
} else {
// Move and size the shelf with the gesture.
int shelf_width = target_bounds->shelf_bounds_in_root.width();
@@ -913,12 +935,21 @@
available_bounds.right() - shelf_width);
}
- 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);
+ 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());
+ }
}
}
« no previous file with comments | « ash/shelf/shelf_layout_manager.h ('k') | ash/shelf/shelf_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698