| 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 10 matching lines...) Expand all  Loading... | 
|    21 #include "ash/shell.h" |    21 #include "ash/shell.h" | 
|    22 #include "ash/shell_port.h" |    22 #include "ash/shell_port.h" | 
|    23 #include "ash/system/status_area_widget.h" |    23 #include "ash/system/status_area_widget.h" | 
|    24 #include "ash/wm/fullscreen_window_finder.h" |    24 #include "ash/wm/fullscreen_window_finder.h" | 
|    25 #include "ash/wm/mru_window_tracker.h" |    25 #include "ash/wm/mru_window_tracker.h" | 
|    26 #include "ash/wm/screen_pinning_controller.h" |    26 #include "ash/wm/screen_pinning_controller.h" | 
|    27 #include "ash/wm/window_state.h" |    27 #include "ash/wm/window_state.h" | 
|    28 #include "base/auto_reset.h" |    28 #include "base/auto_reset.h" | 
|    29 #include "base/command_line.h" |    29 #include "base/command_line.h" | 
|    30 #include "base/i18n/rtl.h" |    30 #include "base/i18n/rtl.h" | 
 |    31 #include "ui/app_list/app_list_features.h" | 
|    31 #include "ui/base/ui_base_switches.h" |    32 #include "ui/base/ui_base_switches.h" | 
|    32 #include "ui/compositor/layer.h" |    33 #include "ui/compositor/layer.h" | 
|    33 #include "ui/compositor/layer_animation_observer.h" |    34 #include "ui/compositor/layer_animation_observer.h" | 
|    34 #include "ui/compositor/layer_animator.h" |    35 #include "ui/compositor/layer_animator.h" | 
|    35 #include "ui/compositor/scoped_layer_animation_settings.h" |    36 #include "ui/compositor/scoped_layer_animation_settings.h" | 
|    36 #include "ui/display/display.h" |    37 #include "ui/display/display.h" | 
|    37 #include "ui/display/screen.h" |    38 #include "ui/display/screen.h" | 
|    38 #include "ui/events/event.h" |    39 #include "ui/events/event.h" | 
|    39 #include "ui/events/event_handler.h" |    40 #include "ui/events/event_handler.h" | 
|    40 #include "ui/keyboard/keyboard_controller.h" |    41 #include "ui/keyboard/keyboard_controller.h" | 
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   418 } |   419 } | 
|   419  |   420  | 
|   420 void ShelfLayoutManager::OnVirtualKeyboardStateChanged( |   421 void ShelfLayoutManager::OnVirtualKeyboardStateChanged( | 
|   421     bool activated, |   422     bool activated, | 
|   422     aura::Window* root_window) { |   423     aura::Window* root_window) { | 
|   423   UpdateKeyboardObserverFromStateChanged( |   424   UpdateKeyboardObserverFromStateChanged( | 
|   424       activated, root_window, shelf_widget_->GetNativeWindow()->GetRootWindow(), |   425       activated, root_window, shelf_widget_->GetNativeWindow()->GetRootWindow(), | 
|   425       &keyboard_observer_); |   426       &keyboard_observer_); | 
|   426 } |   427 } | 
|   427  |   428  | 
 |   429 void ShelfLayoutManager::OnAppListVisibilityChanged(bool shown, | 
 |   430                                                     aura::Window* root_window) { | 
 |   431   if (shelf_ != Shelf::ForWindow(root_window)) | 
 |   432     return; | 
 |   433  | 
 |   434   is_app_list_visible_ = shown; | 
 |   435   if (app_list::features::IsFullscreenAppListEnabled()) | 
 |   436     MaybeUpdateShelfBackground(AnimationChangeType::IMMEDIATE); | 
 |   437 } | 
 |   438  | 
|   428 void ShelfLayoutManager::OnWindowActivated(ActivationReason reason, |   439 void ShelfLayoutManager::OnWindowActivated(ActivationReason reason, | 
|   429                                            aura::Window* gained_active, |   440                                            aura::Window* gained_active, | 
|   430                                            aura::Window* lost_active) { |   441                                            aura::Window* lost_active) { | 
|   431   UpdateAutoHideStateNow(); |   442   UpdateAutoHideStateNow(); | 
|   432 } |   443 } | 
|   433  |   444  | 
|   434 void ShelfLayoutManager::OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) { |   445 void ShelfLayoutManager::OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) { | 
|   435   bool keyboard_is_about_to_hide = false; |   446   bool keyboard_is_about_to_hide = false; | 
|   436   if (new_bounds.IsEmpty() && !keyboard_bounds_.IsEmpty()) |   447   if (new_bounds.IsEmpty() && !keyboard_bounds_.IsEmpty()) | 
|   437     keyboard_is_about_to_hide = true; |   448     keyboard_is_about_to_hide = true; | 
| (...skipping 23 matching lines...) Expand all  Loading... | 
|   461 } |   472 } | 
|   462  |   473  | 
|   463 ShelfBackgroundType ShelfLayoutManager::GetShelfBackgroundType() const { |   474 ShelfBackgroundType ShelfLayoutManager::GetShelfBackgroundType() const { | 
|   464   if (state_.pre_lock_screen_animation_active) |   475   if (state_.pre_lock_screen_animation_active) | 
|   465     return SHELF_BACKGROUND_DEFAULT; |   476     return SHELF_BACKGROUND_DEFAULT; | 
|   466  |   477  | 
|   467   // Handle all non active screen states, including OOBE and pre-login. |   478   // Handle all non active screen states, including OOBE and pre-login. | 
|   468   if (state_.session_state != session_manager::SessionState::ACTIVE) |   479   if (state_.session_state != session_manager::SessionState::ACTIVE) | 
|   469     return SHELF_BACKGROUND_OVERLAP; |   480     return SHELF_BACKGROUND_OVERLAP; | 
|   470  |   481  | 
 |   482   // If the app list is active, hide the shelf background to prevent overlap. | 
 |   483   if (is_app_list_visible_ && app_list::features::IsFullscreenAppListEnabled()) | 
 |   484     return SHELF_BACKGROUND_DEFAULT; | 
 |   485  | 
|   471   if (state_.visibility_state != SHELF_AUTO_HIDE && |   486   if (state_.visibility_state != SHELF_AUTO_HIDE && | 
|   472       state_.window_state == wm::WORKSPACE_WINDOW_STATE_MAXIMIZED) { |   487       state_.window_state == wm::WORKSPACE_WINDOW_STATE_MAXIMIZED) { | 
|   473     return SHELF_BACKGROUND_MAXIMIZED; |   488     return SHELF_BACKGROUND_MAXIMIZED; | 
|   474   } |   489   } | 
|   475  |   490  | 
|   476   if (gesture_drag_status_ == GESTURE_DRAG_IN_PROGRESS || |   491   if (gesture_drag_status_ == GESTURE_DRAG_IN_PROGRESS || | 
|   477       window_overlaps_shelf_ || state_.visibility_state == SHELF_AUTO_HIDE) { |   492       window_overlaps_shelf_ || state_.visibility_state == SHELF_AUTO_HIDE) { | 
|   478     return SHELF_BACKGROUND_OVERLAP; |   493     return SHELF_BACKGROUND_OVERLAP; | 
|   479   } |   494   } | 
|   480  |   495  | 
| (...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1148       return gesture_drag_amount_ < 0; |  1163       return gesture_drag_amount_ < 0; | 
|  1149     case SHELF_ALIGNMENT_LEFT: |  1164     case SHELF_ALIGNMENT_LEFT: | 
|  1150       if (gesture_drag_auto_hide_state_ == SHELF_AUTO_HIDE_SHOWN) |  1165       if (gesture_drag_auto_hide_state_ == SHELF_AUTO_HIDE_SHOWN) | 
|  1151         return gesture_drag_amount_ < 0; |  1166         return gesture_drag_amount_ < 0; | 
|  1152       return gesture_drag_amount_ > 0; |  1167       return gesture_drag_amount_ > 0; | 
|  1153   } |  1168   } | 
|  1154   return false; |  1169   return false; | 
|  1155 } |  1170 } | 
|  1156  |  1171  | 
|  1157 }  // namespace ash |  1172 }  // namespace ash | 
| OLD | NEW |