| 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/metrics/user_metrics_recorder.h" | 7 #include "ash/metrics/user_metrics_recorder.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/touch/touch_uma.h" | 9 #include "ash/touch/touch_uma.h" |
| 10 #include "ash/wm/common/wm_event.h" | 10 #include "ash/wm/common/wm_event.h" |
| 11 #include "ash/wm/window_state.h" | 11 #include "ash/wm/window_state.h" |
| 12 #include "ash/wm/window_state_aura.h" |
| 12 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
| 13 #include "ui/aura/window_delegate.h" | 14 #include "ui/aura/window_delegate.h" |
| 14 #include "ui/base/hit_test.h" | 15 #include "ui/base/hit_test.h" |
| 15 | 16 |
| 16 namespace ash { | 17 namespace ash { |
| 17 | 18 |
| 18 WorkspaceEventHandler::WorkspaceEventHandler() | 19 WorkspaceEventHandler::WorkspaceEventHandler() |
| 19 : click_component_(HTNOWHERE) { | 20 : click_component_(HTNOWHERE) { |
| 20 } | 21 } |
| 21 | 22 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 const wm::WMEvent wm_event(wm::WM_EVENT_TOGGLE_MAXIMIZE_CAPTION); | 104 const wm::WMEvent wm_event(wm::WM_EVENT_TOGGLE_MAXIMIZE_CAPTION); |
| 104 wm::GetWindowState(target)->OnWMEvent(&wm_event); | 105 wm::GetWindowState(target)->OnWMEvent(&wm_event); |
| 105 event->StopPropagation(); | 106 event->StopPropagation(); |
| 106 } | 107 } |
| 107 click_component_ = HTNOWHERE; | 108 click_component_ = HTNOWHERE; |
| 108 } | 109 } |
| 109 | 110 |
| 110 void WorkspaceEventHandler::HandleVerticalResizeDoubleClick( | 111 void WorkspaceEventHandler::HandleVerticalResizeDoubleClick( |
| 111 wm::WindowState* target_state, | 112 wm::WindowState* target_state, |
| 112 ui::MouseEvent* event) { | 113 ui::MouseEvent* event) { |
| 113 aura::Window* target = target_state->window(); | 114 aura::Window* target = target_state->aura_window(); |
| 114 if (event->flags() & ui::EF_IS_DOUBLE_CLICK) { | 115 if (event->flags() & ui::EF_IS_DOUBLE_CLICK) { |
| 115 int component = | 116 int component = |
| 116 target->delegate()->GetNonClientComponent(event->location()); | 117 target->delegate()->GetNonClientComponent(event->location()); |
| 117 if (component == HTBOTTOM || component == HTTOP) { | 118 if (component == HTBOTTOM || component == HTTOP) { |
| 118 Shell::GetInstance()->metrics()->RecordUserMetricsAction( | 119 Shell::GetInstance()->metrics()->RecordUserMetricsAction( |
| 119 UMA_TOGGLE_SINGLE_AXIS_MAXIMIZE_BORDER_CLICK); | 120 UMA_TOGGLE_SINGLE_AXIS_MAXIMIZE_BORDER_CLICK); |
| 120 const wm::WMEvent wm_event(wm::WM_EVENT_TOGGLE_VERTICAL_MAXIMIZE); | 121 const wm::WMEvent wm_event(wm::WM_EVENT_TOGGLE_VERTICAL_MAXIMIZE); |
| 121 target_state->OnWMEvent(&wm_event); | 122 target_state->OnWMEvent(&wm_event); |
| 122 event->StopPropagation(); | 123 event->StopPropagation(); |
| 123 } else if (component == HTLEFT || component == HTRIGHT) { | 124 } else if (component == HTLEFT || component == HTRIGHT) { |
| 124 Shell::GetInstance()->metrics()->RecordUserMetricsAction( | 125 Shell::GetInstance()->metrics()->RecordUserMetricsAction( |
| 125 UMA_TOGGLE_SINGLE_AXIS_MAXIMIZE_BORDER_CLICK); | 126 UMA_TOGGLE_SINGLE_AXIS_MAXIMIZE_BORDER_CLICK); |
| 126 const wm::WMEvent wm_event(wm::WM_EVENT_TOGGLE_HORIZONTAL_MAXIMIZE); | 127 const wm::WMEvent wm_event(wm::WM_EVENT_TOGGLE_HORIZONTAL_MAXIMIZE); |
| 127 target_state->OnWMEvent(&wm_event); | 128 target_state->OnWMEvent(&wm_event); |
| 128 event->StopPropagation(); | 129 event->StopPropagation(); |
| 129 } | 130 } |
| 130 } | 131 } |
| 131 } | 132 } |
| 132 | 133 |
| 133 } // namespace ash | 134 } // namespace ash |
| OLD | NEW |