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

Unified Diff: ash/wm/workspace/workspace_cycler.cc

Issue 12212040: Make the workspace cycler animation parameters editable via chrome://gesture (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
Index: ash/wm/workspace/workspace_cycler.cc
diff --git a/ash/wm/workspace/workspace_cycler.cc b/ash/wm/workspace/workspace_cycler.cc
index b75437d2f8652aad59f827939c80573d1938e958..236746483a07425f7cf3ceb3bdbe479d5c6d964a 100644
--- a/ash/wm/workspace/workspace_cycler.cc
+++ b/ash/wm/workspace/workspace_cycler.cc
@@ -7,19 +7,19 @@
#include <cmath>
#include "ash/shell.h"
+#include "ash/wm/workspace/workspace_cycler_configuration.h"
#include "ash/wm/workspace/workspace_manager.h"
#include "base/message_loop.h"
#include "ui/base/events/event.h"
#include "ui/base/events/event_utils.h"
+typedef ash::WorkspaceCyclerConfiguration Config;
+
namespace ash {
namespace internal {
namespace {
-// The required vertical distance to initiate workspace cycling.
-const float kDistanceToInitiateWorkspaceCycling = 10.0f;
-
// Returns true if cycling is allowed.
bool IsCyclingAllowed() {
// Cycling is disabled if the screen is locked or a modal dialog is open.
@@ -116,7 +116,8 @@ void WorkspaceCycler::OnMouseEvent(ui::MouseEvent* event) {
if (event->type() != ui::ET_MOUSEWHEEL)
return;
- if (!IsCyclingAllowed() || !workspace_manager_->CanStartCyclingThroughWorkspaces()) {
+ if (!IsCyclingAllowed() ||
+ !workspace_manager_->CanStartCyclingThroughWorkspaces()) {
CHECK_EQ(NOT_CYCLING, state_);
return;
}
@@ -170,7 +171,10 @@ void WorkspaceCycler::OnScrollEvent(ui::ScrollEvent* event) {
}
if (state_ == NOT_CYCLING_TRACKING_SCROLL) {
- if (fabs(scroll_x_) > kDistanceToInitiateWorkspaceCycling) {
+ double distance_to_initiate_cycling = Config::GetDouble(
+ Config::DISTANCE_TO_INITIATE_CYCLING);
+
+ if (fabs(scroll_x_) > distance_to_initiate_cycling) {
// Only initiate workspace cycling if there recently was a significant
// amount of vertical movement as opposed to vertical movement
// accumulated over a long horizontal three finger scroll.
@@ -178,7 +182,7 @@ void WorkspaceCycler::OnScrollEvent(ui::ScrollEvent* event) {
scroll_y_ = 0.0f;
}
- if (fabs(scroll_y_) >= kDistanceToInitiateWorkspaceCycling)
+ if (fabs(scroll_y_) >= distance_to_initiate_cycling)
SetState(STARTING_CYCLING);
}

Powered by Google App Engine
This is Rietveld 408576698