OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ash/wm/panels/panel_window_event_handler.h" | 5 #include "ash/wm/panels/panel_window_event_handler.h" |
6 | 6 |
7 #include "ui/aura/client/aura_constants.h" | 7 #include "ui/aura/client/aura_constants.h" |
8 #include "ui/aura/window.h" | 8 #include "ui/aura/window.h" |
9 #include "ui/aura/window_delegate.h" | 9 #include "ui/aura/window_delegate.h" |
10 #include "ui/base/events/event.h" | 10 #include "ui/base/events/event.h" |
11 #include "ui/base/hit_test.h" | 11 #include "ui/base/hit_test.h" |
12 | 12 |
13 namespace ash { | 13 namespace ash { |
14 namespace internal { | 14 namespace internal { |
15 | 15 |
16 PanelWindowEventHandler::PanelWindowEventHandler(aura::Window* owner) | 16 PanelWindowEventHandler::PanelWindowEventHandler(aura::Window* owner) |
17 : ToplevelWindowEventHandler(owner) { | 17 : ToplevelWindowEventHandler(owner) { |
18 } | 18 } |
19 | 19 |
20 PanelWindowEventHandler::~PanelWindowEventHandler() { | 20 PanelWindowEventHandler::~PanelWindowEventHandler() { |
21 } | 21 } |
22 | 22 |
23 void PanelWindowEventHandler::OnMouseEvent(ui::MouseEvent* event) { | 23 void PanelWindowEventHandler::OnMouseEvent(ui::MouseEvent* event) { |
24 aura::Window* target = static_cast<aura::Window*>(event->target()); | 24 aura::Window* target = static_cast<aura::Window*>(event->target()); |
25 if (event->type() == ui::ET_MOUSE_PRESSED && | 25 if (event->type() == ui::ET_MOUSE_PRESSED && |
26 event->flags() & ui::EF_IS_DOUBLE_CLICK && | 26 event->flags() & ui::EF_IS_DOUBLE_CLICK && |
| 27 event->IsOnlyLeftMouseButton() && |
27 target->delegate()->GetNonClientComponent(event->location()) == | 28 target->delegate()->GetNonClientComponent(event->location()) == |
28 HTCAPTION) { | 29 HTCAPTION) { |
29 target->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); | 30 target->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); |
30 return; | 31 return; |
31 } | 32 } |
32 ToplevelWindowEventHandler::OnMouseEvent(event); | 33 ToplevelWindowEventHandler::OnMouseEvent(event); |
33 } | 34 } |
34 | 35 |
35 void PanelWindowEventHandler::OnGestureEvent(ui::GestureEvent* event) { | 36 void PanelWindowEventHandler::OnGestureEvent(ui::GestureEvent* event) { |
36 aura::Window* target = static_cast<aura::Window*>(event->target()); | 37 aura::Window* target = static_cast<aura::Window*>(event->target()); |
37 if (event->type() == ui::ET_GESTURE_TAP && | 38 if (event->type() == ui::ET_GESTURE_TAP && |
38 event->details().tap_count() == 2 && | 39 event->details().tap_count() == 2 && |
39 target->delegate()->GetNonClientComponent(event->location()) == | 40 target->delegate()->GetNonClientComponent(event->location()) == |
40 HTCAPTION) { | 41 HTCAPTION) { |
41 target->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); | 42 target->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_MINIMIZED); |
42 event->StopPropagation(); | 43 event->StopPropagation(); |
43 return; | 44 return; |
44 } | 45 } |
45 ToplevelWindowEventHandler::OnGestureEvent(event); | 46 ToplevelWindowEventHandler::OnGestureEvent(event); |
46 } | 47 } |
47 | 48 |
48 } // namespace internal | 49 } // namespace internal |
49 } // namespace ash | 50 } // namespace ash |
OLD | NEW |