diff options
author | mazda@chromium.org <mazda@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-22 05:08:30 +0000 |
---|---|---|
committer | mazda@chromium.org <mazda@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-22 05:08:30 +0000 |
commit | 745816be61e207da7cef1f839591bfb35bd15fd3 (patch) | |
tree | 60828cb9a38973d9bce185f4013437d58b5dbd82 /ui/aura | |
parent | 0f83a23a4d149948d5d5135468fb820bcf7cd543 (diff) | |
download | chromium_src-745816be61e207da7cef1f839591bfb35bd15fd3.zip chromium_src-745816be61e207da7cef1f839591bfb35bd15fd3.tar.gz chromium_src-745816be61e207da7cef1f839591bfb35bd15fd3.tar.bz2 |
Add ShellAcceleratorController that manages global keyboard accelerators.
- Create ShellAcceleratorController that manages global keyboard accelerators and also processes several accelerators as a target.
- Create ShellAcceleratorFilter, which is used by DesktopEventFilter to handle accelerators.
- Add a function to Shell for accessing ShellAcceleratorController.
The 1st attempt (http://crrev.com/110637) broke aura_shell_unittests and this fixes it.
The differences are
- moving ShellAcceleratorFilter to Shell from DesktopEventFilter, and
- adding the ShellAcceleratorFilter in Shell initialization code to DesktopEventFilter.
BUG=97255
TEST=Manual, aura_shell_unittests succeeds.
Review URL: http://codereview.chromium.org/8561012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111100 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/aura')
-rw-r--r-- | ui/aura/desktop.cc | 61 | ||||
-rw-r--r-- | ui/aura/desktop.h | 5 |
2 files changed, 11 insertions, 55 deletions
diff --git a/ui/aura/desktop.cc b/ui/aura/desktop.cc index 74b5e4e..056490b 100644 --- a/ui/aura/desktop.cc +++ b/ui/aura/desktop.cc @@ -26,10 +26,7 @@ #include "ui/base/hit_test.h" #include "ui/gfx/compositor/compositor.h" #include "ui/gfx/compositor/layer.h" -#include "ui/gfx/compositor/layer_animation_sequence.h" #include "ui/gfx/compositor/layer_animator.h" -#include "ui/gfx/compositor/screen_rotation.h" -#include "ui/gfx/interpolated_transform.h" #ifdef USE_WEBKIT_COMPOSITOR #include "ui/gfx/compositor/compositor_cc.h" @@ -99,50 +96,6 @@ void GetEventFiltersToNotify(Window* target, EventFilters* filters) { } } -#if !defined(NDEBUG) -bool MaybeFullScreen(DesktopHost* host, KeyEvent* event) { - if (event->key_code() == ui::VKEY_F11) { - host->ToggleFullScreen(); - return true; - } - return false; -} - -bool MaybeRotate(Desktop* desktop, KeyEvent* event) { - if ((event->flags() & ui::EF_CONTROL_DOWN) && - event->key_code() == ui::VKEY_HOME) { - static int i = 0; - int delta = 0; - switch (i) { - case 0: delta = 90; break; - case 1: delta = 90; break; - case 2: delta = 90; break; - case 3: delta = 90; break; - case 4: delta = -90; break; - case 5: delta = -90; break; - case 6: delta = -90; break; - case 7: delta = -90; break; - case 8: delta = -90; break; - case 9: delta = 180; break; - case 10: delta = 180; break; - case 11: delta = 90; break; - case 12: delta = 180; break; - case 13: delta = 180; break; - } - i = (i + 1) % 14; - desktop->layer()->GetAnimator()->set_preemption_strategy( - ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); - scoped_ptr<ui::LayerAnimationSequence> screen_rotation( - new ui::LayerAnimationSequence(new ui::ScreenRotation(delta))); - screen_rotation->AddObserver(desktop); - desktop->layer()->GetAnimator()->ScheduleAnimation( - screen_rotation.release()); - return true; - } - return false; -} -#endif - } // namespace Desktop* Desktop::instance_ = NULL; @@ -285,14 +238,6 @@ bool Desktop::DispatchMouseEvent(MouseEvent* event) { } bool Desktop::DispatchKeyEvent(KeyEvent* event) { -#if !defined(NDEBUG) - // TODO(beng): replace this hack with global keyboard event handlers. - if (event->type() == ui::ET_KEY_PRESSED) { - if (MaybeFullScreen(host_.get(), event) || MaybeRotate(this, event)) - return true; - } -#endif - if (focused_window_) { KeyEvent translated_event(*event); return ProcessKeyEvent(focused_window_, &translated_event); @@ -470,6 +415,12 @@ void Desktop::SetTransform(const ui::Transform& transform) { OnHostResized(host_->GetSize()); } +#if !defined(NDEBUG) +void Desktop::ToggleFullScreen() { + host_->ToggleFullScreen(); +} +#endif + void Desktop::HandleMouseMoved(const MouseEvent& event, Window* target) { if (target == mouse_moved_handler_) return; diff --git a/ui/aura/desktop.h b/ui/aura/desktop.h index 3f27d4b..7e8d0dc 100644 --- a/ui/aura/desktop.h +++ b/ui/aura/desktop.h @@ -142,6 +142,11 @@ class AURA_EXPORT Desktop : public ui::CompositorDelegate, // Overridden from Window: virtual void SetTransform(const ui::Transform& transform) OVERRIDE; +#if !defined(NDEBUG) + // Toggles the host's full screen state. + void ToggleFullScreen(); +#endif + private: // Called whenever the mouse moves, tracks the current |mouse_moved_handler_|, // sending exited and entered events as its value changes. |