| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 112 |
| 113 // By setting us as DnD recipient, the app list knows that we can | 113 // By setting us as DnD recipient, the app list knows that we can |
| 114 // handle items. | 114 // handle items. |
| 115 Shelf* shelf = Shelf::ForWindow(root_window); | 115 Shelf* shelf = Shelf::ForWindow(root_window); |
| 116 view->SetDragAndDropHostOfCurrentAppList( | 116 view->SetDragAndDropHostOfCurrentAppList( |
| 117 shelf->shelf_widget()->GetDragAndDropHostForAppList()); | 117 shelf->shelf_widget()->GetDragAndDropHostForAppList()); |
| 118 } | 118 } |
| 119 | 119 |
| 120 void AppListPresenterDelegate::OnShown(int64_t display_id) { | 120 void AppListPresenterDelegate::OnShown(int64_t display_id) { |
| 121 is_visible_ = true; | 121 is_visible_ = true; |
| 122 // Update applist button status when app list visibility is changed. | |
| 123 aura::Window* root_window = | 122 aura::Window* root_window = |
| 124 ShellPort::Get()->GetRootWindowForDisplayId(display_id); | 123 ShellPort::Get()->GetRootWindowForDisplayId(display_id); |
| 125 AppListButton* app_list_button = | 124 Shell::Get()->OnAppListVisibilityChanged(is_visible_, root_window); |
| 126 Shelf::ForWindow(root_window)->shelf_widget()->GetAppListButton(); | |
| 127 if (app_list_button) | |
| 128 app_list_button->OnAppListShown(); | |
| 129 } | 125 } |
| 130 | 126 |
| 131 void AppListPresenterDelegate::OnDismissed() { | 127 void AppListPresenterDelegate::OnDismissed() { |
| 132 DCHECK(is_visible_); | 128 DCHECK(is_visible_); |
| 133 DCHECK(view_); | 129 DCHECK(view_); |
| 134 | 130 |
| 135 is_visible_ = false; | 131 is_visible_ = false; |
| 136 | 132 aura::Window* root_window = |
| 137 // Update applist button status when app list visibility is changed. | 133 RootWindowController::ForTargetRootWindow()->GetRootWindow(); |
| 138 Shelf* shelf = Shelf::ForWindow(view_->GetWidget()->GetNativeWindow()); | 134 Shell::Get()->OnAppListVisibilityChanged(is_visible_, root_window); |
| 139 AppListButton* app_list_button = shelf->shelf_widget()->GetAppListButton(); | |
| 140 if (app_list_button) | |
| 141 app_list_button->OnAppListDismissed(); | |
| 142 } | 135 } |
| 143 | 136 |
| 144 void AppListPresenterDelegate::UpdateBounds() { | 137 void AppListPresenterDelegate::UpdateBounds() { |
| 145 if (!view_ || !is_visible_) | 138 if (!view_ || !is_visible_) |
| 146 return; | 139 return; |
| 147 | 140 |
| 148 view_->UpdateBounds(); | 141 view_->UpdateBounds(); |
| 149 view_->MaybeSetAnchorPoint( | 142 view_->MaybeSetAnchorPoint( |
| 150 GetCenterOfDisplayForWindow(view_->GetWidget()->GetNativeWindow(), | 143 GetCenterOfDisplayForWindow(view_->GetWidget()->GetNativeWindow(), |
| 151 GetMinimumBoundsHeightForAppList(view_))); | 144 GetMinimumBoundsHeightForAppList(view_))); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 void AppListPresenterDelegate::OnKeyboardClosed() {} | 223 void AppListPresenterDelegate::OnKeyboardClosed() {} |
| 231 | 224 |
| 232 //////////////////////////////////////////////////////////////////////////////// | 225 //////////////////////////////////////////////////////////////////////////////// |
| 233 // AppListPresenterDelegate, ShellObserver implementation: | 226 // AppListPresenterDelegate, ShellObserver implementation: |
| 234 void AppListPresenterDelegate::OnOverviewModeStarting() { | 227 void AppListPresenterDelegate::OnOverviewModeStarting() { |
| 235 if (is_visible_) | 228 if (is_visible_) |
| 236 presenter_->Dismiss(); | 229 presenter_->Dismiss(); |
| 237 } | 230 } |
| 238 | 231 |
| 239 } // namespace ash | 232 } // namespace ash |
| OLD | NEW |