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 | 9 |
10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
289 if (Shell::GetInstance()->session_state_delegate()->IsScreenLocked()) { | 289 if (Shell::GetInstance()->session_state_delegate()->IsScreenLocked()) { |
290 SetState(SHELF_VISIBLE); | 290 SetState(SHELF_VISIBLE); |
291 } else if (gesture_drag_status_ == GESTURE_DRAG_COMPLETE_IN_PROGRESS) { | 291 } else if (gesture_drag_status_ == GESTURE_DRAG_COMPLETE_IN_PROGRESS) { |
292 // TODO(zelidrag): Verify shelf drag animation still shows on the device | 292 // TODO(zelidrag): Verify shelf drag animation still shows on the device |
293 // when we are in SHELF_AUTO_HIDE_ALWAYS_HIDDEN. | 293 // when we are in SHELF_AUTO_HIDE_ALWAYS_HIDDEN. |
294 SetState(CalculateShelfVisibilityWhileDragging()); | 294 SetState(CalculateShelfVisibilityWhileDragging()); |
295 } else { | 295 } else { |
296 WorkspaceWindowState window_state(workspace_controller_->GetWindowState()); | 296 WorkspaceWindowState window_state(workspace_controller_->GetWindowState()); |
297 switch (window_state) { | 297 switch (window_state) { |
298 case WORKSPACE_WINDOW_STATE_FULL_SCREEN: | 298 case WORKSPACE_WINDOW_STATE_FULL_SCREEN: |
299 { | 299 if (IsInImmersiveMode()) { |
300 aura::Window* fullscreen_window = | |
301 GetRootWindowController(root_window_)->GetFullscreenWindow(); | |
302 if (fullscreen_window->GetProperty(kFullscreenUsesMinimalChromeKey)) { | |
303 DCHECK_NE(auto_hide_behavior_, SHELF_AUTO_HIDE_ALWAYS_HIDDEN); | |
304 SetState(SHELF_AUTO_HIDE); | 300 SetState(SHELF_AUTO_HIDE); |
305 } else { | 301 } else { |
306 SetState(SHELF_HIDDEN); | 302 SetState(SHELF_HIDDEN); |
307 } | 303 } |
308 break; | 304 break; |
309 } | |
310 case WORKSPACE_WINDOW_STATE_MAXIMIZED: | 305 case WORKSPACE_WINDOW_STATE_MAXIMIZED: |
311 SetState(CalculateShelfVisibility()); | 306 SetState(CalculateShelfVisibility()); |
312 break; | 307 break; |
313 | |
314 case WORKSPACE_WINDOW_STATE_WINDOW_OVERLAPS_SHELF: | 308 case WORKSPACE_WINDOW_STATE_WINDOW_OVERLAPS_SHELF: |
315 case WORKSPACE_WINDOW_STATE_DEFAULT: | 309 case WORKSPACE_WINDOW_STATE_DEFAULT: |
316 SetState(CalculateShelfVisibility()); | 310 SetState(CalculateShelfVisibility()); |
317 SetWindowOverlapsShelf(window_state == | 311 SetWindowOverlapsShelf(window_state == |
318 WORKSPACE_WINDOW_STATE_WINDOW_OVERLAPS_SHELF); | 312 WORKSPACE_WINDOW_STATE_WINDOW_OVERLAPS_SHELF); |
319 break; | 313 break; |
320 } | 314 } |
321 } | 315 } |
322 } | 316 } |
323 | 317 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
433 gesture.details().velocity_y() > 0); | 427 gesture.details().velocity_y() > 0); |
434 } | 428 } |
435 } else { | 429 } else { |
436 NOTREACHED(); | 430 NOTREACHED(); |
437 } | 431 } |
438 | 432 |
439 if (!should_change) { | 433 if (!should_change) { |
440 CancelGestureDrag(); | 434 CancelGestureDrag(); |
441 return; | 435 return; |
442 } | 436 } |
443 | 437 if (shelf_) |
438 shelf_->Deactivate(); | |
439 shelf_->status_area_widget()->Deactivate(); | |
James Cook
2013/05/22 12:04:22
Won't this line crash is shelf_ is NULL? Either y
rharrison
2013/05/22 20:20:02
Done.
| |
444 gesture_drag_auto_hide_state_ = | 440 gesture_drag_auto_hide_state_ = |
445 gesture_drag_auto_hide_state_ == SHELF_AUTO_HIDE_SHOWN ? | 441 gesture_drag_auto_hide_state_ == SHELF_AUTO_HIDE_SHOWN ? |
446 SHELF_AUTO_HIDE_HIDDEN : SHELF_AUTO_HIDE_SHOWN; | 442 SHELF_AUTO_HIDE_HIDDEN : SHELF_AUTO_HIDE_SHOWN; |
447 if (shelf_) | |
448 shelf_->Deactivate(); | |
449 shelf_->status_area_widget()->Deactivate(); | |
450 if (gesture_drag_auto_hide_state_ == SHELF_AUTO_HIDE_HIDDEN && | 443 if (gesture_drag_auto_hide_state_ == SHELF_AUTO_HIDE_HIDDEN && |
451 auto_hide_behavior_ != SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS) { | 444 auto_hide_behavior_ != SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS) { |
452 gesture_drag_status_ = GESTURE_DRAG_NONE; | 445 gesture_drag_status_ = GESTURE_DRAG_NONE; |
453 SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | 446 if (!IsInImmersiveMode()) { |
447 SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | |
448 } else { | |
449 UpdateVisibilityState(); | |
450 } | |
454 } else if (gesture_drag_auto_hide_state_ == SHELF_AUTO_HIDE_SHOWN && | 451 } else if (gesture_drag_auto_hide_state_ == SHELF_AUTO_HIDE_SHOWN && |
455 auto_hide_behavior_ != SHELF_AUTO_HIDE_BEHAVIOR_NEVER) { | 452 auto_hide_behavior_ != SHELF_AUTO_HIDE_BEHAVIOR_NEVER) { |
456 gesture_drag_status_ = GESTURE_DRAG_NONE; | 453 gesture_drag_status_ = GESTURE_DRAG_NONE; |
457 SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); | 454 SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); |
458 } else { | 455 } else { |
459 gesture_drag_status_ = GESTURE_DRAG_COMPLETE_IN_PROGRESS; | 456 gesture_drag_status_ = GESTURE_DRAG_COMPLETE_IN_PROGRESS; |
460 UpdateVisibilityState(); | 457 UpdateVisibilityState(); |
461 gesture_drag_status_ = GESTURE_DRAG_NONE; | 458 gesture_drag_status_ = GESTURE_DRAG_NONE; |
462 } | 459 } |
463 LayoutShelf(); | 460 LayoutShelf(); |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
953 return gfx::Insets(0, 0, 0, distance); | 950 return gfx::Insets(0, 0, 0, distance); |
954 case SHELF_ALIGNMENT_RIGHT: | 951 case SHELF_ALIGNMENT_RIGHT: |
955 return gfx::Insets(0, distance, 0, 0); | 952 return gfx::Insets(0, distance, 0, 0); |
956 case SHELF_ALIGNMENT_TOP: | 953 case SHELF_ALIGNMENT_TOP: |
957 return gfx::Insets(0, 0, distance, 0); | 954 return gfx::Insets(0, 0, distance, 0); |
958 } | 955 } |
959 NOTREACHED(); | 956 NOTREACHED(); |
960 return gfx::Insets(); | 957 return gfx::Insets(); |
961 } | 958 } |
962 | 959 |
960 bool ShelfLayoutManager::IsInImmersiveMode() const { | |
961 RootWindowController* controller = GetRootWindowController(root_window_); | |
962 if (!controller) | |
963 return false; | |
964 aura::Window* window = controller->GetFullscreenWindow(); | |
965 if (!window) | |
966 return false; | |
967 if (!window->GetProperty(kFullscreenUsesMinimalChromeKey)) | |
968 return false; | |
969 return true; | |
970 } | |
971 | |
972 | |
963 } // namespace internal | 973 } // namespace internal |
964 } // namespace ash | 974 } // namespace ash |
OLD | NEW |