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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 119 view->SetDragAndDropHostOfCurrentAppList( | 119 view->SetDragAndDropHostOfCurrentAppList( | 
| 120 shelf->shelf_widget()->GetDragAndDropHostForAppList()); | 120 shelf->shelf_widget()->GetDragAndDropHostForAppList()); | 
| 121 } | 121 } | 
| 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(); | 
| 
 
sky
2017/05/31 15:04:17
I prefer minimizing direct dependencies between cl
 
newcomer
2017/06/01 01:42:54
Done.
 
 | |
| 130 if (app_list_button) | 130 if (app_list_button) | 
| 131 app_list_button->OnAppListShown(); | 131 app_list_button->OnAppListShown(); | 
| 132 | |
| 133 if (app_list::features::IsFullscreenAppListEnabled()) { | |
| 134 // Notify the shelf that the app list is active so the backgrounds do not | |
| 135 // overlap. | |
| 136 Shelf* shelf = Shelf::ForWindow(root_window); | |
| 137 shelf->OnAppListIsActive(true); | |
| 
 
xiyuan
2017/05/30 22:18:50
nit: Get rid of |shelf| and use Shelf::ForWindow i
 
newcomer
2017/06/01 01:42:53
Done.
 
 | |
| 138 } | |
| 132 } | 139 } | 
| 133 | 140 | 
| 134 void AppListPresenterDelegate::OnDismissed() { | 141 void AppListPresenterDelegate::OnDismissed() { | 
| 135 DCHECK(is_visible_); | 142 DCHECK(is_visible_); | 
| 136 DCHECK(view_); | 143 DCHECK(view_); | 
| 137 | 144 | 
| 138 is_visible_ = false; | 145 is_visible_ = false; | 
| 139 | 146 | 
| 140 // Update applist button status when app list visibility is changed. | 147 // Update applist button status when app list visibility is changed. | 
| 141 Shelf* shelf = Shelf::ForWindow(view_->GetWidget()->GetNativeWindow()); | 148 Shelf* shelf = Shelf::ForWindow(view_->GetWidget()->GetNativeWindow()); | 
| 142 AppListButton* app_list_button = shelf->shelf_widget()->GetAppListButton(); | 149 AppListButton* app_list_button = shelf->shelf_widget()->GetAppListButton(); | 
| 143 if (app_list_button) | 150 if (app_list_button) | 
| 144 app_list_button->OnAppListDismissed(); | 151 app_list_button->OnAppListDismissed(); | 
| 152 if (app_list::features::IsFullscreenAppListEnabled()) { | |
| 153 // Notify the shelf that the app list is being dismissed so it can | |
| 154 // re-enable its transparent background. | |
| 155 shelf->OnAppListIsActive(false); | |
| 156 } | |
| 145 } | 157 } | 
| 146 | 158 | 
| 147 void AppListPresenterDelegate::UpdateBounds() { | 159 void AppListPresenterDelegate::UpdateBounds() { | 
| 148 if (!view_ || !is_visible_) | 160 if (!view_ || !is_visible_) | 
| 149 return; | 161 return; | 
| 150 | 162 | 
| 151 view_->UpdateBounds(); | 163 view_->UpdateBounds(); | 
| 152 view_->MaybeSetAnchorPoint(GetCenterOfDisplayForWindow( | 164 view_->MaybeSetAnchorPoint(GetCenterOfDisplayForWindow( | 
| 153 WmWindow::Get(view_->GetWidget()->GetNativeWindow()), | 165 WmWindow::Get(view_->GetWidget()->GetNativeWindow()), | 
| 154 GetMinimumBoundsHeightForAppList(view_))); | 166 GetMinimumBoundsHeightForAppList(view_))); | 
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 240 } | 252 } | 
| 241 | 253 | 
| 242 //////////////////////////////////////////////////////////////////////////////// | 254 //////////////////////////////////////////////////////////////////////////////// | 
| 243 // AppListPresenterDelegate, ShelfObserver implementation: | 255 // AppListPresenterDelegate, ShelfObserver implementation: | 
| 244 | 256 | 
| 245 void AppListPresenterDelegate::OnShelfIconPositionsChanged() { | 257 void AppListPresenterDelegate::OnShelfIconPositionsChanged() { | 
| 246 UpdateBounds(); | 258 UpdateBounds(); | 
| 247 } | 259 } | 
| 248 | 260 | 
| 249 } // namespace ash | 261 } // namespace ash | 
| OLD | NEW |