| 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/shell_port.h" | 7 #include "ash/shell_port.h" |
| 8 #include "ash/wm/window_state.h" | 8 #include "ash/wm/window_state.h" |
| 9 #include "ash/wm/wm_event.h" | 9 #include "ash/wm/wm_event.h" |
| 10 #include "ash/wm_window.h" | 10 #include "ash/wm_window.h" |
| 11 #include "ui/aura/window.h" |
| 12 #include "ui/aura/window_delegate.h" |
| 11 #include "ui/base/hit_test.h" | 13 #include "ui/base/hit_test.h" |
| 12 #include "ui/events/event.h" | 14 #include "ui/events/event.h" |
| 13 | 15 |
| 14 namespace ash { | 16 namespace ash { |
| 15 | 17 |
| 16 WorkspaceEventHandler::WorkspaceEventHandler() : click_component_(HTNOWHERE) {} | 18 WorkspaceEventHandler::WorkspaceEventHandler() : click_component_(HTNOWHERE) {} |
| 17 | 19 |
| 18 WorkspaceEventHandler::~WorkspaceEventHandler() {} | 20 WorkspaceEventHandler::~WorkspaceEventHandler() {} |
| 19 | 21 |
| 20 void WorkspaceEventHandler::OnMouseEvent(ui::MouseEvent* event, | 22 void WorkspaceEventHandler::OnMouseEvent(ui::MouseEvent* event, |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 const wm::WMEvent wm_event(wm::WM_EVENT_TOGGLE_MAXIMIZE_CAPTION); | 92 const wm::WMEvent wm_event(wm::WM_EVENT_TOGGLE_MAXIMIZE_CAPTION); |
| 91 target->GetWindowState()->OnWMEvent(&wm_event); | 93 target->GetWindowState()->OnWMEvent(&wm_event); |
| 92 event->StopPropagation(); | 94 event->StopPropagation(); |
| 93 } | 95 } |
| 94 click_component_ = HTNOWHERE; | 96 click_component_ = HTNOWHERE; |
| 95 } | 97 } |
| 96 | 98 |
| 97 void WorkspaceEventHandler::HandleVerticalResizeDoubleClick( | 99 void WorkspaceEventHandler::HandleVerticalResizeDoubleClick( |
| 98 wm::WindowState* target_state, | 100 wm::WindowState* target_state, |
| 99 ui::MouseEvent* event) { | 101 ui::MouseEvent* event) { |
| 100 WmWindow* target = target_state->window(); | 102 aura::Window* target = target_state->window(); |
| 101 if (event->flags() & ui::EF_IS_DOUBLE_CLICK) { | 103 if (event->flags() & ui::EF_IS_DOUBLE_CLICK) { |
| 102 int component = target->GetNonClientComponent(event->location()); | 104 int component = |
| 105 target->delegate() |
| 106 ? target->delegate()->GetNonClientComponent(event->location()) |
| 107 : HTNOWHERE; |
| 103 if (component == HTBOTTOM || component == HTTOP) { | 108 if (component == HTBOTTOM || component == HTTOP) { |
| 104 ShellPort::Get()->RecordUserMetricsAction( | 109 ShellPort::Get()->RecordUserMetricsAction( |
| 105 UMA_TOGGLE_SINGLE_AXIS_MAXIMIZE_BORDER_CLICK); | 110 UMA_TOGGLE_SINGLE_AXIS_MAXIMIZE_BORDER_CLICK); |
| 106 const wm::WMEvent wm_event(wm::WM_EVENT_TOGGLE_VERTICAL_MAXIMIZE); | 111 const wm::WMEvent wm_event(wm::WM_EVENT_TOGGLE_VERTICAL_MAXIMIZE); |
| 107 target_state->OnWMEvent(&wm_event); | 112 target_state->OnWMEvent(&wm_event); |
| 108 event->StopPropagation(); | 113 event->StopPropagation(); |
| 109 } else if (component == HTLEFT || component == HTRIGHT) { | 114 } else if (component == HTLEFT || component == HTRIGHT) { |
| 110 ShellPort::Get()->RecordUserMetricsAction( | 115 ShellPort::Get()->RecordUserMetricsAction( |
| 111 UMA_TOGGLE_SINGLE_AXIS_MAXIMIZE_BORDER_CLICK); | 116 UMA_TOGGLE_SINGLE_AXIS_MAXIMIZE_BORDER_CLICK); |
| 112 const wm::WMEvent wm_event(wm::WM_EVENT_TOGGLE_HORIZONTAL_MAXIMIZE); | 117 const wm::WMEvent wm_event(wm::WM_EVENT_TOGGLE_HORIZONTAL_MAXIMIZE); |
| 113 target_state->OnWMEvent(&wm_event); | 118 target_state->OnWMEvent(&wm_event); |
| 114 event->StopPropagation(); | 119 event->StopPropagation(); |
| 115 } | 120 } |
| 116 } | 121 } |
| 117 } | 122 } |
| 118 | 123 |
| 119 } // namespace ash | 124 } // namespace ash |
| OLD | NEW |