Chromium Code Reviews| Index: ash/shelf/app_list_button.cc | 
| diff --git a/ash/shelf/app_list_button.cc b/ash/shelf/app_list_button.cc | 
| index 584d9d842d223fcaf91911116abcb9d32d96a0be..016773956839153d41bd44bdb00684bcfa74b77c 100644 | 
| --- a/ash/shelf/app_list_button.cc | 
| +++ b/ash/shelf/app_list_button.cc | 
| @@ -44,7 +44,7 @@ AppListButton::AppListButton(InkDropButtonListener* listener, | 
| DCHECK(listener_); | 
| DCHECK(shelf_view_); | 
| DCHECK(shelf_); | 
| - | 
| + Shell::Get()->AddShellObserver(this); | 
| SetInkDropMode(InkDropMode::ON_NO_GESTURE_HANDLER); | 
| set_ink_drop_base_color(kShelfInkDropBaseColor); | 
| set_ink_drop_visible_opacity(kShelfInkDropVisibleOpacity); | 
| @@ -55,7 +55,9 @@ AppListButton::AppListButton(InkDropButtonListener* listener, | 
| set_notify_action(CustomButton::NOTIFY_ON_PRESS); | 
| } | 
| -AppListButton::~AppListButton() {} | 
| +AppListButton::~AppListButton() { | 
| + Shell::Get()->RemoveShellObserver(this); | 
| +} | 
| void AppListButton::OnAppListShown() { | 
| AnimateInkDrop(views::InkDropState::ACTIVATED, nullptr); | 
| @@ -239,4 +241,16 @@ gfx::Point AppListButton::GetCenterPoint() const { | 
| } | 
| } | 
| +void AppListButton::OnAppListVisibilityChanged(bool shown, | 
| + aura::Window* root_window) { | 
| + // If the AppList belonged to this shelf. | 
| 
 
msw
2017/06/06 17:56:31
nit: remove this comment, it's not a complete sent
 
newcomer
2017/06/06 23:26:27
Done.
 
 | 
| + if (shelf_ == Shelf::ForWindow(root_window)) { | 
| 
 
xiyuan
2017/06/06 16:50:18
nit: reverse the condition and bail out early.
i.
 
newcomer
2017/06/06 17:12:56
Done.
 
 | 
| + if (shown) { | 
| 
 
msw
2017/06/06 17:56:31
nit: no curlies needed for the nested if/else
 
newcomer
2017/06/06 23:26:27
Done.
 
 | 
| + OnAppListShown(); | 
| + } else { | 
| + OnAppListDismissed(); | 
| + } | 
| + } | 
| +} | 
| + | 
| } // namespace ash |