summaryrefslogtreecommitdiffstats
path: root/ui/aura
diff options
context:
space:
mode:
authormazda@chromium.org <mazda@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-18 02:09:41 +0000
committermazda@chromium.org <mazda@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-18 02:09:41 +0000
commitdbe7138364c5d04bf89bc9ba628e994961ba5966 (patch)
treea06233a6dc42ba050fa866d9edf37a591eaac17c /ui/aura
parent62e3e655880d37c2a1d5babb551c60d78d0f7ccf (diff)
downloadchromium_src-dbe7138364c5d04bf89bc9ba628e994961ba5966.zip
chromium_src-dbe7138364c5d04bf89bc9ba628e994961ba5966.tar.gz
chromium_src-dbe7138364c5d04bf89bc9ba628e994961ba5966.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. BUG=97255 TEST=Manual Review URL: http://codereview.chromium.org/8465021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110637 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/aura')
-rw-r--r--ui/aura/desktop.cc61
-rw-r--r--ui/aura/desktop.h5
2 files changed, 11 insertions, 55 deletions
diff --git a/ui/aura/desktop.cc b/ui/aura/desktop.cc
index dab97c7..cb4fbdb 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"
using std::string;
using std::vector;
@@ -95,50 +92,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;
@@ -274,14 +227,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);
@@ -451,6 +396,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 10e7f64..eab2531 100644
--- a/ui/aura/desktop.h
+++ b/ui/aura/desktop.h
@@ -136,6 +136,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.