| 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/common/wm/window_state.h" | 8 #include "ash/common/wm/window_state.h" |
| 8 #include "ash/common/wm/wm_event.h" | 9 #include "ash/common/wm/wm_event.h" |
| 9 #include "ash/common/wm/wm_window.h" | 10 #include "ash/common/wm_window.h" |
| 10 #include "ash/metrics/user_metrics_recorder.h" | 11 #include "ash/metrics/user_metrics_recorder.h" |
| 11 #include "ash/shell.h" | 12 #include "ash/shell.h" |
| 12 #include "ash/touch/touch_uma.h" | 13 #include "ash/touch/touch_uma.h" |
| 13 #include "ash/wm/aura/wm_window_aura.h" | |
| 14 #include "ash/wm/window_state_aura.h" | 14 #include "ash/wm/window_state_aura.h" |
| 15 #include "ui/aura/window.h" | 15 #include "ui/aura/window.h" |
| 16 #include "ui/aura/window_delegate.h" | 16 #include "ui/aura/window_delegate.h" |
| 17 #include "ui/base/hit_test.h" | 17 #include "ui/base/hit_test.h" |
| 18 | 18 |
| 19 namespace ash { | 19 namespace ash { |
| 20 | 20 |
| 21 WorkspaceEventHandler::WorkspaceEventHandler() | 21 WorkspaceEventHandler::WorkspaceEventHandler() |
| 22 : click_component_(HTNOWHERE) { | 22 : click_component_(HTNOWHERE) { |
| 23 } | 23 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 35 GetNonClientComponent(event->location()); | 35 GetNonClientComponent(event->location()); |
| 36 } | 36 } |
| 37 | 37 |
| 38 if (event->handled()) | 38 if (event->handled()) |
| 39 return; | 39 return; |
| 40 | 40 |
| 41 switch (event->type()) { | 41 switch (event->type()) { |
| 42 case ui::ET_MOUSE_MOVED: { | 42 case ui::ET_MOUSE_MOVED: { |
| 43 int component = | 43 int component = |
| 44 target->delegate()->GetNonClientComponent(event->location()); | 44 target->delegate()->GetNonClientComponent(event->location()); |
| 45 multi_window_resize_controller_.Show(wm::WmWindowAura::Get(target), | 45 multi_window_resize_controller_.Show(WmWindowAura::Get(target), component, |
| 46 component, event->location()); | 46 event->location()); |
| 47 break; | 47 break; |
| 48 } | 48 } |
| 49 case ui::ET_MOUSE_ENTERED: | 49 case ui::ET_MOUSE_ENTERED: |
| 50 break; | 50 break; |
| 51 case ui::ET_MOUSE_CAPTURE_CHANGED: | 51 case ui::ET_MOUSE_CAPTURE_CHANGED: |
| 52 case ui::ET_MOUSE_EXITED: | 52 case ui::ET_MOUSE_EXITED: |
| 53 break; | 53 break; |
| 54 case ui::ET_MOUSE_PRESSED: { | 54 case ui::ET_MOUSE_PRESSED: { |
| 55 wm::WindowState* target_state = wm::GetWindowState(target); | 55 wm::WindowState* target_state = wm::GetWindowState(target); |
| 56 | 56 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 const wm::WMEvent wm_event(wm::WM_EVENT_TOGGLE_MAXIMIZE_CAPTION); | 106 const wm::WMEvent wm_event(wm::WM_EVENT_TOGGLE_MAXIMIZE_CAPTION); |
| 107 wm::GetWindowState(target)->OnWMEvent(&wm_event); | 107 wm::GetWindowState(target)->OnWMEvent(&wm_event); |
| 108 event->StopPropagation(); | 108 event->StopPropagation(); |
| 109 } | 109 } |
| 110 click_component_ = HTNOWHERE; | 110 click_component_ = HTNOWHERE; |
| 111 } | 111 } |
| 112 | 112 |
| 113 void WorkspaceEventHandler::HandleVerticalResizeDoubleClick( | 113 void WorkspaceEventHandler::HandleVerticalResizeDoubleClick( |
| 114 wm::WindowState* target_state, | 114 wm::WindowState* target_state, |
| 115 ui::MouseEvent* event) { | 115 ui::MouseEvent* event) { |
| 116 wm::WmWindow* target = target_state->window(); | 116 WmWindow* target = target_state->window(); |
| 117 if (event->flags() & ui::EF_IS_DOUBLE_CLICK) { | 117 if (event->flags() & ui::EF_IS_DOUBLE_CLICK) { |
| 118 int component = target->GetNonClientComponent(event->location()); | 118 int component = target->GetNonClientComponent(event->location()); |
| 119 if (component == HTBOTTOM || component == HTTOP) { | 119 if (component == HTBOTTOM || component == HTTOP) { |
| 120 Shell::GetInstance()->metrics()->RecordUserMetricsAction( | 120 Shell::GetInstance()->metrics()->RecordUserMetricsAction( |
| 121 UMA_TOGGLE_SINGLE_AXIS_MAXIMIZE_BORDER_CLICK); | 121 UMA_TOGGLE_SINGLE_AXIS_MAXIMIZE_BORDER_CLICK); |
| 122 const wm::WMEvent wm_event(wm::WM_EVENT_TOGGLE_VERTICAL_MAXIMIZE); | 122 const wm::WMEvent wm_event(wm::WM_EVENT_TOGGLE_VERTICAL_MAXIMIZE); |
| 123 target_state->OnWMEvent(&wm_event); | 123 target_state->OnWMEvent(&wm_event); |
| 124 event->StopPropagation(); | 124 event->StopPropagation(); |
| 125 } else if (component == HTLEFT || component == HTRIGHT) { | 125 } else if (component == HTLEFT || component == HTRIGHT) { |
| 126 Shell::GetInstance()->metrics()->RecordUserMetricsAction( | 126 Shell::GetInstance()->metrics()->RecordUserMetricsAction( |
| 127 UMA_TOGGLE_SINGLE_AXIS_MAXIMIZE_BORDER_CLICK); | 127 UMA_TOGGLE_SINGLE_AXIS_MAXIMIZE_BORDER_CLICK); |
| 128 const wm::WMEvent wm_event(wm::WM_EVENT_TOGGLE_HORIZONTAL_MAXIMIZE); | 128 const wm::WMEvent wm_event(wm::WM_EVENT_TOGGLE_HORIZONTAL_MAXIMIZE); |
| 129 target_state->OnWMEvent(&wm_event); | 129 target_state->OnWMEvent(&wm_event); |
| 130 event->StopPropagation(); | 130 event->StopPropagation(); |
| 131 } | 131 } |
| 132 } | 132 } |
| 133 } | 133 } |
| 134 | 134 |
| 135 } // namespace ash | 135 } // namespace ash |
| OLD | NEW |