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

Side by Side Diff: ash/shelf/shelf_layout_manager.cc

Issue 14740012: Enable shelf gestures in immersive mode (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changed method name as requested and removed code duplication Created 7 years, 7 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/shelf/shelf_layout_manager.h ('k') | ash/wm/gestures/shelf_gesture_handler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 if (Shell::GetInstance()->session_state_delegate()->IsScreenLocked()) { 287 if (Shell::GetInstance()->session_state_delegate()->IsScreenLocked()) {
288 SetState(SHELF_VISIBLE); 288 SetState(SHELF_VISIBLE);
289 } else if (gesture_drag_status_ == GESTURE_DRAG_COMPLETE_IN_PROGRESS) { 289 } else if (gesture_drag_status_ == GESTURE_DRAG_COMPLETE_IN_PROGRESS) {
290 // TODO(zelidrag): Verify shelf drag animation still shows on the device 290 // TODO(zelidrag): Verify shelf drag animation still shows on the device
291 // when we are in SHELF_AUTO_HIDE_ALWAYS_HIDDEN. 291 // when we are in SHELF_AUTO_HIDE_ALWAYS_HIDDEN.
292 SetState(CalculateShelfVisibilityWhileDragging()); 292 SetState(CalculateShelfVisibilityWhileDragging());
293 } else { 293 } else {
294 WorkspaceWindowState window_state(workspace_controller_->GetWindowState()); 294 WorkspaceWindowState window_state(workspace_controller_->GetWindowState());
295 switch (window_state) { 295 switch (window_state) {
296 case WORKSPACE_WINDOW_STATE_FULL_SCREEN: 296 case WORKSPACE_WINDOW_STATE_FULL_SCREEN:
297 { 297 if (FullscreenWithMinimalChrome()) {
298 aura::Window* fullscreen_window =
299 GetRootWindowController(root_window_)->GetFullscreenWindow();
300 if (fullscreen_window->GetProperty(kFullscreenUsesMinimalChromeKey)) {
301 DCHECK_NE(auto_hide_behavior_, SHELF_AUTO_HIDE_ALWAYS_HIDDEN);
302 SetState(SHELF_AUTO_HIDE); 298 SetState(SHELF_AUTO_HIDE);
303 } else { 299 } else {
304 SetState(SHELF_HIDDEN); 300 SetState(SHELF_HIDDEN);
305 } 301 }
306 break; 302 break;
307 }
308 case WORKSPACE_WINDOW_STATE_MAXIMIZED: 303 case WORKSPACE_WINDOW_STATE_MAXIMIZED:
309 SetState(CalculateShelfVisibility()); 304 SetState(CalculateShelfVisibility());
310 break; 305 break;
311
312 case WORKSPACE_WINDOW_STATE_WINDOW_OVERLAPS_SHELF: 306 case WORKSPACE_WINDOW_STATE_WINDOW_OVERLAPS_SHELF:
313 case WORKSPACE_WINDOW_STATE_DEFAULT: 307 case WORKSPACE_WINDOW_STATE_DEFAULT:
314 SetState(CalculateShelfVisibility()); 308 SetState(CalculateShelfVisibility());
315 SetWindowOverlapsShelf(window_state == 309 SetWindowOverlapsShelf(window_state ==
316 WORKSPACE_WINDOW_STATE_WINDOW_OVERLAPS_SHELF); 310 WORKSPACE_WINDOW_STATE_WINDOW_OVERLAPS_SHELF);
317 break; 311 break;
318 } 312 }
319 } 313 }
320 } 314 }
321 315
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 gesture.details().velocity_y() > 0); 425 gesture.details().velocity_y() > 0);
432 } 426 }
433 } else { 427 } else {
434 NOTREACHED(); 428 NOTREACHED();
435 } 429 }
436 430
437 if (!should_change) { 431 if (!should_change) {
438 CancelGestureDrag(); 432 CancelGestureDrag();
439 return; 433 return;
440 } 434 }
441 435 if (shelf_) {
436 shelf_->Deactivate();
437 shelf_->status_area_widget()->Deactivate();
438 }
442 gesture_drag_auto_hide_state_ = 439 gesture_drag_auto_hide_state_ =
443 gesture_drag_auto_hide_state_ == SHELF_AUTO_HIDE_SHOWN ? 440 gesture_drag_auto_hide_state_ == SHELF_AUTO_HIDE_SHOWN ?
444 SHELF_AUTO_HIDE_HIDDEN : SHELF_AUTO_HIDE_SHOWN; 441 SHELF_AUTO_HIDE_HIDDEN : SHELF_AUTO_HIDE_SHOWN;
445 if (shelf_)
446 shelf_->Deactivate();
447 shelf_->status_area_widget()->Deactivate();
448 if (gesture_drag_auto_hide_state_ == SHELF_AUTO_HIDE_HIDDEN && 442 if (gesture_drag_auto_hide_state_ == SHELF_AUTO_HIDE_HIDDEN &&
449 auto_hide_behavior_ != SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS) { 443 auto_hide_behavior_ != SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS) {
450 gesture_drag_status_ = GESTURE_DRAG_NONE; 444 gesture_drag_status_ = GESTURE_DRAG_NONE;
451 SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); 445 if (!FullscreenWithMinimalChrome()) {
446 SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
447 } else {
448 UpdateVisibilityState();
449 }
452 } else if (gesture_drag_auto_hide_state_ == SHELF_AUTO_HIDE_SHOWN && 450 } else if (gesture_drag_auto_hide_state_ == SHELF_AUTO_HIDE_SHOWN &&
453 auto_hide_behavior_ != SHELF_AUTO_HIDE_BEHAVIOR_NEVER) { 451 auto_hide_behavior_ != SHELF_AUTO_HIDE_BEHAVIOR_NEVER) {
454 gesture_drag_status_ = GESTURE_DRAG_NONE; 452 gesture_drag_status_ = GESTURE_DRAG_NONE;
455 SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); 453 SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
456 } else { 454 } else {
457 gesture_drag_status_ = GESTURE_DRAG_COMPLETE_IN_PROGRESS; 455 gesture_drag_status_ = GESTURE_DRAG_COMPLETE_IN_PROGRESS;
458 UpdateVisibilityState(); 456 UpdateVisibilityState();
459 gesture_drag_status_ = GESTURE_DRAG_NONE; 457 gesture_drag_status_ = GESTURE_DRAG_NONE;
460 } 458 }
461 LayoutShelf(); 459 LayoutShelf();
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 void ShelfLayoutManager::OnWindowActivated(aura::Window* gained_active, 508 void ShelfLayoutManager::OnWindowActivated(aura::Window* gained_active,
511 aura::Window* lost_active) { 509 aura::Window* lost_active) {
512 UpdateAutoHideStateNow(); 510 UpdateAutoHideStateNow();
513 } 511 }
514 512
515 bool ShelfLayoutManager::IsHorizontalAlignment() const { 513 bool ShelfLayoutManager::IsHorizontalAlignment() const {
516 return alignment_ == SHELF_ALIGNMENT_BOTTOM || 514 return alignment_ == SHELF_ALIGNMENT_BOTTOM ||
517 alignment_ == SHELF_ALIGNMENT_TOP; 515 alignment_ == SHELF_ALIGNMENT_TOP;
518 } 516 }
519 517
518 bool ShelfLayoutManager::FullscreenWithMinimalChrome() const {
519 RootWindowController* controller = GetRootWindowController(root_window_);
520 if (!controller)
521 return false;
522 aura::Window* window = controller->GetFullscreenWindow();
523 if (!window)
524 return false;
525 if (!window->GetProperty(kFullscreenUsesMinimalChromeKey))
526 return false;
527 return true;
528 }
529
520 // static 530 // static
521 ShelfLayoutManager* ShelfLayoutManager::ForLauncher(aura::Window* window) { 531 ShelfLayoutManager* ShelfLayoutManager::ForLauncher(aura::Window* window) {
522 ShelfWidget* shelf = RootWindowController::ForLauncher(window)->shelf(); 532 ShelfWidget* shelf = RootWindowController::ForLauncher(window)->shelf();
523 return shelf ? shelf->shelf_layout_manager() : NULL; 533 return shelf ? shelf->shelf_layout_manager() : NULL;
524 } 534 }
525 535
526 //////////////////////////////////////////////////////////////////////////////// 536 ////////////////////////////////////////////////////////////////////////////////
527 // ShelfLayoutManager, private: 537 // ShelfLayoutManager, private:
528 538
529 ShelfLayoutManager::TargetBounds::TargetBounds() : opacity(0.0f) {} 539 ShelfLayoutManager::TargetBounds::TargetBounds() : opacity(0.0f) {}
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
959 return gfx::Insets(0, distance, 0, 0); 969 return gfx::Insets(0, distance, 0, 0);
960 case SHELF_ALIGNMENT_TOP: 970 case SHELF_ALIGNMENT_TOP:
961 return gfx::Insets(0, 0, distance, 0); 971 return gfx::Insets(0, 0, distance, 0);
962 } 972 }
963 NOTREACHED(); 973 NOTREACHED();
964 return gfx::Insets(); 974 return gfx::Insets();
965 } 975 }
966 976
967 } // namespace internal 977 } // namespace internal
968 } // namespace ash 978 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_layout_manager.h ('k') | ash/wm/gestures/shelf_gesture_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698