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

Unified Diff: ui/aura/desktop.cc

Issue 8602003: Revert 110637 - Add ShellAcceleratorController that manages global keyboard accelerators. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 1 month 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
« no previous file with comments | « ui/aura/desktop.h ('k') | ui/aura_shell/aura_shell.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/desktop.cc
===================================================================
--- ui/aura/desktop.cc (revision 110642)
+++ ui/aura/desktop.cc (working copy)
@@ -26,7 +26,10 @@
#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;
@@ -92,6 +95,50 @@
}
}
+#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;
@@ -227,6 +274,14 @@
}
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);
@@ -396,12 +451,6 @@
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;
« no previous file with comments | « ui/aura/desktop.h ('k') | ui/aura_shell/aura_shell.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698