| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_delegate_impl.h" | 5 #include "ash/app_list/app_list_delegate_impl.h" |
| 6 | 6 |
| 7 #include "ash/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
| 8 #include "ash/shelf/app_list_button.h" |
| 9 #include "ash/shelf/shelf.h" |
| 10 #include "ash/shelf/shelf_widget.h" |
| 8 #include "ash/shell.h" | 11 #include "ash/shell.h" |
| 9 #include "ash/shell_port.h" | 12 #include "ash/shell_port.h" |
| 10 #include "ui/app_list/app_list_features.h" | |
| 11 #include "ui/app_list/presenter/app_list.h" | 13 #include "ui/app_list/presenter/app_list.h" |
| 12 | 14 |
| 13 namespace ash { | 15 namespace ash { |
| 14 // TODO(newcomer): Remove this class as a part of crbug.com/726838 | 16 |
| 15 AppListDelegateImpl::AppListDelegateImpl() { | 17 AppListDelegateImpl::AppListDelegateImpl() { |
| 16 Shell::Get()->app_list()->set_delegate(this); | 18 Shell::Get()->app_list()->set_delegate(this); |
| 17 } | 19 } |
| 18 | 20 |
| 19 AppListDelegateImpl::~AppListDelegateImpl() { | 21 AppListDelegateImpl::~AppListDelegateImpl() { |
| 20 Shell::Get()->app_list()->set_delegate(nullptr); | 22 Shell::Get()->app_list()->set_delegate(nullptr); |
| 21 } | 23 } |
| 22 | 24 |
| 23 void AppListDelegateImpl::OnAppListVisibilityChanged(bool visible, | 25 void AppListDelegateImpl::OnAppListVisibilityChanged(bool visible, |
| 24 int64_t display_id) { | 26 int64_t display_id) { |
| 25 if (app_list::features::IsFullscreenAppListEnabled()) { | 27 aura::Window* root_window = |
| 26 aura::Window* root_window = | 28 ShellPort::Get()->GetRootWindowForDisplayId(display_id); |
| 27 ShellPort::Get()->GetRootWindowForDisplayId(display_id); | 29 AppListButton* app_list_button = |
| 28 Shell::Get()->OnAppListVisibilityChanged(visible, root_window); | 30 Shelf::ForWindow(root_window)->shelf_widget()->GetAppListButton(); |
| 29 } | 31 if (!app_list_button) |
| 32 return; |
| 33 |
| 34 if (visible) |
| 35 app_list_button->OnAppListShown(); |
| 36 else |
| 37 app_list_button->OnAppListDismissed(); |
| 30 } | 38 } |
| 31 | 39 |
| 32 } // namespace ash | 40 } // namespace ash |
| OLD | NEW |