| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/workspace/workspace_event_handler.h" | 5 #include "ash/wm/workspace/workspace_event_handler.h" |
| 6 | 6 |
| 7 #include "ash/aura/wm_window_aura.h" | 7 #include "ash/aura/wm_window_aura.h" |
| 8 #include "ash/common/wm/window_state.h" | 8 #include "ash/common/wm/window_state.h" |
| 9 #include "ash/common/wm/wm_event.h" | 9 #include "ash/common/wm/wm_event.h" |
| 10 #include "ash/common/wm_shell.h" | 10 #include "ash/common/wm_shell.h" |
| 11 #include "ash/common/wm_window.h" | 11 #include "ash/common/wm_window.h" |
| 12 #include "ash/touch/touch_uma.h" | |
| 13 #include "ash/wm/window_state_aura.h" | 12 #include "ash/wm/window_state_aura.h" |
| 14 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
| 15 #include "ui/aura/window_delegate.h" | 14 #include "ui/aura/window_delegate.h" |
| 16 #include "ui/base/hit_test.h" | 15 #include "ui/base/hit_test.h" |
| 16 #include "ui/events/event.h" |
| 17 | 17 |
| 18 namespace ash { | 18 namespace ash { |
| 19 | 19 |
| 20 WorkspaceEventHandler::WorkspaceEventHandler() : click_component_(HTNOWHERE) {} | 20 WorkspaceEventHandler::WorkspaceEventHandler() : click_component_(HTNOWHERE) {} |
| 21 | 21 |
| 22 WorkspaceEventHandler::~WorkspaceEventHandler() {} | 22 WorkspaceEventHandler::~WorkspaceEventHandler() {} |
| 23 | 23 |
| 24 void WorkspaceEventHandler::OnMouseEvent(ui::MouseEvent* event) { | 24 void WorkspaceEventHandler::OnMouseEvent(ui::MouseEvent* event) { |
| 25 aura::Window* target = static_cast<aura::Window*>(event->target()); | 25 aura::Window* target = static_cast<aura::Window*>(event->target()); |
| 26 if (event->type() == ui::ET_MOUSE_PRESSED && event->IsOnlyLeftMouseButton() && | 26 if (event->type() == ui::ET_MOUSE_PRESSED && event->IsOnlyLeftMouseButton() && |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 80 |
| 81 aura::Window* target = static_cast<aura::Window*>(event->target()); | 81 aura::Window* target = static_cast<aura::Window*>(event->target()); |
| 82 int previous_target_component = click_component_; | 82 int previous_target_component = click_component_; |
| 83 click_component_ = | 83 click_component_ = |
| 84 target->delegate()->GetNonClientComponent(event->location()); | 84 target->delegate()->GetNonClientComponent(event->location()); |
| 85 | 85 |
| 86 if (click_component_ != HTCAPTION) | 86 if (click_component_ != HTCAPTION) |
| 87 return; | 87 return; |
| 88 | 88 |
| 89 if (event->details().tap_count() != 2) { | 89 if (event->details().tap_count() != 2) { |
| 90 TouchUMA::GetInstance()->RecordGestureAction( | 90 WmShell::Get()->RecordGestureAction(GESTURE_FRAMEVIEW_TAP); |
| 91 TouchUMA::GESTURE_FRAMEVIEW_TAP); | |
| 92 return; | 91 return; |
| 93 } | 92 } |
| 94 | 93 |
| 95 if (click_component_ == previous_target_component) { | 94 if (click_component_ == previous_target_component) { |
| 96 WmShell::Get()->RecordUserMetricsAction( | 95 WmShell::Get()->RecordUserMetricsAction( |
| 97 UMA_TOGGLE_MAXIMIZE_CAPTION_GESTURE); | 96 UMA_TOGGLE_MAXIMIZE_CAPTION_GESTURE); |
| 98 TouchUMA::GetInstance()->RecordGestureAction( | 97 WmShell::Get()->RecordGestureAction(GESTURE_MAXIMIZE_DOUBLETAP); |
| 99 TouchUMA::GESTURE_MAXIMIZE_DOUBLETAP); | |
| 100 const wm::WMEvent wm_event(wm::WM_EVENT_TOGGLE_MAXIMIZE_CAPTION); | 98 const wm::WMEvent wm_event(wm::WM_EVENT_TOGGLE_MAXIMIZE_CAPTION); |
| 101 wm::GetWindowState(target)->OnWMEvent(&wm_event); | 99 wm::GetWindowState(target)->OnWMEvent(&wm_event); |
| 102 event->StopPropagation(); | 100 event->StopPropagation(); |
| 103 } | 101 } |
| 104 click_component_ = HTNOWHERE; | 102 click_component_ = HTNOWHERE; |
| 105 } | 103 } |
| 106 | 104 |
| 107 void WorkspaceEventHandler::HandleVerticalResizeDoubleClick( | 105 void WorkspaceEventHandler::HandleVerticalResizeDoubleClick( |
| 108 wm::WindowState* target_state, | 106 wm::WindowState* target_state, |
| 109 ui::MouseEvent* event) { | 107 ui::MouseEvent* event) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 120 WmShell::Get()->RecordUserMetricsAction( | 118 WmShell::Get()->RecordUserMetricsAction( |
| 121 UMA_TOGGLE_SINGLE_AXIS_MAXIMIZE_BORDER_CLICK); | 119 UMA_TOGGLE_SINGLE_AXIS_MAXIMIZE_BORDER_CLICK); |
| 122 const wm::WMEvent wm_event(wm::WM_EVENT_TOGGLE_HORIZONTAL_MAXIMIZE); | 120 const wm::WMEvent wm_event(wm::WM_EVENT_TOGGLE_HORIZONTAL_MAXIMIZE); |
| 123 target_state->OnWMEvent(&wm_event); | 121 target_state->OnWMEvent(&wm_event); |
| 124 event->StopPropagation(); | 122 event->StopPropagation(); |
| 125 } | 123 } |
| 126 } | 124 } |
| 127 } | 125 } |
| 128 | 126 |
| 129 } // namespace ash | 127 } // namespace ash |
| OLD | NEW |