| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/app_list/app_list_presenter_delegate.h" | 5 #include "ash/app_list/app_list_presenter_delegate.h" |
| 6 | 6 |
| 7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/public/cpp/shelf_types.h" | 8 #include "ash/public/cpp/shelf_types.h" |
| 9 #include "ash/public/cpp/shell_window_ids.h" | 9 #include "ash/public/cpp/shell_window_ids.h" |
| 10 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 122 |
| 123 void AppListPresenterDelegate::OnShown(int64_t display_id) { | 123 void AppListPresenterDelegate::OnShown(int64_t display_id) { |
| 124 is_visible_ = true; | 124 is_visible_ = true; |
| 125 // Update applist button status when app list visibility is changed. | 125 // Update applist button status when app list visibility is changed. |
| 126 aura::Window* root_window = | 126 aura::Window* root_window = |
| 127 ShellPort::Get()->GetRootWindowForDisplayId(display_id); | 127 ShellPort::Get()->GetRootWindowForDisplayId(display_id); |
| 128 AppListButton* app_list_button = | 128 AppListButton* app_list_button = |
| 129 Shelf::ForWindow(root_window)->shelf_widget()->GetAppListButton(); | 129 Shelf::ForWindow(root_window)->shelf_widget()->GetAppListButton(); |
| 130 if (app_list_button) | 130 if (app_list_button) |
| 131 app_list_button->OnAppListShown(); | 131 app_list_button->OnAppListShown(); |
| 132 |
| 133 // Notify the shelf that the app list is active so the backgrounds do not |
| 134 // overlap. |
| 135 |
| 136 if (app_list::features::IsFullscreenAppListEnabled()) { |
| 137 Shelf* shelf = Shelf::ForWindow(root_window); |
| 138 shelf->OnAppListIsActive(true); |
| 139 } |
| 132 } | 140 } |
| 133 | 141 |
| 134 void AppListPresenterDelegate::OnDismissed() { | 142 void AppListPresenterDelegate::OnDismissed() { |
| 135 DCHECK(is_visible_); | 143 DCHECK(is_visible_); |
| 136 DCHECK(view_); | 144 DCHECK(view_); |
| 137 | 145 |
| 138 is_visible_ = false; | 146 is_visible_ = false; |
| 139 | 147 |
| 140 // Update applist button status when app list visibility is changed. | 148 // Update applist button status when app list visibility is changed. |
| 141 Shelf* shelf = Shelf::ForWindow(view_->GetWidget()->GetNativeWindow()); | 149 Shelf* shelf = Shelf::ForWindow(view_->GetWidget()->GetNativeWindow()); |
| 142 AppListButton* app_list_button = shelf->shelf_widget()->GetAppListButton(); | 150 AppListButton* app_list_button = shelf->shelf_widget()->GetAppListButton(); |
| 143 if (app_list_button) | 151 if (app_list_button) |
| 144 app_list_button->OnAppListDismissed(); | 152 app_list_button->OnAppListDismissed(); |
| 153 if (app_list::features::IsFullscreenAppListEnabled()) { |
| 154 // Notify the shelf that the app list is being dismissed so it can |
| 155 // re-enable its transparent background. |
| 156 shelf->OnAppListIsActive(false); |
| 157 } |
| 145 } | 158 } |
| 146 | 159 |
| 147 void AppListPresenterDelegate::UpdateBounds() { | 160 void AppListPresenterDelegate::UpdateBounds() { |
| 148 if (!view_ || !is_visible_) | 161 if (!view_ || !is_visible_) |
| 149 return; | 162 return; |
| 150 | 163 |
| 151 view_->UpdateBounds(); | 164 view_->UpdateBounds(); |
| 152 view_->MaybeSetAnchorPoint(GetCenterOfDisplayForWindow( | 165 view_->MaybeSetAnchorPoint(GetCenterOfDisplayForWindow( |
| 153 WmWindow::Get(view_->GetWidget()->GetNativeWindow()), | 166 WmWindow::Get(view_->GetWidget()->GetNativeWindow()), |
| 154 GetMinimumBoundsHeightForAppList(view_))); | 167 GetMinimumBoundsHeightForAppList(view_))); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 } | 253 } |
| 241 | 254 |
| 242 //////////////////////////////////////////////////////////////////////////////// | 255 //////////////////////////////////////////////////////////////////////////////// |
| 243 // AppListPresenterDelegate, ShelfObserver implementation: | 256 // AppListPresenterDelegate, ShelfObserver implementation: |
| 244 | 257 |
| 245 void AppListPresenterDelegate::OnShelfIconPositionsChanged() { | 258 void AppListPresenterDelegate::OnShelfIconPositionsChanged() { |
| 246 UpdateBounds(); | 259 UpdateBounds(); |
| 247 } | 260 } |
| 248 | 261 |
| 249 } // namespace ash | 262 } // namespace ash |
| OLD | NEW |