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

Unified Diff: ash/shelf/shelf_layout_manager.cc

Issue 22291003: ash:Shelf Update Alternate Layout (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nl Created 7 years, 4 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/launcher/overflow_bubble.cc ('k') | ash/system/status_area_widget_delegate.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 82f2b209524ee96ee3f022919f7ad8158f8f944d..bc4428ee8e641492d77a0091e0e21a12a2e7d347 100644
--- a/ash/shelf/shelf_layout_manager.cc
+++ b/ash/shelf/shelf_layout_manager.cc
@@ -60,6 +60,9 @@ const int kAutoHideDelayMS = 200;
// keep the shelf from hiding.
const int kNotificationBubbleGapHeight = 6;
+// Const inset from the edget of the shelf to the edget of the status area.
+const int kStatusAreaInset = 3;
+
ui::Layer* GetLayer(views::Widget* widget) {
return widget->GetNativeView()->layer();
}
@@ -730,6 +733,9 @@ void ShelfLayoutManager::CalculateTargetBounds(
int status_inset = std::max(0, GetPreferredShelfSize() -
PrimaryAxisValue(status_size.height(), status_size.width()));
+ if (ash::switches::UseAlternateShelfLayout())
+ status_inset = kStatusAreaInset;
+
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()),
@@ -838,12 +844,16 @@ void ShelfLayoutManager::UpdateTargetBoundsForGesture(
available_bounds.bottom() - shelf_height);
}
- // 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());
+ if (ash::switches::UseAlternateShelfLayout()) {
+ target_bounds->status_bounds_in_shelf.set_y(kStatusAreaInset);
+ } 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 launcher with the gesture.
int shelf_width = target_bounds->shelf_bounds_in_root.width();
@@ -858,12 +868,21 @@ void ShelfLayoutManager::UpdateTargetBoundsForGesture(
available_bounds.right() - shelf_width);
}
- // 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 (ash::switches::UseAlternateShelfLayout()) {
+ if (alignment_ == SHELF_ALIGNMENT_RIGHT) {
+ target_bounds->shelf_bounds_in_root.set_x(
+ available_bounds.right() - shelf_width + kStatusAreaInset);
+ } else {
+ target_bounds->shelf_bounds_in_root.set_x(kStatusAreaInset);
+ }
+ } 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/launcher/overflow_bubble.cc ('k') | ash/system/status_area_widget_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698