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
3 // found in the LICENSE file.
5 #include "ash/wm/panels/panel_window_event_handler.h"
7 #include "ui/aura/client/aura_constants.h"
8 #include "ui/aura/window.h"
9 #include "ui/aura/window_delegate.h"
10 #include "ui/base/events/event.h"
11 #include "ui/base/hit_test.h"
16 PanelWindowEventHandler::PanelWindowEventHandler(aura::Window
* owner
)
17 : ToplevelWindowEventHandler(owner
) {
20 PanelWindowEventHandler::~PanelWindowEventHandler() {
23 void PanelWindowEventHandler::OnMouseEvent(ui::MouseEvent
* event
) {
24 aura::Window
* target
= static_cast<aura::Window
*>(event
->target());
25 if (event
->type() == ui::ET_MOUSE_PRESSED
&&
26 event
->flags() & ui::EF_IS_DOUBLE_CLICK
&&
27 event
->IsOnlyLeftMouseButton() &&
28 target
->delegate()->GetNonClientComponent(event
->location()) ==
30 target
->SetProperty(aura::client::kShowStateKey
, ui::SHOW_STATE_MINIMIZED
);
33 ToplevelWindowEventHandler::OnMouseEvent(event
);
36 void PanelWindowEventHandler::OnGestureEvent(ui::GestureEvent
* event
) {
37 aura::Window
* target
= static_cast<aura::Window
*>(event
->target());
38 if (event
->type() == ui::ET_GESTURE_TAP
&&
39 event
->details().tap_count() == 2 &&
40 target
->delegate()->GetNonClientComponent(event
->location()) ==
42 target
->SetProperty(aura::client::kShowStateKey
, ui::SHOW_STATE_MINIMIZED
);
43 event
->StopPropagation();
46 ToplevelWindowEventHandler::OnGestureEvent(event
);
49 } // namespace internal