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

Unified Diff: ash/wm/app_list_controller.cc

Issue 485453003: Split AppListController::SetVisible into Show and Dismiss. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 6 years, 4 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/wm/app_list_controller.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/app_list_controller.cc
diff --git a/ash/wm/app_list_controller.cc b/ash/wm/app_list_controller.cc
index 99a0a653f5cef246b6f0e6152b4c25c1e57be1a2..7e60edc5bbdf8c71f2ab4061ddf9d28b8a0b68cc 100644
--- a/ash/wm/app_list_controller.cc
+++ b/ash/wm/app_list_controller.cc
@@ -173,11 +173,11 @@ AppListController::~AppListController() {
Shell::GetInstance()->RemoveShellObserver(this);
}
-void AppListController::SetVisible(bool visible, aura::Window* window) {
- if (visible == is_visible_)
+void AppListController::Show(aura::Window* window) {
+ if (is_visible_)
return;
- is_visible_ = visible;
+ is_visible_ = true;
// App list needs to know the new shelf layout in order to calculate its
// UI layout when AppListView visibility changes.
@@ -185,15 +185,8 @@ void AppListController::SetVisible(bool visible, aura::Window* window) {
UpdateAutoHideState();
if (view_) {
- // Our widget is currently active. When the animation completes we'll hide
- // the widget, changing activation. If a menu is shown before the animation
- // completes then the activation change triggers the menu to close. By
- // deactivating now we ensure there is no activation change when the
- // animation completes and any menus stay open.
- if (!visible)
- view_->GetWidget()->Deactivate();
ScheduleAnimation();
- } else if (is_visible_) {
+ } else {
// AppListModel and AppListViewDelegate are owned by AppListView. They
// will be released with AppListView on close.
app_list::AppListView* view = new app_list::AppListView(
@@ -244,6 +237,35 @@ void AppListController::SetVisible(bool visible, aura::Window* window) {
Shelf::ForWindow(window)->GetAppListButtonView()->SchedulePaint();
}
+void AppListController::Dismiss() {
+ if (!is_visible_)
+ return;
+
+ // If the app list is currently visible, there should be an existing view.
+ DCHECK(view_);
+
+ is_visible_ = false;
+
+ // App list needs to know the new shelf layout in order to calculate its
+ // UI layout when AppListView visibility changes.
+ Shell::GetPrimaryRootWindowController()
+ ->GetShelfLayoutManager()
+ ->UpdateAutoHideState();
+
+ // Our widget is currently active. When the animation completes we'll hide
+ // the widget, changing activation. If a menu is shown before the animation
+ // completes then the activation change triggers the menu to close. By
+ // deactivating now we ensure there is no activation change when the
+ // animation completes and any menus stay open.
+ view_->GetWidget()->Deactivate();
+ ScheduleAnimation();
+
+ // Update applist button status when app list visibility is changed.
+ Shelf::ForWindow(view_->GetWidget()->GetNativeView())
+ ->GetAppListButtonView()
+ ->SchedulePaint();
+}
+
bool AppListController::IsVisible() const {
return view_ && view_->GetWidget()->IsVisible();
}
@@ -354,7 +376,7 @@ void AppListController::ProcessLocatedEvent(ui::LocatedEvent* event) {
aura::Window* window = view_->GetWidget()->GetNativeView()->parent();
if (!window->Contains(target))
- SetVisible(false, window);
+ Dismiss();
}
void AppListController::UpdateBounds() {
@@ -392,7 +414,7 @@ void AppListController::OnWindowFocused(aura::Window* gained_focus,
if (applist_container->Contains(lost_focus) &&
(!gained_focus || !applist_container->Contains(gained_focus))) {
- SetVisible(false, applist_window);
+ Dismiss();
}
}
}
@@ -421,7 +443,7 @@ void AppListController::OnImplicitAnimationsCompleted() {
void AppListController::OnWidgetDestroying(views::Widget* widget) {
DCHECK(view_->GetWidget() == widget);
if (is_visible_)
- SetVisible(false, widget->GetNativeView());
+ Dismiss();
ResetView();
}
« no previous file with comments | « ash/wm/app_list_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698