| 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_window.h" | 11 #include "ash/common/wm_window.h" |
| 11 #include "ash/metrics/user_metrics_recorder.h" | |
| 12 #include "ash/shell.h" | |
| 13 #include "ash/touch/touch_uma.h" | 12 #include "ash/touch/touch_uma.h" |
| 14 #include "ash/wm/window_state_aura.h" | 13 #include "ash/wm/window_state_aura.h" |
| 15 #include "ui/aura/window.h" | 14 #include "ui/aura/window.h" |
| 16 #include "ui/aura/window_delegate.h" | 15 #include "ui/aura/window_delegate.h" |
| 17 #include "ui/base/hit_test.h" | 16 #include "ui/base/hit_test.h" |
| 18 | 17 |
| 19 namespace ash { | 18 namespace ash { |
| 20 | 19 |
| 21 WorkspaceEventHandler::WorkspaceEventHandler() | 20 WorkspaceEventHandler::WorkspaceEventHandler() |
| 22 : click_component_(HTNOWHERE) { | 21 : click_component_(HTNOWHERE) { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 53 break; | 52 break; |
| 54 case ui::ET_MOUSE_PRESSED: { | 53 case ui::ET_MOUSE_PRESSED: { |
| 55 wm::WindowState* target_state = wm::GetWindowState(target); | 54 wm::WindowState* target_state = wm::GetWindowState(target); |
| 56 | 55 |
| 57 if (event->IsOnlyLeftMouseButton()) { | 56 if (event->IsOnlyLeftMouseButton()) { |
| 58 if (event->flags() & ui::EF_IS_DOUBLE_CLICK) { | 57 if (event->flags() & ui::EF_IS_DOUBLE_CLICK) { |
| 59 int component = target->delegate()-> | 58 int component = target->delegate()-> |
| 60 GetNonClientComponent(event->location()); | 59 GetNonClientComponent(event->location()); |
| 61 if (component == HTCAPTION && | 60 if (component == HTCAPTION && |
| 62 component == click_component_) { | 61 component == click_component_) { |
| 63 ash::Shell::GetInstance()->metrics()->RecordUserMetricsAction( | 62 WmShell::Get()->RecordUserMetricsAction( |
| 64 ash::UMA_TOGGLE_MAXIMIZE_CAPTION_CLICK); | 63 UMA_TOGGLE_MAXIMIZE_CAPTION_CLICK); |
| 65 const wm::WMEvent wm_event(wm::WM_EVENT_TOGGLE_MAXIMIZE_CAPTION); | 64 const wm::WMEvent wm_event(wm::WM_EVENT_TOGGLE_MAXIMIZE_CAPTION); |
| 66 target_state->OnWMEvent(&wm_event); | 65 target_state->OnWMEvent(&wm_event); |
| 67 event->StopPropagation(); | 66 event->StopPropagation(); |
| 68 } | 67 } |
| 69 click_component_ = HTNOWHERE; | 68 click_component_ = HTNOWHERE; |
| 70 } | 69 } |
| 71 } else { | 70 } else { |
| 72 click_component_ = HTNOWHERE; | 71 click_component_ = HTNOWHERE; |
| 73 } | 72 } |
| 74 | 73 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 92 if (click_component_ != HTCAPTION) | 91 if (click_component_ != HTCAPTION) |
| 93 return; | 92 return; |
| 94 | 93 |
| 95 if (event->details().tap_count() != 2) { | 94 if (event->details().tap_count() != 2) { |
| 96 TouchUMA::GetInstance()-> | 95 TouchUMA::GetInstance()-> |
| 97 RecordGestureAction(TouchUMA::GESTURE_FRAMEVIEW_TAP); | 96 RecordGestureAction(TouchUMA::GESTURE_FRAMEVIEW_TAP); |
| 98 return; | 97 return; |
| 99 } | 98 } |
| 100 | 99 |
| 101 if (click_component_ == previous_target_component) { | 100 if (click_component_ == previous_target_component) { |
| 102 ash::Shell::GetInstance()->metrics()->RecordUserMetricsAction( | 101 WmShell::Get()->RecordUserMetricsAction( |
| 103 ash::UMA_TOGGLE_MAXIMIZE_CAPTION_GESTURE); | 102 UMA_TOGGLE_MAXIMIZE_CAPTION_GESTURE); |
| 104 TouchUMA::GetInstance()->RecordGestureAction( | 103 TouchUMA::GetInstance()->RecordGestureAction( |
| 105 TouchUMA::GESTURE_MAXIMIZE_DOUBLETAP); | 104 TouchUMA::GESTURE_MAXIMIZE_DOUBLETAP); |
| 106 const wm::WMEvent wm_event(wm::WM_EVENT_TOGGLE_MAXIMIZE_CAPTION); | 105 const wm::WMEvent wm_event(wm::WM_EVENT_TOGGLE_MAXIMIZE_CAPTION); |
| 107 wm::GetWindowState(target)->OnWMEvent(&wm_event); | 106 wm::GetWindowState(target)->OnWMEvent(&wm_event); |
| 108 event->StopPropagation(); | 107 event->StopPropagation(); |
| 109 } | 108 } |
| 110 click_component_ = HTNOWHERE; | 109 click_component_ = HTNOWHERE; |
| 111 } | 110 } |
| 112 | 111 |
| 113 void WorkspaceEventHandler::HandleVerticalResizeDoubleClick( | 112 void WorkspaceEventHandler::HandleVerticalResizeDoubleClick( |
| 114 wm::WindowState* target_state, | 113 wm::WindowState* target_state, |
| 115 ui::MouseEvent* event) { | 114 ui::MouseEvent* event) { |
| 116 WmWindow* target = target_state->window(); | 115 WmWindow* target = target_state->window(); |
| 117 if (event->flags() & ui::EF_IS_DOUBLE_CLICK) { | 116 if (event->flags() & ui::EF_IS_DOUBLE_CLICK) { |
| 118 int component = target->GetNonClientComponent(event->location()); | 117 int component = target->GetNonClientComponent(event->location()); |
| 119 if (component == HTBOTTOM || component == HTTOP) { | 118 if (component == HTBOTTOM || component == HTTOP) { |
| 120 Shell::GetInstance()->metrics()->RecordUserMetricsAction( | 119 WmShell::Get()->RecordUserMetricsAction( |
| 121 UMA_TOGGLE_SINGLE_AXIS_MAXIMIZE_BORDER_CLICK); | 120 UMA_TOGGLE_SINGLE_AXIS_MAXIMIZE_BORDER_CLICK); |
| 122 const wm::WMEvent wm_event(wm::WM_EVENT_TOGGLE_VERTICAL_MAXIMIZE); | 121 const wm::WMEvent wm_event(wm::WM_EVENT_TOGGLE_VERTICAL_MAXIMIZE); |
| 123 target_state->OnWMEvent(&wm_event); | 122 target_state->OnWMEvent(&wm_event); |
| 124 event->StopPropagation(); | 123 event->StopPropagation(); |
| 125 } else if (component == HTLEFT || component == HTRIGHT) { | 124 } else if (component == HTLEFT || component == HTRIGHT) { |
| 126 Shell::GetInstance()->metrics()->RecordUserMetricsAction( | 125 WmShell::Get()->RecordUserMetricsAction( |
| 127 UMA_TOGGLE_SINGLE_AXIS_MAXIMIZE_BORDER_CLICK); | 126 UMA_TOGGLE_SINGLE_AXIS_MAXIMIZE_BORDER_CLICK); |
| 128 const wm::WMEvent wm_event(wm::WM_EVENT_TOGGLE_HORIZONTAL_MAXIMIZE); | 127 const wm::WMEvent wm_event(wm::WM_EVENT_TOGGLE_HORIZONTAL_MAXIMIZE); |
| 129 target_state->OnWMEvent(&wm_event); | 128 target_state->OnWMEvent(&wm_event); |
| 130 event->StopPropagation(); | 129 event->StopPropagation(); |
| 131 } | 130 } |
| 132 } | 131 } |
| 133 } | 132 } |
| 134 | 133 |
| 135 } // namespace ash | 134 } // namespace ash |
| OLD | NEW |