OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/shelf/shelf_layout_manager.h" | 5 #include "ash/shelf/shelf_layout_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 } | 140 } |
141 | 141 |
142 // ShelfLayoutManager ---------------------------------------------------------- | 142 // ShelfLayoutManager ---------------------------------------------------------- |
143 | 143 |
144 ShelfLayoutManager::ShelfLayoutManager(ShelfWidget* shelf_widget, Shelf* shelf) | 144 ShelfLayoutManager::ShelfLayoutManager(ShelfWidget* shelf_widget, Shelf* shelf) |
145 : updating_bounds_(false), | 145 : updating_bounds_(false), |
146 shelf_widget_(shelf_widget), | 146 shelf_widget_(shelf_widget), |
147 shelf_(shelf), | 147 shelf_(shelf), |
148 window_overlaps_shelf_(false), | 148 window_overlaps_shelf_(false), |
149 mouse_over_shelf_when_auto_hide_timer_started_(false), | 149 mouse_over_shelf_when_auto_hide_timer_started_(false), |
| 150 is_fullscreen_app_list_enabled_( |
| 151 app_list::features::IsFullscreenAppListEnabled()), |
150 gesture_drag_status_(GESTURE_DRAG_NONE), | 152 gesture_drag_status_(GESTURE_DRAG_NONE), |
151 gesture_drag_amount_(0.f), | 153 gesture_drag_amount_(0.f), |
152 gesture_drag_auto_hide_state_(SHELF_AUTO_HIDE_SHOWN), | 154 gesture_drag_auto_hide_state_(SHELF_AUTO_HIDE_SHOWN), |
153 update_shelf_observer_(nullptr), | 155 update_shelf_observer_(nullptr), |
154 chromevox_panel_height_(0), | 156 chromevox_panel_height_(0), |
155 duration_override_in_ms_(0), | 157 duration_override_in_ms_(0), |
156 shelf_background_type_(SHELF_BACKGROUND_OVERLAP), | 158 shelf_background_type_(SHELF_BACKGROUND_OVERLAP), |
157 keyboard_observer_(this), | 159 keyboard_observer_(this), |
158 scoped_session_observer_(this) { | 160 scoped_session_observer_(this) { |
159 DCHECK(shelf_widget_); | 161 DCHECK(shelf_widget_); |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 activated, root_window, shelf_widget_->GetNativeWindow()->GetRootWindow(), | 427 activated, root_window, shelf_widget_->GetNativeWindow()->GetRootWindow(), |
426 &keyboard_observer_); | 428 &keyboard_observer_); |
427 } | 429 } |
428 | 430 |
429 void ShelfLayoutManager::OnAppListVisibilityChanged(bool shown, | 431 void ShelfLayoutManager::OnAppListVisibilityChanged(bool shown, |
430 aura::Window* root_window) { | 432 aura::Window* root_window) { |
431 if (shelf_ != Shelf::ForWindow(root_window)) | 433 if (shelf_ != Shelf::ForWindow(root_window)) |
432 return; | 434 return; |
433 | 435 |
434 is_app_list_visible_ = shown; | 436 is_app_list_visible_ = shown; |
435 if (app_list::features::IsFullscreenAppListEnabled()) | 437 if (is_fullscreen_app_list_enabled_) |
436 MaybeUpdateShelfBackground(AnimationChangeType::IMMEDIATE); | 438 MaybeUpdateShelfBackground(AnimationChangeType::IMMEDIATE); |
437 } | 439 } |
438 | 440 |
439 void ShelfLayoutManager::OnWindowActivated(ActivationReason reason, | 441 void ShelfLayoutManager::OnWindowActivated(ActivationReason reason, |
440 aura::Window* gained_active, | 442 aura::Window* gained_active, |
441 aura::Window* lost_active) { | 443 aura::Window* lost_active) { |
442 UpdateAutoHideStateNow(); | 444 UpdateAutoHideStateNow(); |
443 } | 445 } |
444 | 446 |
445 void ShelfLayoutManager::OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) { | 447 void ShelfLayoutManager::OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) { |
(...skipping 26 matching lines...) Expand all Loading... |
472 } | 474 } |
473 | 475 |
474 ShelfBackgroundType ShelfLayoutManager::GetShelfBackgroundType() const { | 476 ShelfBackgroundType ShelfLayoutManager::GetShelfBackgroundType() const { |
475 if (state_.pre_lock_screen_animation_active) | 477 if (state_.pre_lock_screen_animation_active) |
476 return SHELF_BACKGROUND_DEFAULT; | 478 return SHELF_BACKGROUND_DEFAULT; |
477 | 479 |
478 // Handle all non active screen states, including OOBE and pre-login. | 480 // Handle all non active screen states, including OOBE and pre-login. |
479 if (state_.session_state != session_manager::SessionState::ACTIVE) | 481 if (state_.session_state != session_manager::SessionState::ACTIVE) |
480 return SHELF_BACKGROUND_OVERLAP; | 482 return SHELF_BACKGROUND_OVERLAP; |
481 | 483 |
| 484 // If the app list is active and the shelf is oriented vertically, enable the |
| 485 // shelf background. |
| 486 if (is_app_list_visible_ && !shelf_->IsHorizontalAlignment() && |
| 487 is_fullscreen_app_list_enabled_) |
| 488 return SHELF_BACKGROUND_OVERLAP; |
| 489 |
482 // If the app list is active, hide the shelf background to prevent overlap. | 490 // If the app list is active, hide the shelf background to prevent overlap. |
483 if (is_app_list_visible_ && app_list::features::IsFullscreenAppListEnabled()) | 491 if (is_app_list_visible_ && is_fullscreen_app_list_enabled_) |
484 return SHELF_BACKGROUND_DEFAULT; | 492 return SHELF_BACKGROUND_DEFAULT; |
485 | 493 |
486 if (state_.visibility_state != SHELF_AUTO_HIDE && | 494 if (state_.visibility_state != SHELF_AUTO_HIDE && |
487 state_.window_state == wm::WORKSPACE_WINDOW_STATE_MAXIMIZED) { | 495 state_.window_state == wm::WORKSPACE_WINDOW_STATE_MAXIMIZED) { |
488 return SHELF_BACKGROUND_MAXIMIZED; | 496 return SHELF_BACKGROUND_MAXIMIZED; |
489 } | 497 } |
490 | 498 |
491 if (gesture_drag_status_ == GESTURE_DRAG_IN_PROGRESS || | 499 if (gesture_drag_status_ == GESTURE_DRAG_IN_PROGRESS || |
492 window_overlaps_shelf_ || state_.visibility_state == SHELF_AUTO_HIDE) { | 500 window_overlaps_shelf_ || state_.visibility_state == SHELF_AUTO_HIDE) { |
493 return SHELF_BACKGROUND_OVERLAP; | 501 return SHELF_BACKGROUND_OVERLAP; |
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1163 return gesture_drag_amount_ < 0; | 1171 return gesture_drag_amount_ < 0; |
1164 case SHELF_ALIGNMENT_LEFT: | 1172 case SHELF_ALIGNMENT_LEFT: |
1165 if (gesture_drag_auto_hide_state_ == SHELF_AUTO_HIDE_SHOWN) | 1173 if (gesture_drag_auto_hide_state_ == SHELF_AUTO_HIDE_SHOWN) |
1166 return gesture_drag_amount_ < 0; | 1174 return gesture_drag_amount_ < 0; |
1167 return gesture_drag_amount_ > 0; | 1175 return gesture_drag_amount_ > 0; |
1168 } | 1176 } |
1169 return false; | 1177 return false; |
1170 } | 1178 } |
1171 | 1179 |
1172 } // namespace ash | 1180 } // namespace ash |
OLD | NEW |