OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ash/wm/aura/wm_shelf_aura.h" |
| 6 |
| 7 #include "ash/shelf/shelf.h" |
| 8 #include "ash/shelf/shelf_layout_manager.h" |
| 9 #include "ash/wm/common/shelf/wm_shelf_observer.h" |
| 10 #include "ash/wm/common/wm_window.h" |
| 11 #include "ui/views/widget/widget.h" |
| 12 |
| 13 namespace ash { |
| 14 namespace wm { |
| 15 |
| 16 WmShelfAura::WmShelfAura(Shelf* shelf) |
| 17 : shelf_(shelf), shelf_layout_manager_(shelf->shelf_layout_manager()) { |
| 18 shelf_layout_manager_->AddObserver(this); |
| 19 } |
| 20 |
| 21 WmShelfAura::~WmShelfAura() { |
| 22 if (shelf_layout_manager_) |
| 23 shelf_layout_manager_->RemoveObserver(this); |
| 24 } |
| 25 |
| 26 WmWindow* WmShelfAura::GetWindow() { |
| 27 return WmWindow::Get(shelf_->shelf_widget()); |
| 28 } |
| 29 |
| 30 ShelfAlignment WmShelfAura::GetAlignment() { |
| 31 return shelf_->alignment(); |
| 32 } |
| 33 |
| 34 ShelfBackgroundType WmShelfAura::GetBackgroundType() { |
| 35 return shelf_->shelf_widget()->GetBackgroundType(); |
| 36 } |
| 37 |
| 38 void WmShelfAura::UpdateVisibilityState() { |
| 39 shelf_->shelf_layout_manager()->UpdateVisibilityState(); |
| 40 } |
| 41 |
| 42 void WmShelfAura::AddObserver(WmShelfObserver* observer) { |
| 43 observers_.AddObserver(observer); |
| 44 } |
| 45 |
| 46 void WmShelfAura::RemoveObserver(WmShelfObserver* observer) { |
| 47 observers_.RemoveObserver(observer); |
| 48 } |
| 49 |
| 50 void WmShelfAura::WillDeleteShelf() { |
| 51 shelf_layout_manager_->RemoveObserver(this); |
| 52 shelf_layout_manager_ = nullptr; |
| 53 } |
| 54 |
| 55 void WmShelfAura::OnBackgroundUpdated( |
| 56 wm::ShelfBackgroundType background_type, |
| 57 BackgroundAnimatorChangeType change_type) { |
| 58 FOR_EACH_OBSERVER(WmShelfObserver, observers_, |
| 59 OnBackgroundUpdated(background_type, change_type)); |
| 60 } |
| 61 |
| 62 } // namespace wm |
| 63 } // namespace ash |
OLD | NEW |