Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1970)

Unified Diff: ash/app_list/app_list_delegate_impl.cc

Issue 2647833003: Adds AppListDelegate to AppList that is notified on visibility changes (Closed)
Patch Set: move Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/app_list/app_list_delegate_impl.h ('k') | ash/app_list/app_list_presenter_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/app_list/app_list_delegate_impl.cc
diff --git a/ash/app_list/app_list_delegate_impl.cc b/ash/app_list/app_list_delegate_impl.cc
new file mode 100644
index 0000000000000000000000000000000000000000..8f5c63b963670a0f31aecb8796317efd0d46d348
--- /dev/null
+++ b/ash/app_list/app_list_delegate_impl.cc
@@ -0,0 +1,38 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ash/app_list/app_list_delegate_impl.h"
+
+#include "ash/common/shelf/app_list_button.h"
+#include "ash/common/shelf/shelf_widget.h"
+#include "ash/common/shelf/wm_shelf.h"
+#include "ash/common/wm_shell.h"
+#include "ash/root_window_controller.h"
+#include "ui/app_list/presenter/app_list.h"
+
+namespace ash {
+
+AppListDelegateImpl::AppListDelegateImpl() {
+ WmShell::Get()->app_list()->set_delegate(this);
+}
+
+AppListDelegateImpl::~AppListDelegateImpl() {
+ WmShell::Get()->app_list()->set_delegate(nullptr);
+}
+
+void AppListDelegateImpl::OnAppListVisibilityChanged(bool visible,
+ int64_t display_id) {
+ WmWindow* root_window = WmShell::Get()->GetRootWindowForDisplayId(display_id);
+ AppListButton* app_list_button =
+ WmShelf::ForWindow(root_window)->shelf_widget()->GetAppListButton();
+ if (!app_list_button)
+ return;
+
+ if (visible)
+ app_list_button->OnAppListShown();
+ else
+ app_list_button->OnAppListDismissed();
+}
+
+} // namespace ash
« no previous file with comments | « ash/app_list/app_list_delegate_impl.h ('k') | ash/app_list/app_list_presenter_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698