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

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: Remove OS_WIN ifdefs. 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 void ShelfLayoutManager::OnGestureEdgeSwipe(const ui::GestureEvent& gesture) {
395 // Edge swipe should exit fullscreen, show the tray, and disable auto-hide.
396
397 if (workspace_controller_->GetWindowState() ==
398 WORKSPACE_WINDOW_STATE_FULL_SCREEN) {
399 const std::vector<aura::Window*> windows =
400 ash::MruWindowTracker::BuildWindowList(false);
401
402 for (size_t i = 0; i < windows.size(); ++i) {
403 if (windows[i] && windows[i]->IsVisible() &&
404 root_window_ == windows[i]->GetRootWindow()) {
405 wm::WindowState* window_state = wm::GetWindowState(windows[i]);
406 if (window_state->IsFullscreen())
407 window_state->ToggleFullscreen();
408 }
409 }
410 }
sadrul 2014/02/11 21:20:48 Can you use accelerators::ToggleFullscreen() (or s
zturner 2014/02/11 21:30:57 Yes, thank you. This should make the code much cl
411
412 ShelfVisibilityState visibility = CalculateShelfVisibility();
413 if (visibility == SHELF_AUTO_HIDE &&
414 CalculateAutoHideState(visibility) == SHELF_AUTO_HIDE_HIDDEN) {
415 SetState(SHELF_VISIBLE);
416 SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER);
417 }
418 }
393 419
394 void ShelfLayoutManager::StartGestureDrag(const ui::GestureEvent& gesture) { 420 void ShelfLayoutManager::StartGestureDrag(const ui::GestureEvent& gesture) {
395 gesture_drag_status_ = GESTURE_DRAG_IN_PROGRESS; 421 gesture_drag_status_ = GESTURE_DRAG_IN_PROGRESS;
396 gesture_drag_amount_ = 0.f; 422 gesture_drag_amount_ = 0.f;
397 gesture_drag_auto_hide_state_ = visibility_state() == SHELF_AUTO_HIDE ? 423 gesture_drag_auto_hide_state_ = visibility_state() == SHELF_AUTO_HIDE ?
398 auto_hide_state() : SHELF_AUTO_HIDE_SHOWN; 424 auto_hide_state() : SHELF_AUTO_HIDE_SHOWN;
399 UpdateShelfBackground(BACKGROUND_CHANGE_ANIMATE); 425 UpdateShelfBackground(BACKGROUND_CHANGE_ANIMATE);
400 } 426 }
401 427
402 ShelfLayoutManager::DragState ShelfLayoutManager::UpdateGestureDrag( 428 ShelfLayoutManager::DragState ShelfLayoutManager::UpdateGestureDrag(
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 return gfx::Insets(0, distance, 0, 0); 1176 return gfx::Insets(0, distance, 0, 0);
1151 case SHELF_ALIGNMENT_TOP: 1177 case SHELF_ALIGNMENT_TOP:
1152 return gfx::Insets(0, 0, distance, 0); 1178 return gfx::Insets(0, 0, distance, 0);
1153 } 1179 }
1154 NOTREACHED(); 1180 NOTREACHED();
1155 return gfx::Insets(); 1181 return gfx::Insets();
1156 } 1182 }
1157 1183
1158 } // namespace internal 1184 } // namespace internal
1159 } // namespace ash 1185 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698