| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/aura/wm_shelf_aura.h" | 5 #include "ash/aura/wm_shelf_aura.h" |
| 6 | 6 |
| 7 #include "ash/aura/wm_window_aura.h" | 7 #include "ash/aura/wm_window_aura.h" |
| 8 #include "ash/common/shelf/wm_shelf_observer.h" | 8 #include "ash/common/shelf/wm_shelf_observer.h" |
| 9 #include "ash/common/wm_window.h" | 9 #include "ash/common/wm_window.h" |
| 10 #include "ash/shelf/shelf.h" | 10 #include "ash/shelf/shelf.h" |
| 11 #include "ash/shelf/shelf_layout_manager.h" | 11 #include "ash/shelf/shelf_layout_manager.h" |
| 12 #include "ash/shell.h" |
| 12 #include "ui/views/widget/widget.h" | 13 #include "ui/views/widget/widget.h" |
| 13 | 14 |
| 14 namespace ash { | 15 namespace ash { |
| 15 | 16 |
| 16 WmShelfAura::WmShelfAura() {} | 17 WmShelfAura::WmShelfAura() {} |
| 17 | 18 |
| 18 WmShelfAura::~WmShelfAura() {} | 19 WmShelfAura::~WmShelfAura() {} |
| 19 | 20 |
| 20 void WmShelfAura::SetShelfLayoutManager( | 21 void WmShelfAura::SetShelfLayoutManager( |
| 21 ShelfLayoutManager* shelf_layout_manager) { | 22 ShelfLayoutManager* shelf_layout_manager) { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 } | 73 } |
| 73 | 74 |
| 74 void WmShelfAura::SetAutoHideBehavior(ShelfAutoHideBehavior behavior) { | 75 void WmShelfAura::SetAutoHideBehavior(ShelfAutoHideBehavior behavior) { |
| 75 shelf_->SetAutoHideBehavior(behavior); | 76 shelf_->SetAutoHideBehavior(behavior); |
| 76 } | 77 } |
| 77 | 78 |
| 78 ShelfAutoHideState WmShelfAura::GetAutoHideState() const { | 79 ShelfAutoHideState WmShelfAura::GetAutoHideState() const { |
| 79 return shelf_layout_manager_->auto_hide_state(); | 80 return shelf_layout_manager_->auto_hide_state(); |
| 80 } | 81 } |
| 81 | 82 |
| 83 void WmShelfAura::UpdateAutoHideState() { |
| 84 shelf_layout_manager_->UpdateAutoHideState(); |
| 85 } |
| 86 |
| 82 ShelfBackgroundType WmShelfAura::GetBackgroundType() const { | 87 ShelfBackgroundType WmShelfAura::GetBackgroundType() const { |
| 83 return shelf_layout_manager_->shelf_widget()->GetBackgroundType(); | 88 return shelf_layout_manager_->shelf_widget()->GetBackgroundType(); |
| 84 } | 89 } |
| 85 | 90 |
| 91 bool WmShelfAura::IsDimmed() const { |
| 92 return shelf_layout_manager_->shelf_widget()->GetDimsShelf(); |
| 93 } |
| 94 |
| 95 bool WmShelfAura::IsVisible() const { |
| 96 return shelf_->IsVisible(); |
| 97 } |
| 98 |
| 86 void WmShelfAura::UpdateVisibilityState() { | 99 void WmShelfAura::UpdateVisibilityState() { |
| 87 shelf_layout_manager_->UpdateVisibilityState(); | 100 shelf_layout_manager_->UpdateVisibilityState(); |
| 88 } | 101 } |
| 89 | 102 |
| 90 ShelfVisibilityState WmShelfAura::GetVisibilityState() const { | 103 ShelfVisibilityState WmShelfAura::GetVisibilityState() const { |
| 91 return shelf_layout_manager_ ? shelf_layout_manager_->visibility_state() | 104 return shelf_layout_manager_ ? shelf_layout_manager_->visibility_state() |
| 92 : SHELF_HIDDEN; | 105 : SHELF_HIDDEN; |
| 93 } | 106 } |
| 94 | 107 |
| 108 gfx::Rect WmShelfAura::GetIdealBounds() { |
| 109 return shelf_layout_manager_->GetIdealBounds(); |
| 110 } |
| 111 |
| 95 gfx::Rect WmShelfAura::GetUserWorkAreaBounds() const { | 112 gfx::Rect WmShelfAura::GetUserWorkAreaBounds() const { |
| 96 return shelf_layout_manager_ ? shelf_layout_manager_->user_work_area_bounds() | 113 return shelf_layout_manager_ ? shelf_layout_manager_->user_work_area_bounds() |
| 97 : gfx::Rect(); | 114 : gfx::Rect(); |
| 98 } | 115 } |
| 99 | 116 |
| 100 void WmShelfAura::UpdateIconPositionForWindow(WmWindow* window) { | 117 void WmShelfAura::UpdateIconPositionForWindow(WmWindow* window) { |
| 101 shelf_->UpdateIconPositionForWindow(WmWindowAura::GetAuraWindow(window)); | 118 shelf_->UpdateIconPositionForWindow(WmWindowAura::GetAuraWindow(window)); |
| 102 } | 119 } |
| 103 | 120 |
| 104 gfx::Rect WmShelfAura::GetScreenBoundsOfItemIconForWindow(WmWindow* window) { | 121 gfx::Rect WmShelfAura::GetScreenBoundsOfItemIconForWindow(WmWindow* window) { |
| 105 return shelf_->GetScreenBoundsOfItemIconForWindow( | 122 return shelf_->GetScreenBoundsOfItemIconForWindow( |
| 106 WmWindowAura::GetAuraWindow(window)); | 123 WmWindowAura::GetAuraWindow(window)); |
| 107 } | 124 } |
| 108 | 125 |
| 126 void WmShelfAura::UpdateAutoHideForMouseEvent(ui::MouseEvent* event) { |
| 127 // Auto-hide support for ash_sysui. |
| 128 if (Shell::GetInstance()->in_mus() && shelf_layout_manager_) |
| 129 shelf_layout_manager_->UpdateAutoHideForMouseEvent(event); |
| 130 } |
| 131 |
| 132 void WmShelfAura::UpdateAutoHideForGestureEvent(ui::GestureEvent* event) { |
| 133 // Auto-hide support for ash_sysui. |
| 134 if (Shell::GetInstance()->in_mus() && shelf_layout_manager_) |
| 135 shelf_layout_manager_->UpdateAutoHideForGestureEvent(event); |
| 136 } |
| 137 |
| 109 void WmShelfAura::AddObserver(WmShelfObserver* observer) { | 138 void WmShelfAura::AddObserver(WmShelfObserver* observer) { |
| 110 observers_.AddObserver(observer); | 139 observers_.AddObserver(observer); |
| 111 } | 140 } |
| 112 | 141 |
| 113 void WmShelfAura::RemoveObserver(WmShelfObserver* observer) { | 142 void WmShelfAura::RemoveObserver(WmShelfObserver* observer) { |
| 114 observers_.RemoveObserver(observer); | 143 observers_.RemoveObserver(observer); |
| 115 } | 144 } |
| 116 | 145 |
| 117 void WmShelfAura::WillDeleteShelfLayoutManager() { | 146 void WmShelfAura::WillDeleteShelfLayoutManager() { |
| 118 ResetShelfLayoutManager(); | 147 ResetShelfLayoutManager(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 133 void WmShelfAura::OnAutoHideStateChanged(ShelfAutoHideState new_state) { | 162 void WmShelfAura::OnAutoHideStateChanged(ShelfAutoHideState new_state) { |
| 134 FOR_EACH_OBSERVER(WmShelfObserver, observers_, | 163 FOR_EACH_OBSERVER(WmShelfObserver, observers_, |
| 135 OnAutoHideStateChanged(new_state)); | 164 OnAutoHideStateChanged(new_state)); |
| 136 } | 165 } |
| 137 | 166 |
| 138 void WmShelfAura::OnShelfIconPositionsChanged() { | 167 void WmShelfAura::OnShelfIconPositionsChanged() { |
| 139 FOR_EACH_OBSERVER(WmShelfObserver, observers_, OnShelfIconPositionsChanged()); | 168 FOR_EACH_OBSERVER(WmShelfObserver, observers_, OnShelfIconPositionsChanged()); |
| 140 } | 169 } |
| 141 | 170 |
| 142 } // namespace ash | 171 } // namespace ash |
| OLD | NEW |