summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authorjamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-21 04:57:25 +0000
committerjamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-21 04:57:25 +0000
commitf84f3278a5a73897502eb14e567d801cff84bf78 (patch)
tree6fba3bd0d63ebca6aa7fd0ad04f2a043c2d0ff7a /ash
parentb620c5f33c2c7603a074093660892571585aa0d5 (diff)
downloadchromium_src-f84f3278a5a73897502eb14e567d801cff84bf78.zip
chromium_src-f84f3278a5a73897502eb14e567d801cff84bf78.tar.gz
chromium_src-f84f3278a5a73897502eb14e567d801cff84bf78.tar.bz2
Only slow window animations on shift-click on size control
Our previous approach was to slow layer animations whenever the shift key was held down. This caused problems with shift-clicking on a link to open a page in a new window and also with some shortcuts (like Shift-Esc to open task manager). I'm reverting to the initial behavior of this feature, which is to only slow down window animations for debugging when you shift-click on a window control. BUG=133246 TEST=manual, ash_unittests Review URL: https://chromiumcodereview.appspot.com/10815020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@147774 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r--ash/ash.gyp3
-rw-r--r--ash/shell.cc5
-rw-r--r--ash/shell.h4
-rw-r--r--ash/wm/slow_animation_event_filter.cc57
-rw-r--r--ash/wm/slow_animation_event_filter.h47
-rw-r--r--ash/wm/slow_animation_event_filter_unittest.cc54
6 files changed, 0 insertions, 170 deletions
diff --git a/ash/ash.gyp b/ash/ash.gyp
index 6e1fb89..2fa664a 100644
--- a/ash/ash.gyp
+++ b/ash/ash.gyp
@@ -272,8 +272,6 @@
'wm/shelf_layout_manager.cc',
'wm/shelf_layout_manager.h',
'wm/shelf_types.h',
- 'wm/slow_animation_event_filter.cc',
- 'wm/slow_animation_event_filter.h',
'wm/stacking_controller.cc',
'wm/stacking_controller.h',
'wm/status_area_layout_manager.cc',
@@ -433,7 +431,6 @@
'wm/screen_dimmer_unittest.cc',
'wm/shadow_controller_unittest.cc',
'wm/shelf_layout_manager_unittest.cc',
- 'wm/slow_animation_event_filter_unittest.cc',
'wm/system_gesture_event_filter_unittest.cc',
'wm/system_modal_container_layout_manager_unittest.cc',
'wm/toplevel_window_event_filter_unittest.cc',
diff --git a/ash/shell.cc b/ash/shell.cc
index 9663ff9..2faa90c 100644
--- a/ash/shell.cc
+++ b/ash/shell.cc
@@ -49,7 +49,6 @@
#include "ash/wm/screen_dimmer.h"
#include "ash/wm/shadow_controller.h"
#include "ash/wm/shelf_layout_manager.h"
-#include "ash/wm/slow_animation_event_filter.h"
#include "ash/wm/stacking_controller.h"
#include "ash/wm/status_area_layout_manager.h"
#include "ash/wm/system_gesture_event_filter.h"
@@ -211,7 +210,6 @@ Shell::~Shell() {
if (mouse_cursor_filter_.get())
RemoveEnvEventFilter(mouse_cursor_filter_.get());
RemoveEnvEventFilter(system_gesture_filter_.get());
- RemoveEnvEventFilter(slow_animation_filter_.get());
#if !defined(OS_MACOSX)
RemoveEnvEventFilter(accelerator_filter_.get());
#endif
@@ -414,9 +412,6 @@ void Shell::Init() {
system_gesture_filter_.reset(new internal::SystemGestureEventFilter);
AddEnvEventFilter(system_gesture_filter_.get());
- slow_animation_filter_.reset(new internal::SlowAnimationEventFilter);
- AddEnvEventFilter(slow_animation_filter_.get());
-
capture_controller_.reset(new internal::CaptureController);
internal::RootWindowController* root_window_controller =
diff --git a/ash/shell.h b/ash/shell.h
index be066b6..c074ffc 100644
--- a/ash/shell.h
+++ b/ash/shell.h
@@ -462,10 +462,6 @@ class ASH_EXPORT Shell : aura::CursorDelegate {
// a heads-up display. This is enabled only if --ash-touch-hud flag is used.
scoped_ptr<internal::TouchObserverHUD> touch_observer_hud_;
- // An event filter that looks for modifier keypresses and triggers a slowdown
- // of layer animations for visual debugging.
- scoped_ptr<internal::SlowAnimationEventFilter> slow_animation_filter_;
-
#if defined(OS_CHROMEOS)
// Controls video output device state.
scoped_ptr<chromeos::OutputConfigurator> output_configurator_;
diff --git a/ash/wm/slow_animation_event_filter.cc b/ash/wm/slow_animation_event_filter.cc
deleted file mode 100644
index 52befbf..0000000
--- a/ash/wm/slow_animation_event_filter.cc
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ash/wm/slow_animation_event_filter.h"
-
-#include "ui/aura/event.h"
-#include "ui/compositor/layer_animator.h"
-
-namespace ash {
-namespace internal {
-
-SlowAnimationEventFilter::SlowAnimationEventFilter() {}
-
-SlowAnimationEventFilter::~SlowAnimationEventFilter() {}
-
-//////////////////////////////////////////////////////////////////////////////
-// Overridden from aura::EventFilter:
-bool SlowAnimationEventFilter::PreHandleKeyEvent(aura::Window* target,
- aura::KeyEvent* event) {
- // We only want to trigger "slow animation" mode if the shift key is down,
- // no other modifier key is down, and the user isn't typing something like
- // Ctrl-Shift-W to close all windows. Therefore we trigger the mode when
- // the last key press was exactly "shift key down" and otherwise clear it.
- ui::LayerAnimator::set_slow_animation_mode(IsUnmodifiedShiftPressed(event));
- // Let event processing continue.
- return false;
-}
-
-bool SlowAnimationEventFilter::PreHandleMouseEvent(aura::Window* target,
- aura::MouseEvent* event) {
- return false; // Not handled.
-}
-
-ui::TouchStatus SlowAnimationEventFilter::PreHandleTouchEvent(
- aura::Window* target,
- aura::TouchEvent* event) {
- return ui::TOUCH_STATUS_UNKNOWN; // Not handled.
-}
-
-ui::GestureStatus SlowAnimationEventFilter::PreHandleGestureEvent(
- aura::Window* target,
- aura::GestureEvent* event) {
- return ui::GESTURE_STATUS_UNKNOWN; // Not handled.
-}
-
-// Exists as a separate function for testing.
-bool SlowAnimationEventFilter::IsUnmodifiedShiftPressed(
- aura::KeyEvent* event) const {
- return event->type() == ui::ET_KEY_PRESSED &&
- event->key_code() == ui::VKEY_SHIFT &&
- !event->IsControlDown() &&
- !event->IsAltDown();
-}
-
-} // namespace internal
-} // namespace ash
diff --git a/ash/wm/slow_animation_event_filter.h b/ash/wm/slow_animation_event_filter.h
deleted file mode 100644
index b45c787..0000000
--- a/ash/wm/slow_animation_event_filter.h
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef ASH_WM_SLOW_ANIMATION_EVENT_FILTER_H_
-#define ASH_WM_SLOW_ANIMATION_EVENT_FILTER_H_
-
-#include "ash/ash_export.h"
-#include "base/compiler_specific.h"
-#include "base/gtest_prod_util.h"
-#include "ui/aura/event_filter.h"
-
-namespace ash {
-namespace internal {
-
-// An event filter to detect modifier key presses and trigger a special "slow
-// animation" mode for visual debugging of layer animations.
-// Exported for unit tests.
-class ASH_EXPORT SlowAnimationEventFilter : public aura::EventFilter {
- public:
- SlowAnimationEventFilter();
- virtual ~SlowAnimationEventFilter();
-
- // Overridden from aura::EventFilter:
- virtual bool PreHandleKeyEvent(aura::Window* target,
- aura::KeyEvent* event) OVERRIDE;
- virtual bool PreHandleMouseEvent(aura::Window* target,
- aura::MouseEvent* event) OVERRIDE;
- virtual ui::TouchStatus PreHandleTouchEvent(aura::Window* target,
- aura::TouchEvent* event) OVERRIDE;
- virtual ui::GestureStatus PreHandleGestureEvent(
- aura::Window* target,
- aura::GestureEvent* event) OVERRIDE;
-
- private:
- FRIEND_TEST_ALL_PREFIXES(SlowAnimationEventFilterTest, Basics);
-
- // Returns true if this is a raw shift-key-pressed event.
- bool IsUnmodifiedShiftPressed(aura::KeyEvent* event) const;
-
- DISALLOW_COPY_AND_ASSIGN(SlowAnimationEventFilter);
-};
-
-} // namespace internal
-} // namespace ash
-
-#endif // ASH_WM_SLOW_ANIMATION_EVENT_FILTER_H_
diff --git a/ash/wm/slow_animation_event_filter_unittest.cc b/ash/wm/slow_animation_event_filter_unittest.cc
deleted file mode 100644
index a373cbd..0000000
--- a/ash/wm/slow_animation_event_filter_unittest.cc
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ash/wm/slow_animation_event_filter.h"
-
-#include "testing/gtest/include/gtest/gtest.h"
-#include "ui/aura/event.h"
-
-using aura::KeyEvent;
-
-namespace ash {
-namespace internal {
-
-typedef testing::Test SlowAnimationEventFilterTest;
-
-TEST_F(SlowAnimationEventFilterTest, Basics) {
- SlowAnimationEventFilter filter;
-
- // Raw shift key press.
- KeyEvent shift_pressed(ui::ET_KEY_PRESSED, ui::VKEY_SHIFT, ui::EF_NONE);
- EXPECT_TRUE(filter.IsUnmodifiedShiftPressed(&shift_pressed));
-
- // Raw shift key release.
- KeyEvent shift_released(ui::ET_KEY_RELEASED,
- ui::VKEY_SHIFT,
- ui::EF_SHIFT_DOWN);
- EXPECT_FALSE(filter.IsUnmodifiedShiftPressed(&shift_released));
-
- // Regular key press.
- KeyEvent a_pressed(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::EF_NONE);
- EXPECT_FALSE(filter.IsUnmodifiedShiftPressed(&a_pressed));
-
- // Shifted regular key press.
- KeyEvent shift_a_pressed(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::EF_SHIFT_DOWN);
- EXPECT_FALSE(filter.IsUnmodifiedShiftPressed(&shift_a_pressed));
-
- // Control then shift.
- KeyEvent control_shift(ui::ET_KEY_PRESSED,
- ui::VKEY_SHIFT,
- ui::EF_CONTROL_DOWN);
- EXPECT_FALSE(filter.IsUnmodifiedShiftPressed(&control_shift));
-
- // The key handler always returns false, because we want these keys to be
- // processed by the rest of the system.
- EXPECT_FALSE(filter.PreHandleKeyEvent(NULL, &shift_pressed));
- EXPECT_FALSE(filter.PreHandleKeyEvent(NULL, &shift_released));
- EXPECT_FALSE(filter.PreHandleKeyEvent(NULL, &a_pressed));
- EXPECT_FALSE(filter.PreHandleKeyEvent(NULL, &shift_a_pressed));
- EXPECT_FALSE(filter.PreHandleKeyEvent(NULL, &control_shift));
-}
-
-} // namespace internal
-} // namespace ash