Chromium Code Reviews| 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 Shelf* shelf = Shelf::ForWindow(root_window); | |
| 
 
vadimt
2017/05/26 01:27:56
You can move this inside if.
 
newcomer
2017/05/26 17:11:27
Done.
 
 | |
| 136 if (app_list::features::IsFullscreenAppListEnabled()) | |
| 137 shelf->OnAppListIsActive(true); | |
| 132 } | 138 } | 
| 133 | 139 | 
| 134 void AppListPresenterDelegate::OnDismissed() { | 140 void AppListPresenterDelegate::OnDismissed() { | 
| 135 DCHECK(is_visible_); | 141 DCHECK(is_visible_); | 
| 136 DCHECK(view_); | 142 DCHECK(view_); | 
| 137 | 143 | 
| 138 is_visible_ = false; | 144 is_visible_ = false; | 
| 139 | 145 | 
| 140 // Update applist button status when app list visibility is changed. | 146 // Update applist button status when app list visibility is changed. | 
| 141 Shelf* shelf = Shelf::ForWindow(view_->GetWidget()->GetNativeWindow()); | 147 Shelf* shelf = Shelf::ForWindow(view_->GetWidget()->GetNativeWindow()); | 
| 142 AppListButton* app_list_button = shelf->shelf_widget()->GetAppListButton(); | 148 AppListButton* app_list_button = shelf->shelf_widget()->GetAppListButton(); | 
| 143 if (app_list_button) | 149 if (app_list_button) | 
| 144 app_list_button->OnAppListDismissed(); | 150 app_list_button->OnAppListDismissed(); | 
| 151 if (app_list::features::IsFullscreenAppListEnabled()) { | |
| 152 // Notify the shelf that the app list is being dismissed so it can | |
| 153 // re-enable its transparent background. | |
| 154 shelf->OnAppListIsActive(false); | |
| 155 } | |
| 145 } | 156 } | 
| 146 | 157 | 
| 147 void AppListPresenterDelegate::UpdateBounds() { | 158 void AppListPresenterDelegate::UpdateBounds() { | 
| 148 if (!view_ || !is_visible_) | 159 if (!view_ || !is_visible_) | 
| 149 return; | 160 return; | 
| 150 | 161 | 
| 151 view_->UpdateBounds(); | 162 view_->UpdateBounds(); | 
| 152 view_->MaybeSetAnchorPoint(GetCenterOfDisplayForWindow( | 163 view_->MaybeSetAnchorPoint(GetCenterOfDisplayForWindow( | 
| 153 WmWindow::Get(view_->GetWidget()->GetNativeWindow()), | 164 WmWindow::Get(view_->GetWidget()->GetNativeWindow()), | 
| 154 GetMinimumBoundsHeightForAppList(view_))); | 165 GetMinimumBoundsHeightForAppList(view_))); | 
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 240 } | 251 } | 
| 241 | 252 | 
| 242 //////////////////////////////////////////////////////////////////////////////// | 253 //////////////////////////////////////////////////////////////////////////////// | 
| 243 // AppListPresenterDelegate, ShelfObserver implementation: | 254 // AppListPresenterDelegate, ShelfObserver implementation: | 
| 244 | 255 | 
| 245 void AppListPresenterDelegate::OnShelfIconPositionsChanged() { | 256 void AppListPresenterDelegate::OnShelfIconPositionsChanged() { | 
| 246 UpdateBounds(); | 257 UpdateBounds(); | 
| 247 } | 258 } | 
| 248 | 259 | 
| 249 } // namespace ash | 260 } // namespace ash | 
| OLD | NEW |