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/common/wm_shell.h" | |
8 #include "ash/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
9 #include "ash/shelf/app_list_button.h" | 8 #include "ash/shelf/app_list_button.h" |
10 #include "ash/shelf/shelf_widget.h" | 9 #include "ash/shelf/shelf_widget.h" |
11 #include "ash/shelf/wm_shelf.h" | 10 #include "ash/shelf/wm_shelf.h" |
| 11 #include "ash/wm_shell.h" |
12 #include "ui/app_list/presenter/app_list.h" | 12 #include "ui/app_list/presenter/app_list.h" |
13 | 13 |
14 namespace ash { | 14 namespace ash { |
15 | 15 |
16 AppListDelegateImpl::AppListDelegateImpl() { | 16 AppListDelegateImpl::AppListDelegateImpl() { |
17 WmShell::Get()->app_list()->set_delegate(this); | 17 WmShell::Get()->app_list()->set_delegate(this); |
18 } | 18 } |
19 | 19 |
20 AppListDelegateImpl::~AppListDelegateImpl() { | 20 AppListDelegateImpl::~AppListDelegateImpl() { |
21 WmShell::Get()->app_list()->set_delegate(nullptr); | 21 WmShell::Get()->app_list()->set_delegate(nullptr); |
22 } | 22 } |
23 | 23 |
24 void AppListDelegateImpl::OnAppListVisibilityChanged(bool visible, | 24 void AppListDelegateImpl::OnAppListVisibilityChanged(bool visible, |
25 int64_t display_id) { | 25 int64_t display_id) { |
26 WmWindow* root_window = WmShell::Get()->GetRootWindowForDisplayId(display_id); | 26 WmWindow* root_window = WmShell::Get()->GetRootWindowForDisplayId(display_id); |
27 AppListButton* app_list_button = | 27 AppListButton* app_list_button = |
28 WmShelf::ForWindow(root_window)->shelf_widget()->GetAppListButton(); | 28 WmShelf::ForWindow(root_window)->shelf_widget()->GetAppListButton(); |
29 if (!app_list_button) | 29 if (!app_list_button) |
30 return; | 30 return; |
31 | 31 |
32 if (visible) | 32 if (visible) |
33 app_list_button->OnAppListShown(); | 33 app_list_button->OnAppListShown(); |
34 else | 34 else |
35 app_list_button->OnAppListDismissed(); | 35 app_list_button->OnAppListDismissed(); |
36 } | 36 } |
37 | 37 |
38 } // namespace ash | 38 } // namespace ash |
OLD | NEW |