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/wm/window_state.h" | 8 #include "ash/wm/window_state.h" |
8 #include "ash/wm/wm_event.h" | 9 #include "ash/wm/wm_event.h" |
9 #include "ash/wm_shell.h" | |
10 #include "ash/wm_window.h" | 10 #include "ash/wm_window.h" |
11 #include "ui/base/hit_test.h" | 11 #include "ui/base/hit_test.h" |
12 #include "ui/events/event.h" | 12 #include "ui/events/event.h" |
13 | 13 |
14 namespace ash { | 14 namespace ash { |
15 | 15 |
16 WorkspaceEventHandler::WorkspaceEventHandler() : click_component_(HTNOWHERE) {} | 16 WorkspaceEventHandler::WorkspaceEventHandler() : click_component_(HTNOWHERE) {} |
17 | 17 |
18 WorkspaceEventHandler::~WorkspaceEventHandler() {} | 18 WorkspaceEventHandler::~WorkspaceEventHandler() {} |
19 | 19 |
(...skipping 20 matching lines...) Expand all Loading... |
40 case ui::ET_MOUSE_CAPTURE_CHANGED: | 40 case ui::ET_MOUSE_CAPTURE_CHANGED: |
41 case ui::ET_MOUSE_EXITED: | 41 case ui::ET_MOUSE_EXITED: |
42 break; | 42 break; |
43 case ui::ET_MOUSE_PRESSED: { | 43 case ui::ET_MOUSE_PRESSED: { |
44 wm::WindowState* target_state = target->GetWindowState(); | 44 wm::WindowState* target_state = target->GetWindowState(); |
45 | 45 |
46 if (event->IsOnlyLeftMouseButton()) { | 46 if (event->IsOnlyLeftMouseButton()) { |
47 if (event->flags() & ui::EF_IS_DOUBLE_CLICK) { | 47 if (event->flags() & ui::EF_IS_DOUBLE_CLICK) { |
48 int component = target->GetNonClientComponent(event->location()); | 48 int component = target->GetNonClientComponent(event->location()); |
49 if (component == HTCAPTION && component == click_component_) { | 49 if (component == HTCAPTION && component == click_component_) { |
50 WmShell::Get()->RecordUserMetricsAction( | 50 ShellPort::Get()->RecordUserMetricsAction( |
51 UMA_TOGGLE_MAXIMIZE_CAPTION_CLICK); | 51 UMA_TOGGLE_MAXIMIZE_CAPTION_CLICK); |
52 const wm::WMEvent wm_event(wm::WM_EVENT_TOGGLE_MAXIMIZE_CAPTION); | 52 const wm::WMEvent wm_event(wm::WM_EVENT_TOGGLE_MAXIMIZE_CAPTION); |
53 target_state->OnWMEvent(&wm_event); | 53 target_state->OnWMEvent(&wm_event); |
54 event->StopPropagation(); | 54 event->StopPropagation(); |
55 } | 55 } |
56 click_component_ = HTNOWHERE; | 56 click_component_ = HTNOWHERE; |
57 } | 57 } |
58 } else { | 58 } else { |
59 click_component_ = HTNOWHERE; | 59 click_component_ = HTNOWHERE; |
60 } | 60 } |
(...skipping 11 matching lines...) Expand all Loading... |
72 if (event->handled() || event->type() != ui::ET_GESTURE_TAP) | 72 if (event->handled() || event->type() != ui::ET_GESTURE_TAP) |
73 return; | 73 return; |
74 | 74 |
75 int previous_target_component = click_component_; | 75 int previous_target_component = click_component_; |
76 click_component_ = target->GetNonClientComponent(event->location()); | 76 click_component_ = target->GetNonClientComponent(event->location()); |
77 | 77 |
78 if (click_component_ != HTCAPTION) | 78 if (click_component_ != HTCAPTION) |
79 return; | 79 return; |
80 | 80 |
81 if (event->details().tap_count() != 2) { | 81 if (event->details().tap_count() != 2) { |
82 WmShell::Get()->RecordGestureAction(GESTURE_FRAMEVIEW_TAP); | 82 ShellPort::Get()->RecordGestureAction(GESTURE_FRAMEVIEW_TAP); |
83 return; | 83 return; |
84 } | 84 } |
85 | 85 |
86 if (click_component_ == previous_target_component) { | 86 if (click_component_ == previous_target_component) { |
87 WmShell::Get()->RecordUserMetricsAction( | 87 ShellPort::Get()->RecordUserMetricsAction( |
88 UMA_TOGGLE_MAXIMIZE_CAPTION_GESTURE); | 88 UMA_TOGGLE_MAXIMIZE_CAPTION_GESTURE); |
89 WmShell::Get()->RecordGestureAction(GESTURE_MAXIMIZE_DOUBLETAP); | 89 ShellPort::Get()->RecordGestureAction(GESTURE_MAXIMIZE_DOUBLETAP); |
90 const wm::WMEvent wm_event(wm::WM_EVENT_TOGGLE_MAXIMIZE_CAPTION); | 90 const wm::WMEvent wm_event(wm::WM_EVENT_TOGGLE_MAXIMIZE_CAPTION); |
91 target->GetWindowState()->OnWMEvent(&wm_event); | 91 target->GetWindowState()->OnWMEvent(&wm_event); |
92 event->StopPropagation(); | 92 event->StopPropagation(); |
93 } | 93 } |
94 click_component_ = HTNOWHERE; | 94 click_component_ = HTNOWHERE; |
95 } | 95 } |
96 | 96 |
97 void WorkspaceEventHandler::HandleVerticalResizeDoubleClick( | 97 void WorkspaceEventHandler::HandleVerticalResizeDoubleClick( |
98 wm::WindowState* target_state, | 98 wm::WindowState* target_state, |
99 ui::MouseEvent* event) { | 99 ui::MouseEvent* event) { |
100 WmWindow* target = target_state->window(); | 100 WmWindow* target = target_state->window(); |
101 if (event->flags() & ui::EF_IS_DOUBLE_CLICK) { | 101 if (event->flags() & ui::EF_IS_DOUBLE_CLICK) { |
102 int component = target->GetNonClientComponent(event->location()); | 102 int component = target->GetNonClientComponent(event->location()); |
103 if (component == HTBOTTOM || component == HTTOP) { | 103 if (component == HTBOTTOM || component == HTTOP) { |
104 WmShell::Get()->RecordUserMetricsAction( | 104 ShellPort::Get()->RecordUserMetricsAction( |
105 UMA_TOGGLE_SINGLE_AXIS_MAXIMIZE_BORDER_CLICK); | 105 UMA_TOGGLE_SINGLE_AXIS_MAXIMIZE_BORDER_CLICK); |
106 const wm::WMEvent wm_event(wm::WM_EVENT_TOGGLE_VERTICAL_MAXIMIZE); | 106 const wm::WMEvent wm_event(wm::WM_EVENT_TOGGLE_VERTICAL_MAXIMIZE); |
107 target_state->OnWMEvent(&wm_event); | 107 target_state->OnWMEvent(&wm_event); |
108 event->StopPropagation(); | 108 event->StopPropagation(); |
109 } else if (component == HTLEFT || component == HTRIGHT) { | 109 } else if (component == HTLEFT || component == HTRIGHT) { |
110 WmShell::Get()->RecordUserMetricsAction( | 110 ShellPort::Get()->RecordUserMetricsAction( |
111 UMA_TOGGLE_SINGLE_AXIS_MAXIMIZE_BORDER_CLICK); | 111 UMA_TOGGLE_SINGLE_AXIS_MAXIMIZE_BORDER_CLICK); |
112 const wm::WMEvent wm_event(wm::WM_EVENT_TOGGLE_HORIZONTAL_MAXIMIZE); | 112 const wm::WMEvent wm_event(wm::WM_EVENT_TOGGLE_HORIZONTAL_MAXIMIZE); |
113 target_state->OnWMEvent(&wm_event); | 113 target_state->OnWMEvent(&wm_event); |
114 event->StopPropagation(); | 114 event->StopPropagation(); |
115 } | 115 } |
116 } | 116 } |
117 } | 117 } |
118 | 118 |
119 } // namespace ash | 119 } // namespace ash |
OLD | NEW |