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

Unified Diff: ash/wm/shelf_layout_manager.cc

Issue 10384217: Add left/right layout support for uber tray. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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
Index: ash/wm/shelf_layout_manager.cc
diff --git a/ash/wm/shelf_layout_manager.cc b/ash/wm/shelf_layout_manager.cc
index f1cbdaa36c42166cf3f854c01c9514dd4359404b..65ff1d9209ccdb48e67b1987a9cf12c51fe2206e 100644
--- a/ash/wm/shelf_layout_manager.cc
+++ b/ash/wm/shelf_layout_manager.cc
@@ -193,6 +193,8 @@ void ShelfLayoutManager::SetAlignment(ShelfAlignment alignment) {
alignment_ = alignment;
if (launcher_)
launcher_->SetAlignment(alignment);
+ if (Shell::GetInstance()->tray())
+ Shell::GetInstance()->tray()->SetAlignment(alignment);
LayoutShelf();
}
@@ -392,15 +394,14 @@ void ShelfLayoutManager::StopAnimating() {
void ShelfLayoutManager::GetShelfSize(int* width, int* height) {
*width = *height = 0;
- gfx::Rect status_bounds(status_->GetWindowScreenBounds());
+ gfx::Size status_size = Shell::GetInstance()->tray() ?
+ status_->GetContentsView()->GetPreferredSize() : gfx::Size();
gfx::Size launcher_size = launcher_ ?
launcher_widget()->GetContentsView()->GetPreferredSize() : gfx::Size();
- if (alignment_ == SHELF_ALIGNMENT_BOTTOM) {
- *height = std::max(launcher_size.height(), status_bounds.height());
- } else {
- // TODO: include status when supports alignment.
- *width = launcher_size.width();
- }
+ if (alignment_ == SHELF_ALIGNMENT_BOTTOM)
+ *height = std::max(launcher_size.height(), status_size.height());
+ else
+ *width = std::max(launcher_size.width(), status_size.width());
}
void ShelfLayoutManager::AdjustBoundsBasedOnAlignment(int inset,
@@ -423,7 +424,9 @@ void ShelfLayoutManager::CalculateTargetBounds(
TargetBounds* target_bounds) {
const gfx::Rect& available_bounds(
status_->GetNativeView()->GetRootWindow()->bounds());
- gfx::Rect status_bounds(status_->GetWindowScreenBounds());
+ gfx::Size status_size = Shell::GetInstance()->tray() ?
+ status_->GetContentsView()->GetPreferredSize() : gfx::Size();
+
gfx::Size launcher_size = launcher_ ?
launcher_widget()->GetContentsView()->GetPreferredSize() : gfx::Size();
int shelf_size = 0;
@@ -443,9 +446,10 @@ void ShelfLayoutManager::CalculateTargetBounds(
// The status widget should extend to the bottom and right edges.
target_bounds->status_bounds = gfx::Rect(
base::i18n::IsRTL() ? available_bounds.x() :
- available_bounds.right() - status_bounds.width(),
- y + shelf_height - status_bounds.height(),
- status_bounds.width(), status_bounds.height());
+ available_bounds.right() - status_size.width(),
+ y + shelf_height - status_size.height(),
+ status_size.width(), status_size.height());
+
if (launcher_widget()) {
target_bounds->launcher_bounds = gfx::Rect(
available_bounds.x(),
@@ -460,8 +464,8 @@ void ShelfLayoutManager::CalculateTargetBounds(
available_bounds.x() + shelf_size - shelf_width :
available_bounds.right() - shelf_size;
target_bounds->status_bounds = gfx::Rect(
- x, available_bounds.bottom() - status_bounds.height(),
- shelf_width, status_bounds.height());
+ x, available_bounds.bottom() - status_size.height(),
+ shelf_width, status_size.height());
if (launcher_widget()) {
target_bounds->launcher_bounds = gfx::Rect(
x,

Powered by Google App Engine
This is Rietveld 408576698