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..a8c8d553de2c27dc060586200cd8f0af2741c0a0 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()->SetShelfAlignment(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()); |
sky
2012/05/18 15:01:48
Does the tray now support left/right alignment tha
|
} |
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() ? |
sky
2012/05/18 15:01:48
Why does this and GetShelfSize need to query for t
jennyz
2012/05/18 22:05:10
Done. I updated the widget size when changing layo
|
+ 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, |