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

Side by Side Diff: ash/wm/workspace/workspace_event_handler.cc

Issue 11592011: events: Update mouse-event handlers to not return EventResult. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/screen_ash.h" 7 #include "ash/screen_ash.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/wm/property_util.h" 9 #include "ash/wm/property_util.h"
10 #include "ash/wm/window_util.h" 10 #include "ash/wm/window_util.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 WorkspaceEventHandler::WorkspaceEventHandler(aura::Window* owner) 58 WorkspaceEventHandler::WorkspaceEventHandler(aura::Window* owner)
59 : ToplevelWindowEventHandler(owner), 59 : ToplevelWindowEventHandler(owner),
60 destroyed_(NULL) { 60 destroyed_(NULL) {
61 } 61 }
62 62
63 WorkspaceEventHandler::~WorkspaceEventHandler() { 63 WorkspaceEventHandler::~WorkspaceEventHandler() {
64 if (destroyed_) 64 if (destroyed_)
65 *destroyed_ = true; 65 *destroyed_ = true;
66 } 66 }
67 67
68 ui::EventResult WorkspaceEventHandler::OnMouseEvent(ui::MouseEvent* event) { 68 void WorkspaceEventHandler::OnMouseEvent(ui::MouseEvent* event) {
69 aura::Window* target = static_cast<aura::Window*>(event->target()); 69 aura::Window* target = static_cast<aura::Window*>(event->target());
70 switch (event->type()) { 70 switch (event->type()) {
71 case ui::ET_MOUSE_MOVED: { 71 case ui::ET_MOUSE_MOVED: {
72 int component = 72 int component =
73 target->delegate()->GetNonClientComponent(event->location()); 73 target->delegate()->GetNonClientComponent(event->location());
74 multi_window_resize_controller_.Show(target, component, 74 multi_window_resize_controller_.Show(target, component,
75 event->location()); 75 event->location());
76 break; 76 break;
77 } 77 }
78 case ui::ET_MOUSE_ENTERED: 78 case ui::ET_MOUSE_ENTERED:
79 break; 79 break;
80 case ui::ET_MOUSE_CAPTURE_CHANGED: 80 case ui::ET_MOUSE_CAPTURE_CHANGED:
81 case ui::ET_MOUSE_EXITED: 81 case ui::ET_MOUSE_EXITED:
82 break; 82 break;
83 case ui::ET_MOUSE_PRESSED: { 83 case ui::ET_MOUSE_PRESSED: {
84 // Maximize behavior is implemented as post-target handling so the target 84 // Maximize behavior is implemented as post-target handling so the target
85 // can cancel it. 85 // can cancel it.
86 if (ui::EventCanceledDefaultHandling(*event)) 86 if (ui::EventCanceledDefaultHandling(*event)) {
87 return ToplevelWindowEventHandler::OnMouseEvent(event); 87 ToplevelWindowEventHandler::OnMouseEvent(event);
88 return;
89 }
88 90
89 if (event->flags() & ui::EF_IS_DOUBLE_CLICK && 91 if (event->flags() & ui::EF_IS_DOUBLE_CLICK &&
90 target->delegate()->GetNonClientComponent(event->location()) == 92 target->delegate()->GetNonClientComponent(event->location()) ==
91 HTCAPTION) { 93 HTCAPTION) {
92 bool destroyed = false; 94 bool destroyed = false;
93 destroyed_ = &destroyed; 95 destroyed_ = &destroyed;
94 ToggleMaximizedState(target); 96 ToggleMaximizedState(target);
95 if (destroyed) 97 if (destroyed)
96 return ui::ER_UNHANDLED; 98 return;
97 destroyed_ = NULL; 99 destroyed_ = NULL;
98 } 100 }
99 multi_window_resize_controller_.Hide(); 101 multi_window_resize_controller_.Hide();
100 HandleVerticalResizeDoubleClick(target, event); 102 HandleVerticalResizeDoubleClick(target, event);
101 break; 103 break;
102 } 104 }
103 default: 105 default:
104 break; 106 break;
105 } 107 }
106 return ToplevelWindowEventHandler::OnMouseEvent(event); 108 ToplevelWindowEventHandler::OnMouseEvent(event);
107 } 109 }
108 110
109 void WorkspaceEventHandler::OnGestureEvent(ui::GestureEvent* event) { 111 void WorkspaceEventHandler::OnGestureEvent(ui::GestureEvent* event) {
110 aura::Window* target = static_cast<aura::Window*>(event->target()); 112 aura::Window* target = static_cast<aura::Window*>(event->target());
111 if (event->type() == ui::ET_GESTURE_DOUBLE_TAP && 113 if (event->type() == ui::ET_GESTURE_DOUBLE_TAP &&
112 target->delegate()->GetNonClientComponent(event->location()) == 114 target->delegate()->GetNonClientComponent(event->location()) ==
113 HTCAPTION) { 115 HTCAPTION) {
114 ToggleMaximizedState(target); // |this| may be destroyed from here. 116 ToggleMaximizedState(target); // |this| may be destroyed from here.
115 event->StopPropagation(); 117 event->StopPropagation();
116 return; 118 return;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 target->bounds().y(), 161 target->bounds().y(),
160 work_area.width(), 162 work_area.width(),
161 target->bounds().height())); 163 target->bounds().height()));
162 } 164 }
163 } 165 }
164 } 166 }
165 } 167 }
166 168
167 } // namespace internal 169 } // namespace internal
168 } // namespace ash 170 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/workspace/workspace_event_handler.h ('k') | chrome/browser/ui/views/immersive_mode_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698