| 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/wm/shelf_layout_manager.h" | 5 #include "ash/wm/shelf_layout_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
| 11 #include "ash/launcher/launcher.h" | 11 #include "ash/launcher/launcher.h" |
| 12 #include "ash/root_window_controller.h" | 12 #include "ash/root_window_controller.h" |
| 13 #include "ash/screen_ash.h" | 13 #include "ash/screen_ash.h" |
| 14 #include "ash/shell.h" | 14 #include "ash/shell.h" |
| 15 #include "ash/shell_delegate.h" | 15 #include "ash/shell_delegate.h" |
| 16 #include "ash/shell_window_ids.h" | 16 #include "ash/shell_window_ids.h" |
| 17 #include "ash/system/status_area_widget.h" | 17 #include "ash/system/status_area_widget.h" |
| 18 #include "ash/wm/property_util.h" |
| 18 #include "ash/wm/workspace_controller.h" | 19 #include "ash/wm/workspace_controller.h" |
| 19 #include "ash/wm/workspace/workspace_animations.h" | 20 #include "ash/wm/workspace/workspace_animations.h" |
| 20 #include "base/auto_reset.h" | 21 #include "base/auto_reset.h" |
| 21 #include "base/command_line.h" | 22 #include "base/command_line.h" |
| 22 #include "base/i18n/rtl.h" | 23 #include "base/i18n/rtl.h" |
| 23 #include "ui/aura/client/activation_client.h" | 24 #include "ui/aura/client/activation_client.h" |
| 24 #include "ui/aura/root_window.h" | 25 #include "ui/aura/root_window.h" |
| 25 #include "ui/base/events/event.h" | 26 #include "ui/base/events/event.h" |
| 26 #include "ui/base/events/event_handler.h" | 27 #include "ui/base/events/event_handler.h" |
| 27 #include "ui/compositor/layer.h" | 28 #include "ui/compositor/layer.h" |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 root_window_, target_bounds.work_area_insets); | 251 root_window_, target_bounds.work_area_insets); |
| 251 UpdateHitTestBounds(); | 252 UpdateHitTestBounds(); |
| 252 } | 253 } |
| 253 | 254 |
| 254 void ShelfLayoutManager::UpdateVisibilityState() { | 255 void ShelfLayoutManager::UpdateVisibilityState() { |
| 255 ShellDelegate* delegate = Shell::GetInstance()->delegate(); | 256 ShellDelegate* delegate = Shell::GetInstance()->delegate(); |
| 256 if (delegate && delegate->IsScreenLocked()) { | 257 if (delegate && delegate->IsScreenLocked()) { |
| 257 SetState(SHELF_VISIBLE); | 258 SetState(SHELF_VISIBLE); |
| 258 } else if (gesture_drag_status_ == GESTURE_DRAG_COMPLETE_IN_PROGRESS) { | 259 } else if (gesture_drag_status_ == GESTURE_DRAG_COMPLETE_IN_PROGRESS) { |
| 259 SetState(SHELF_AUTO_HIDE); | 260 SetState(SHELF_AUTO_HIDE); |
| 261 } else if (GetRootWindowController(root_window_)->IsImmersiveMode()) { |
| 262 // The user choosing immersive mode indicates he or she wants to maximize |
| 263 // screen real-estate for content, so always auto-hide the shelf. |
| 264 SetState(SHELF_AUTO_HIDE); |
| 260 } else { | 265 } else { |
| 261 WorkspaceWindowState window_state(workspace_controller_->GetWindowState()); | 266 WorkspaceWindowState window_state(workspace_controller_->GetWindowState()); |
| 262 switch (window_state) { | 267 switch (window_state) { |
| 263 case WORKSPACE_WINDOW_STATE_FULL_SCREEN: | 268 case WORKSPACE_WINDOW_STATE_FULL_SCREEN: |
| 264 SetState(SHELF_HIDDEN); | 269 SetState(SHELF_HIDDEN); |
| 265 break; | 270 break; |
| 266 | 271 |
| 267 case WORKSPACE_WINDOW_STATE_MAXIMIZED: | 272 case WORKSPACE_WINDOW_STATE_MAXIMIZED: |
| 268 SetState(auto_hide_behavior_ == SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS ? | 273 SetState(auto_hide_behavior_ == SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS ? |
| 269 SHELF_AUTO_HIDE : SHELF_VISIBLE); | 274 SHELF_AUTO_HIDE : SHELF_VISIBLE); |
| (...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 893 int ShelfLayoutManager::GetWorkAreaSize(const State& state, int size) const { | 898 int ShelfLayoutManager::GetWorkAreaSize(const State& state, int size) const { |
| 894 if (state.visibility_state == SHELF_VISIBLE) | 899 if (state.visibility_state == SHELF_VISIBLE) |
| 895 return size; | 900 return size; |
| 896 if (state.visibility_state == SHELF_AUTO_HIDE) | 901 if (state.visibility_state == SHELF_AUTO_HIDE) |
| 897 return kAutoHideSize; | 902 return kAutoHideSize; |
| 898 return 0; | 903 return 0; |
| 899 } | 904 } |
| 900 | 905 |
| 901 } // namespace internal | 906 } // namespace internal |
| 902 } // namespace ash | 907 } // namespace ash |
| OLD | NEW |