| 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" |
| 11 #include "ash/screen_util.h" | 11 #include "ash/screen_util.h" |
| 12 #include "ash/shelf/app_list_button.h" | 12 #include "ash/shelf/app_list_button.h" |
| 13 #include "ash/shelf/shelf.h" | 13 #include "ash/shelf/shelf.h" |
| 14 #include "ash/shelf/shelf_layout_manager.h" | 14 #include "ash/shelf/shelf_layout_manager.h" |
| 15 #include "ash/shelf/shelf_widget.h" | 15 #include "ash/shelf/shelf_widget.h" |
| 16 #include "ash/shell.h" | 16 #include "ash/shell.h" |
| 17 #include "ash/shell_observer.h" |
| 17 #include "ash/shell_port.h" | 18 #include "ash/shell_port.h" |
| 18 #include "ash/wm/maximize_mode/maximize_mode_controller.h" | 19 #include "ash/wm/maximize_mode/maximize_mode_controller.h" |
| 19 #include "base/command_line.h" | 20 #include "base/command_line.h" |
| 20 #include "ui/app_list/app_list_constants.h" | 21 #include "ui/app_list/app_list_constants.h" |
| 21 #include "ui/app_list/app_list_features.h" | 22 #include "ui/app_list/app_list_features.h" |
| 22 #include "ui/app_list/app_list_switches.h" | 23 #include "ui/app_list/app_list_switches.h" |
| 23 #include "ui/app_list/presenter/app_list_presenter_impl.h" | 24 #include "ui/app_list/presenter/app_list_presenter_impl.h" |
| 24 #include "ui/app_list/presenter/app_list_view_delegate_factory.h" | 25 #include "ui/app_list/presenter/app_list_view_delegate_factory.h" |
| 25 #include "ui/app_list/views/app_list_view.h" | 26 #include "ui/app_list/views/app_list_view.h" |
| 26 #include "ui/aura/window.h" | 27 #include "ui/aura/window.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 113 |
| 113 // By setting us as DnD recipient, the app list knows that we can | 114 // By setting us as DnD recipient, the app list knows that we can |
| 114 // handle items. | 115 // handle items. |
| 115 Shelf* shelf = Shelf::ForWindow(root_window); | 116 Shelf* shelf = Shelf::ForWindow(root_window); |
| 116 view->SetDragAndDropHostOfCurrentAppList( | 117 view->SetDragAndDropHostOfCurrentAppList( |
| 117 shelf->shelf_widget()->GetDragAndDropHostForAppList()); | 118 shelf->shelf_widget()->GetDragAndDropHostForAppList()); |
| 118 } | 119 } |
| 119 | 120 |
| 120 void AppListPresenterDelegate::OnShown(int64_t display_id) { | 121 void AppListPresenterDelegate::OnShown(int64_t display_id) { |
| 121 is_visible_ = true; | 122 is_visible_ = true; |
| 122 // Update applist button status when app list visibility is changed. | |
| 123 aura::Window* root_window = | |
| 124 ShellPort::Get()->GetRootWindowForDisplayId(display_id); | |
| 125 AppListButton* app_list_button = | |
| 126 Shelf::ForWindow(root_window)->shelf_widget()->GetAppListButton(); | |
| 127 if (app_list_button) | |
| 128 app_list_button->OnAppListShown(); | |
| 129 } | 123 } |
| 130 | 124 |
| 131 void AppListPresenterDelegate::OnDismissed() { | 125 void AppListPresenterDelegate::OnDismissed() { |
| 132 DCHECK(is_visible_); | 126 DCHECK(is_visible_); |
| 133 DCHECK(view_); | 127 DCHECK(view_); |
| 134 | |
| 135 is_visible_ = false; | 128 is_visible_ = false; |
| 136 | |
| 137 // Update applist button status when app list visibility is changed. | |
| 138 Shelf* shelf = Shelf::ForWindow(view_->GetWidget()->GetNativeWindow()); | |
| 139 AppListButton* app_list_button = shelf->shelf_widget()->GetAppListButton(); | |
| 140 if (app_list_button) | |
| 141 app_list_button->OnAppListDismissed(); | |
| 142 } | 129 } |
| 143 | 130 |
| 144 void AppListPresenterDelegate::UpdateBounds() { | 131 void AppListPresenterDelegate::UpdateBounds() { |
| 145 if (!view_ || !is_visible_) | 132 if (!view_ || !is_visible_) |
| 146 return; | 133 return; |
| 147 | 134 |
| 148 view_->UpdateBounds(); | 135 view_->UpdateBounds(); |
| 149 view_->MaybeSetAnchorPoint( | 136 view_->MaybeSetAnchorPoint( |
| 150 GetCenterOfDisplayForWindow(view_->GetWidget()->GetNativeWindow(), | 137 GetCenterOfDisplayForWindow(view_->GetWidget()->GetNativeWindow(), |
| 151 GetMinimumBoundsHeightForAppList(view_))); | 138 GetMinimumBoundsHeightForAppList(view_))); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 void AppListPresenterDelegate::OnKeyboardClosed() {} | 217 void AppListPresenterDelegate::OnKeyboardClosed() {} |
| 231 | 218 |
| 232 //////////////////////////////////////////////////////////////////////////////// | 219 //////////////////////////////////////////////////////////////////////////////// |
| 233 // AppListPresenterDelegate, ShellObserver implementation: | 220 // AppListPresenterDelegate, ShellObserver implementation: |
| 234 void AppListPresenterDelegate::OnOverviewModeStarting() { | 221 void AppListPresenterDelegate::OnOverviewModeStarting() { |
| 235 if (is_visible_) | 222 if (is_visible_) |
| 236 presenter_->Dismiss(); | 223 presenter_->Dismiss(); |
| 237 } | 224 } |
| 238 | 225 |
| 239 } // namespace ash | 226 } // namespace ash |
| OLD | NEW |