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