Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3645)

Unified Diff: ash/wm/workspace/workspace_event_handler.cc

Issue 239213003: Revert of Prevents double-clicks on a tab close button from aslo maximizing the browser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/wm/workspace/workspace_event_handler.h ('k') | ash/wm/workspace/workspace_event_handler_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/workspace/workspace_event_handler.cc
diff --git a/ash/wm/workspace/workspace_event_handler.cc b/ash/wm/workspace/workspace_event_handler.cc
index bba3f76160b94b5bf99495d81c3450a9f51c3e6c..bfc8104637be1816082754434f77c2f6ae228dc0 100644
--- a/ash/wm/workspace/workspace_event_handler.cc
+++ b/ash/wm/workspace/workspace_event_handler.cc
@@ -15,26 +15,16 @@
namespace ash {
-WorkspaceEventHandler::WorkspaceEventHandler()
- : click_component_(HTNOWHERE) {
+WorkspaceEventHandler::WorkspaceEventHandler() {
}
WorkspaceEventHandler::~WorkspaceEventHandler() {
}
void WorkspaceEventHandler::OnMouseEvent(ui::MouseEvent* event) {
- aura::Window* target = static_cast<aura::Window*>(event->target());
- if (event->type() == ui::ET_MOUSE_PRESSED &&
- event->IsOnlyLeftMouseButton() &&
- ((event->flags() &
- (ui::EF_IS_DOUBLE_CLICK | ui::EF_IS_TRIPLE_CLICK)) == 0)) {
- click_component_ = target->delegate()->
- GetNonClientComponent(event->location());
- }
-
if (event->handled())
return;
-
+ aura::Window* target = static_cast<aura::Window*>(event->target());
switch (event->type()) {
case ui::ET_MOUSE_MOVED: {
int component =
@@ -50,29 +40,16 @@
break;
case ui::ET_MOUSE_PRESSED: {
wm::WindowState* target_state = wm::GetWindowState(target);
-
- if (event->IsOnlyLeftMouseButton()) {
- if (event->flags() & ui::EF_IS_DOUBLE_CLICK) {
- int component = target->delegate()->
- GetNonClientComponent(event->location());
- if (component == HTCAPTION &&
- component == click_component_) {
- ash::Shell::GetInstance()->metrics()->RecordUserMetricsAction(
- ash::UMA_TOGGLE_MAXIMIZE_CAPTION_CLICK);
- const wm::WMEvent wm_event(wm::WM_EVENT_TOGGLE_MAXIMIZE_CAPTION);
- target_state->OnWMEvent(&wm_event);
- event->StopPropagation();
- }
- // WindowEventHandler can receive each event up to two times. Once a
- // double-click has been received clear the target. Otherwise a
- // duplicate of the event will be checking target history against
- // itself.
- click_component_ = HTNOWHERE;
- }
- } else {
- click_component_ = HTNOWHERE;
+ if (event->flags() & ui::EF_IS_DOUBLE_CLICK &&
+ event->IsOnlyLeftMouseButton() &&
+ target->delegate()->GetNonClientComponent(event->location()) ==
+ HTCAPTION) {
+ ash::Shell::GetInstance()->metrics()->RecordUserMetricsAction(
+ ash::UMA_TOGGLE_MAXIMIZE_CAPTION_CLICK);
+ const wm::WMEvent wm_event(wm::WM_EVENT_TOGGLE_MAXIMIZE_CAPTION);
+ target_state->OnWMEvent(&wm_event);
+ event->StopPropagation();
}
-
multi_window_resize_controller_.Hide();
HandleVerticalResizeDoubleClick(target_state, event);
break;
@@ -83,36 +60,29 @@
}
void WorkspaceEventHandler::OnGestureEvent(ui::GestureEvent* event) {
- if (event->handled() || event->type() != ui::ET_GESTURE_TAP)
+ if (event->handled())
return;
-
aura::Window* target = static_cast<aura::Window*>(event->target());
- int previous_target_component = click_component_;
- click_component_ = target->delegate()->
- GetNonClientComponent(event->location());
-
- if (click_component_ != HTCAPTION)
- return;
-
- if (event->details().tap_count() != 2) {
- // Note: TouchUMA::GESTURE_FRAMEVIEW_TAP is counted twice for each tap.
- TouchUMA::GetInstance()->
- RecordGestureAction(TouchUMA::GESTURE_FRAMEVIEW_TAP);
- return;
+ if (event->type() == ui::ET_GESTURE_TAP &&
+ target->delegate()->GetNonClientComponent(event->location()) ==
+ HTCAPTION) {
+ if (event->details().tap_count() == 2) {
+ ash::Shell::GetInstance()->metrics()->RecordUserMetricsAction(
+ ash::UMA_TOGGLE_MAXIMIZE_CAPTION_GESTURE);
+ // Note: TouchUMA::GESTURE_FRAMEVIEW_TAP is counted twice each time
+ // TouchUMA::GESTURE_MAXIMIZE_DOUBLETAP is counted once.
+ TouchUMA::GetInstance()->RecordGestureAction(
+ TouchUMA::GESTURE_MAXIMIZE_DOUBLETAP);
+ const wm::WMEvent wm_event(wm::WM_EVENT_TOGGLE_MAXIMIZE_CAPTION);
+ wm::GetWindowState(target)->OnWMEvent(&wm_event);
+ event->StopPropagation();
+ return;
+ } else {
+ // Note: TouchUMA::GESTURE_FRAMEVIEW_TAP is counted twice for each tap.
+ TouchUMA::GetInstance()->RecordGestureAction(
+ TouchUMA::GESTURE_FRAMEVIEW_TAP);
+ }
}
-
- if (click_component_ == previous_target_component) {
- ash::Shell::GetInstance()->metrics()->RecordUserMetricsAction(
- ash::UMA_TOGGLE_MAXIMIZE_CAPTION_GESTURE);
- // Note: TouchUMA::GESTURE_FRAMEVIEW_TAP is counted twice each time
- // TouchUMA::GESTURE_MAXIMIZE_DOUBLETAP is counted once.
- TouchUMA::GetInstance()->RecordGestureAction(
- TouchUMA::GESTURE_MAXIMIZE_DOUBLETAP);
- const wm::WMEvent wm_event(wm::WM_EVENT_TOGGLE_MAXIMIZE_CAPTION);
- wm::GetWindowState(target)->OnWMEvent(&wm_event);
- event->StopPropagation();
- }
- click_component_ = HTNOWHERE;
}
void WorkspaceEventHandler::HandleVerticalResizeDoubleClick(
« no previous file with comments | « ash/wm/workspace/workspace_event_handler.h ('k') | ash/wm/workspace/workspace_event_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698