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

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

Issue 143023003: Fully support the autohide shelf option for touch UI on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Compile out edge swipe code on non-Windows, and add tests. Created 6 years, 10 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
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 #include <cstring> 9 #include <cstring>
10 #include <string> 10 #include <string>
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 382
383 void ShelfLayoutManager::AddObserver(ShelfLayoutManagerObserver* observer) { 383 void ShelfLayoutManager::AddObserver(ShelfLayoutManagerObserver* observer) {
384 observers_.AddObserver(observer); 384 observers_.AddObserver(observer);
385 } 385 }
386 386
387 void ShelfLayoutManager::RemoveObserver(ShelfLayoutManagerObserver* observer) { 387 void ShelfLayoutManager::RemoveObserver(ShelfLayoutManagerObserver* observer) {
388 observers_.RemoveObserver(observer); 388 observers_.RemoveObserver(observer);
389 } 389 }
390 390
391 //////////////////////////////////////////////////////////////////////////////// 391 ////////////////////////////////////////////////////////////////////////////////
392 // ShelfLayoutManager, Gesture dragging: 392 // ShelfLayoutManager, Gesture functions:
393
394 #if defined(OS_WIN)
395 void ShelfLayoutManager::OnGestureEdgeSwipe(const ui::GestureEvent& gesture) {
396 // Edge swipe should exit fullscreen, show the tray, and disable auto-hide.
397
398 if (workspace_controller_->GetWindowState() ==
399 WORKSPACE_WINDOW_STATE_FULL_SCREEN) {
400 const std::vector<aura::Window*> windows =
401 ash::MruWindowTracker::BuildWindowList(false);
402
403 for (size_t i = 0; i < windows.size(); ++i) {
404 if (windows[i] && windows[i]->IsVisible() &&
405 root_window_ == windows[i]->GetRootWindow()) {
406 wm::WindowState* window_state = wm::GetWindowState(windows[i]);
407 if (window_state->IsFullscreen())
408 window_state->ToggleFullscreen();
409 }
410 }
411 }
412
413 ShelfVisibilityState visibility = CalculateShelfVisibility();
414 if (visibility == SHELF_AUTO_HIDE &&
415 CalculateAutoHideState(visibility) == SHELF_AUTO_HIDE_HIDDEN) {
416 SetState(SHELF_VISIBLE);
417 SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
418 }
419 }
420 #endif
393 421
394 void ShelfLayoutManager::StartGestureDrag(const ui::GestureEvent& gesture) { 422 void ShelfLayoutManager::StartGestureDrag(const ui::GestureEvent& gesture) {
395 gesture_drag_status_ = GESTURE_DRAG_IN_PROGRESS; 423 gesture_drag_status_ = GESTURE_DRAG_IN_PROGRESS;
396 gesture_drag_amount_ = 0.f; 424 gesture_drag_amount_ = 0.f;
397 gesture_drag_auto_hide_state_ = visibility_state() == SHELF_AUTO_HIDE ? 425 gesture_drag_auto_hide_state_ = visibility_state() == SHELF_AUTO_HIDE ?
398 auto_hide_state() : SHELF_AUTO_HIDE_SHOWN; 426 auto_hide_state() : SHELF_AUTO_HIDE_SHOWN;
399 UpdateShelfBackground(BACKGROUND_CHANGE_ANIMATE); 427 UpdateShelfBackground(BACKGROUND_CHANGE_ANIMATE);
400 } 428 }
401 429
402 ShelfLayoutManager::DragState ShelfLayoutManager::UpdateGestureDrag( 430 ShelfLayoutManager::DragState ShelfLayoutManager::UpdateGestureDrag(
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 return gfx::Insets(0, distance, 0, 0); 1178 return gfx::Insets(0, distance, 0, 0);
1151 case SHELF_ALIGNMENT_TOP: 1179 case SHELF_ALIGNMENT_TOP:
1152 return gfx::Insets(0, 0, distance, 0); 1180 return gfx::Insets(0, 0, distance, 0);
1153 } 1181 }
1154 NOTREACHED(); 1182 NOTREACHED();
1155 return gfx::Insets(); 1183 return gfx::Insets();
1156 } 1184 }
1157 1185
1158 } // namespace internal 1186 } // namespace internal
1159 } // namespace ash 1187 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698