Chromium Code Reviews| 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" | 8 #include "ash/shelf/app_list_button.h" |
| 9 #include "ash/shelf/shelf.h" | 9 #include "ash/shelf/shelf.h" |
| 10 #include "ash/shelf/shelf_widget.h" | 10 #include "ash/shelf/shelf_widget.h" |
| 11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
| 12 #include "ash/shell_port.h" | 12 #include "ash/shell_port.h" |
| 13 #include "ash/wm_window.h" | 13 #include "ash/wm_window.h" |
| 14 #include "ui/app_list/app_list_features.h" | |
| 14 #include "ui/app_list/presenter/app_list.h" | 15 #include "ui/app_list/presenter/app_list.h" |
| 15 | 16 |
| 16 namespace ash { | 17 namespace ash { |
| 17 | 18 |
| 18 AppListDelegateImpl::AppListDelegateImpl() { | 19 AppListDelegateImpl::AppListDelegateImpl() { |
| 19 Shell::Get()->app_list()->set_delegate(this); | 20 Shell::Get()->app_list()->set_delegate(this); |
| 20 } | 21 } |
| 21 | 22 |
| 22 AppListDelegateImpl::~AppListDelegateImpl() { | 23 AppListDelegateImpl::~AppListDelegateImpl() { |
| 23 Shell::Get()->app_list()->set_delegate(nullptr); | 24 Shell::Get()->app_list()->set_delegate(nullptr); |
| 24 } | 25 } |
| 25 | 26 |
| 26 void AppListDelegateImpl::OnAppListVisibilityChanged(bool visible, | 27 void AppListDelegateImpl::OnAppListVisibilityChanged(bool visible, |
| 27 int64_t display_id) { | 28 int64_t display_id) { |
| 28 aura::Window* root_window = | 29 aura::Window* root_window = |
| 29 ShellPort::Get()->GetRootWindowForDisplayId(display_id); | 30 ShellPort::Get()->GetRootWindowForDisplayId(display_id); |
| 30 AppListButton* app_list_button = | 31 AppListButton* app_list_button = |
| 31 Shelf::ForWindow(root_window)->shelf_widget()->GetAppListButton(); | 32 Shelf::ForWindow(root_window)->shelf_widget()->GetAppListButton(); |
| 32 if (!app_list_button) | 33 if (!app_list_button) |
| 33 return; | 34 return; |
| 34 | 35 |
| 35 if (visible) | 36 if (visible) { |
| 36 app_list_button->OnAppListShown(); | 37 app_list_button->OnAppListShown(); |
| 37 else | 38 if (app_list::features::IsFullscreenAppListEnabled()) { |
| 39 Shelf* shelf = Shelf::ForWindow(root_window); | |
| 40 shelf->OnAppListIsActive(true); | |
|
vadimt
2017/05/26 23:44:08
This repeated part can be moved to after if.
newcomer
2017/05/30 21:37:03
Done.
| |
| 41 } | |
| 42 } else { | |
| 38 app_list_button->OnAppListDismissed(); | 43 app_list_button->OnAppListDismissed(); |
| 44 if (app_list::features::IsFullscreenAppListEnabled()) { | |
| 45 Shelf* shelf = Shelf::ForWindow(root_window); | |
| 46 shelf->OnAppListIsActive(true); | |
|
xiyuan
2017/05/30 16:32:33
Should this be "false" ? We probably can use |visi
newcomer
2017/05/30 21:37:03
Correct, I noticed this too and It's fixed.
| |
| 47 } | |
| 48 } | |
| 39 } | 49 } |
| 40 | 50 |
| 41 } // namespace ash | 51 } // namespace ash |
| OLD | NEW |