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

Unified Diff: ash/common/shelf/shelf_layout_manager.cc

Issue 2534953006: Fix shelf auto-hide calculation for app-list visibility. (Closed)
Patch Set: Address comments. Created 4 years 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/common/shelf/app_list_button.cc ('k') | ash/common/shelf/shelf_widget.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/shelf/shelf_layout_manager.cc
diff --git a/ash/common/shelf/shelf_layout_manager.cc b/ash/common/shelf/shelf_layout_manager.cc
index d48defb892990c74294342ddb4d8a63858b95a4d..4c4c91722ac6683bf49b2c7a85b0367da86f3ed9 100644
--- a/ash/common/shelf/shelf_layout_manager.cc
+++ b/ash/common/shelf/shelf_layout_manager.cc
@@ -71,6 +71,13 @@ ui::Layer* GetLayer(views::Widget* widget) {
return widget->GetNativeView()->layer();
}
+// Returns true if the window is in the app list window container.
+bool IsAppListWindow(WmWindow* window) {
+ return window->GetParent() &&
+ window->GetParent()->GetShellWindowId() ==
+ kShellWindowId_AppListContainer;
+}
+
} // namespace
// ShelfLayoutManager::UpdateShelfObserver -------------------------------------
@@ -830,18 +837,8 @@ ShelfAutoHideState ShelfLayoutManager::CalculateAutoHideState(
if (visibility_state != SHELF_AUTO_HIDE || !wm_shelf_->IsShelfInitialized())
return SHELF_AUTO_HIDE_HIDDEN;
- const int64_t shelf_display_id = WmLookup::Get()
- ->GetWindowForWidget(shelf_widget_)
- ->GetDisplayNearestWindow()
- .id();
-
- // Unhide the shelf only on the active screen when the AppList is shown
- // (crbug.com/312445).
- if (WmShell::Get()->GetAppListTargetVisibility()) {
- WmWindow* window = WmShell::Get()->GetActiveWindow();
- if (window && window->GetDisplayNearestWindow().id() == shelf_display_id)
- return SHELF_AUTO_HIDE_SHOWN;
- }
+ if (shelf_widget_->IsShowingAppList())
+ return SHELF_AUTO_HIDE_SHOWN;
if (shelf_widget_->status_area_widget() &&
shelf_widget_->status_area_widget()->ShouldShowShelf())
@@ -858,13 +855,17 @@ ShelfAutoHideState ShelfLayoutManager::CalculateAutoHideState(
shelf_widget_->status_area_widget()->IsActive()))
return SHELF_AUTO_HIDE_SHOWN;
+ const int64_t shelf_display_id = WmLookup::Get()
+ ->GetWindowForWidget(shelf_widget_)
+ ->GetDisplayNearestWindow()
+ .id();
const std::vector<WmWindow*> windows =
WmShell::Get()->mru_window_tracker()->BuildWindowListIgnoreModal();
-
// Process the window list and check if there are any visible windows.
+ // Ignore app list windows that may be animating to hide after dismissal.
bool visible_window = false;
for (size_t i = 0; i < windows.size(); ++i) {
- if (windows[i] && windows[i]->IsVisible() &&
+ if (windows[i] && windows[i]->IsVisible() && !IsAppListWindow(windows[i]) &&
!windows[i]->GetWindowState()->IsMinimized() &&
windows[i]->GetDisplayNearestWindow().id() == shelf_display_id) {
visible_window = true;
« no previous file with comments | « ash/common/shelf/app_list_button.cc ('k') | ash/common/shelf/shelf_widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698