Chromium Code Reviews| 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 "ash/wm/window_state.h" | 7 #include "ash/wm/window_state.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/hit_test.h" | 10 #include "ui/base/hit_test.h" |
| 11 #include "ui/events/event.h" | 11 #include "ui/events/event.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() { |
| 17 : ToplevelWindowEventHandler(owner) { | |
| 18 } | 17 } |
| 19 | 18 |
| 20 PanelWindowEventHandler::~PanelWindowEventHandler() { | 19 PanelWindowEventHandler::~PanelWindowEventHandler() { |
| 21 } | 20 } |
| 22 | 21 |
| 23 void PanelWindowEventHandler::OnMouseEvent(ui::MouseEvent* event) { | 22 void PanelWindowEventHandler::OnMouseEvent(ui::MouseEvent* event) { |
| 24 aura::Window* target = static_cast<aura::Window*>(event->target()); | 23 aura::Window* target = static_cast<aura::Window*>(event->target()); |
| 25 if (event->type() == ui::ET_MOUSE_PRESSED && | 24 if (event->type() == ui::ET_MOUSE_PRESSED && |
| 26 event->flags() & ui::EF_IS_DOUBLE_CLICK && | 25 event->flags() & ui::EF_IS_DOUBLE_CLICK && |
|
varkha
2013/12/13 04:05:14
Do we know if this way of minimizing panels is pop
pkotwicz
2013/12/13 20:28:42
Added some UMA stats. With the UMA stats hopefully
| |
| 27 event->IsOnlyLeftMouseButton() && | 26 event->IsOnlyLeftMouseButton() && |
| 28 target->delegate()->GetNonClientComponent(event->location()) == | 27 target->delegate()->GetNonClientComponent(event->location()) == |
| 29 HTCAPTION) { | 28 HTCAPTION) { |
| 30 wm::GetWindowState(target)->Minimize(); | 29 wm::GetWindowState(target)->Minimize(); |
| 30 event->StopPropagation(); | |
| 31 return; | 31 return; |
| 32 } | 32 } |
| 33 ToplevelWindowEventHandler::OnMouseEvent(event); | |
| 34 } | 33 } |
| 35 | 34 |
| 36 void PanelWindowEventHandler::OnGestureEvent(ui::GestureEvent* event) { | 35 void PanelWindowEventHandler::OnGestureEvent(ui::GestureEvent* event) { |
| 37 aura::Window* target = static_cast<aura::Window*>(event->target()); | 36 aura::Window* target = static_cast<aura::Window*>(event->target()); |
| 38 if (event->type() == ui::ET_GESTURE_TAP && | 37 if (event->type() == ui::ET_GESTURE_TAP && |
| 39 event->details().tap_count() == 2 && | 38 event->details().tap_count() == 2 && |
| 40 target->delegate()->GetNonClientComponent(event->location()) == | 39 target->delegate()->GetNonClientComponent(event->location()) == |
| 41 HTCAPTION) { | 40 HTCAPTION) { |
| 42 wm::GetWindowState(target)->Minimize(); | 41 wm::GetWindowState(target)->Minimize(); |
| 43 event->StopPropagation(); | 42 event->StopPropagation(); |
| 44 return; | 43 return; |
| 45 } | 44 } |
| 46 ToplevelWindowEventHandler::OnGestureEvent(event); | |
| 47 } | 45 } |
| 48 | 46 |
| 49 } // namespace internal | 47 } // namespace internal |
| 50 } // namespace ash | 48 } // namespace ash |
| OLD | NEW |