| Index: ash/system/web_notification/ash_popup_alignment_delegate.cc
|
| diff --git a/ash/system/web_notification/ash_popup_alignment_delegate.cc b/ash/system/web_notification/ash_popup_alignment_delegate.cc
|
| index 84e21a9f99d3610a1ad2c00d8350a9247beb3bfe..e8dc463ddff2a07fb614d51aaa76bee984c90179 100644
|
| --- a/ash/system/web_notification/ash_popup_alignment_delegate.cc
|
| +++ b/ash/system/web_notification/ash_popup_alignment_delegate.cc
|
| @@ -32,8 +32,9 @@ const int kNoToastMarginBorderAndShadowOffset = 2;
|
|
|
| }
|
|
|
| -AshPopupAlignmentDelegate::AshPopupAlignmentDelegate()
|
| - : screen_(NULL), root_window_(NULL), shelf_(NULL), system_tray_height_(0) {
|
| +AshPopupAlignmentDelegate::AshPopupAlignmentDelegate(ShelfLayoutManager* shelf)
|
| + : screen_(NULL), root_window_(NULL), shelf_(shelf), system_tray_height_(0) {
|
| + shelf_->AddObserver(this);
|
| }
|
|
|
| AshPopupAlignmentDelegate::~AshPopupAlignmentDelegate() {
|
| @@ -51,7 +52,6 @@ void AshPopupAlignmentDelegate::StartObserving(gfx::Screen* screen,
|
| root_window_ = ash::Shell::GetInstance()
|
| ->window_tree_host_manager()
|
| ->GetRootWindowForDisplayId(display.id());
|
| - UpdateShelf();
|
| screen->AddObserver(this);
|
| Shell::GetInstance()->AddShellObserver(this);
|
| if (system_tray_height_ > 0)
|
| @@ -120,15 +120,6 @@ ShelfAlignment AshPopupAlignmentDelegate::GetAlignment() const {
|
| return shelf_ ? shelf_->GetAlignment() : SHELF_ALIGNMENT_BOTTOM;
|
| }
|
|
|
| -void AshPopupAlignmentDelegate::UpdateShelf() {
|
| - if (shelf_)
|
| - return;
|
| -
|
| - shelf_ = ShelfLayoutManager::ForShelf(root_window_);
|
| - if (shelf_)
|
| - shelf_->AddObserver(this);
|
| -}
|
| -
|
| gfx::Display AshPopupAlignmentDelegate::GetCurrentDisplay() const {
|
| return gfx::Screen::GetScreen()->GetDisplayNearestWindow(
|
| shelf_->shelf_widget()->GetNativeView());
|
| @@ -140,7 +131,6 @@ void AshPopupAlignmentDelegate::UpdateWorkArea() {
|
| }
|
|
|
| void AshPopupAlignmentDelegate::OnDisplayWorkAreaInsetsChanged() {
|
| - UpdateShelf();
|
| UpdateWorkArea();
|
| }
|
|
|
| @@ -165,7 +155,6 @@ void AshPopupAlignmentDelegate::OnDisplayRemoved(
|
| void AshPopupAlignmentDelegate::OnDisplayMetricsChanged(
|
| const gfx::Display& display,
|
| uint32_t metrics) {
|
| - UpdateShelf();
|
| if (shelf_ && GetCurrentDisplay().id() == display.id())
|
| UpdateWorkArea();
|
| }
|
|
|