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

Unified Diff: ash/wm/panels/panel_window_event_handler.cc

Issue 17175019: Add double click and tap handler to minimize attached panels. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 6 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
« no previous file with comments | « ash/wm/panels/panel_window_event_handler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/panels/panel_window_event_handler.cc
diff --git a/ash/wm/panels/panel_window_event_handler.cc b/ash/wm/panels/panel_window_event_handler.cc
new file mode 100644
index 0000000000000000000000000000000000000000..361b464e0f9fe2b90ec7cab180e1efdab9dc1f37
--- /dev/null
+++ b/ash/wm/panels/panel_window_event_handler.cc
@@ -0,0 +1,49 @@
+// Copyright (c) 2013 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/panels/panel_window_event_handler.h"
+
+#include "ui/aura/client/aura_constants.h"
+#include "ui/aura/window.h"
+#include "ui/aura/window_delegate.h"
+#include "ui/base/events/event.h"
+#include "ui/base/hit_test.h"
+
+namespace ash {
+namespace internal {
+
+PanelWindowEventHandler::PanelWindowEventHandler(aura::Window* owner)
+ : ToplevelWindowEventHandler(owner) {
+}
+
+PanelWindowEventHandler::~PanelWindowEventHandler() {
+}
+
+void PanelWindowEventHandler::OnMouseEvent(ui::MouseEvent* event) {
+ aura::Window* target = static_cast<aura::Window*>(event->target());
+ if (event->type() == ui::ET_MOUSE_PRESSED &&
+ event->flags() & ui::EF_IS_DOUBLE_CLICK &&
+ target->delegate()->GetNonClientComponent(event->location()) ==
+ HTCAPTION) {
+ target->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED);
+ return;
+ }
+ ToplevelWindowEventHandler::OnMouseEvent(event);
+}
+
+void PanelWindowEventHandler::OnGestureEvent(ui::GestureEvent* event) {
+ aura::Window* target = static_cast<aura::Window*>(event->target());
+ if (event->type() == ui::ET_GESTURE_TAP &&
+ event->details().tap_count() == 2 &&
+ target->delegate()->GetNonClientComponent(event->location()) ==
+ HTCAPTION) {
+ target->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED);
+ event->StopPropagation();
+ return;
+ }
+ ToplevelWindowEventHandler::OnGestureEvent(event);
+}
+
+} // namespace internal
+} // namespace ash
« no previous file with comments | « ash/wm/panels/panel_window_event_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698