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

Side by Side Diff: ui/views/widget/widget.cc

Issue 2712963003: mustash: Use ui::chromeos::EventRewriter in mus (Closed)
Patch Set: Fix build issues. Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « ui/views/widget/widget.h ('k') | ui/views/widget/widget_interactive_uitest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ui/views/widget/widget.h" 5 #include "ui/views/widget/widget.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 non_client_view_->NonClientHitTest(point) : 1158 non_client_view_->NonClientHitTest(point) :
1159 HTNOWHERE; 1159 HTNOWHERE;
1160 1160
1161 if (movement_disabled_ && (component == HTCAPTION || component == HTSYSMENU)) 1161 if (movement_disabled_ && (component == HTCAPTION || component == HTSYSMENU))
1162 return HTNOWHERE; 1162 return HTNOWHERE;
1163 1163
1164 return component; 1164 return component;
1165 } 1165 }
1166 1166
1167 void Widget::OnKeyEvent(ui::KeyEvent* event) { 1167 void Widget::OnKeyEvent(ui::KeyEvent* event) {
1168 SendEventToProcessor(event); 1168 SendEventToSink(event);
1169 if (!event->handled() && GetFocusManager() && 1169 if (!event->handled() && GetFocusManager() &&
1170 !GetFocusManager()->OnKeyEvent(*event)) { 1170 !GetFocusManager()->OnKeyEvent(*event)) {
1171 event->StopPropagation(); 1171 event->StopPropagation();
1172 } 1172 }
1173 } 1173 }
1174 1174
1175 // TODO(tdanderson): We should not be calling the OnMouse*() functions on 1175 // TODO(tdanderson): We should not be calling the OnMouse*() functions on
1176 // RootView from anywhere in Widget. Use 1176 // RootView from anywhere in Widget. Use
1177 // SendEventToProcessor() instead. See crbug.com/348087. 1177 // SendEventToSink() instead. See crbug.com/348087.
1178 void Widget::OnMouseEvent(ui::MouseEvent* event) { 1178 void Widget::OnMouseEvent(ui::MouseEvent* event) {
1179 View* root_view = GetRootView(); 1179 View* root_view = GetRootView();
1180 switch (event->type()) { 1180 switch (event->type()) {
1181 case ui::ET_MOUSE_PRESSED: { 1181 case ui::ET_MOUSE_PRESSED: {
1182 last_mouse_event_was_move_ = false; 1182 last_mouse_event_was_move_ = false;
1183 1183
1184 // We may get deleted by the time we return from OnMousePressed. So we 1184 // We may get deleted by the time we return from OnMousePressed. So we
1185 // use an observer to make sure we are still alive. 1185 // use an observer to make sure we are still alive.
1186 WidgetDeletionObserver widget_deletion_observer(this); 1186 WidgetDeletionObserver widget_deletion_observer(this);
1187 1187
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
1268 return; 1268 return;
1269 1269
1270 View* root_view = GetRootView(); 1270 View* root_view = GetRootView();
1271 if (root_view) 1271 if (root_view)
1272 root_view->OnMouseCaptureLost(); 1272 root_view->OnMouseCaptureLost();
1273 is_mouse_button_pressed_ = false; 1273 is_mouse_button_pressed_ = false;
1274 } 1274 }
1275 1275
1276 void Widget::OnScrollEvent(ui::ScrollEvent* event) { 1276 void Widget::OnScrollEvent(ui::ScrollEvent* event) {
1277 ui::ScrollEvent event_copy(*event); 1277 ui::ScrollEvent event_copy(*event);
1278 SendEventToProcessor(&event_copy); 1278 SendEventToSink(&event_copy);
1279 1279
1280 // Convert unhandled ui::ET_SCROLL events into ui::ET_MOUSEWHEEL events. 1280 // Convert unhandled ui::ET_SCROLL events into ui::ET_MOUSEWHEEL events.
1281 if (!event_copy.handled() && event_copy.type() == ui::ET_SCROLL) { 1281 if (!event_copy.handled() && event_copy.type() == ui::ET_SCROLL) {
1282 ui::MouseWheelEvent wheel(*event); 1282 ui::MouseWheelEvent wheel(*event);
1283 OnMouseEvent(&wheel); 1283 OnMouseEvent(&wheel);
1284 } 1284 }
1285 } 1285 }
1286 1286
1287 void Widget::OnGestureEvent(ui::GestureEvent* event) { 1287 void Widget::OnGestureEvent(ui::GestureEvent* event) {
1288 // We explicitly do not capture here. Not capturing enables multiple widgets 1288 // We explicitly do not capture here. Not capturing enables multiple widgets
1289 // to get tap events at the same time. Views (such as tab dragging) may 1289 // to get tap events at the same time. Views (such as tab dragging) may
1290 // explicitly capture. 1290 // explicitly capture.
1291 SendEventToProcessor(event); 1291 SendEventToSink(event);
1292 } 1292 }
1293 1293
1294 bool Widget::ExecuteCommand(int command_id) { 1294 bool Widget::ExecuteCommand(int command_id) {
1295 return widget_delegate_->ExecuteWindowsCommand(command_id); 1295 return widget_delegate_->ExecuteWindowsCommand(command_id);
1296 } 1296 }
1297 1297
1298 bool Widget::HasHitTestMask() const { 1298 bool Widget::HasHitTestMask() const {
1299 return widget_delegate_->WidgetHasHitTestMask(); 1299 return widget_delegate_->WidgetHasHitTestMask();
1300 } 1300 }
1301 1301
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1380 View::ConvertPointToTarget(GetRootView(), view, &point_in_view); 1380 View::ConvertPointToTarget(GetRootView(), view, &point_in_view);
1381 if (vis_bounds.Contains(point_in_view)) 1381 if (vis_bounds.Contains(point_in_view))
1382 return false; 1382 return false;
1383 } 1383 }
1384 } 1384 }
1385 return true; 1385 return true;
1386 } 1386 }
1387 1387
1388 //////////////////////////////////////////////////////////////////////////////// 1388 ////////////////////////////////////////////////////////////////////////////////
1389 // Widget, ui::EventSource implementation: 1389 // Widget, ui::EventSource implementation:
1390 ui::EventProcessor* Widget::GetEventProcessor() { 1390 ui::EventSink* Widget::GetEventSink() {
1391 return root_view_.get(); 1391 return root_view_.get();
1392 } 1392 }
1393 1393
1394 //////////////////////////////////////////////////////////////////////////////// 1394 ////////////////////////////////////////////////////////////////////////////////
1395 // Widget, FocusTraversable implementation: 1395 // Widget, FocusTraversable implementation:
1396 1396
1397 FocusSearch* Widget::GetFocusSearch() { 1397 FocusSearch* Widget::GetFocusSearch() {
1398 return root_view_->GetFocusSearch(); 1398 return root_view_->GetFocusSearch();
1399 } 1399 }
1400 1400
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
1567 1567
1568 //////////////////////////////////////////////////////////////////////////////// 1568 ////////////////////////////////////////////////////////////////////////////////
1569 // internal::NativeWidgetPrivate, NativeWidget implementation: 1569 // internal::NativeWidgetPrivate, NativeWidget implementation:
1570 1570
1571 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { 1571 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() {
1572 return this; 1572 return this;
1573 } 1573 }
1574 1574
1575 } // namespace internal 1575 } // namespace internal
1576 } // namespace views 1576 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/widget.h ('k') | ui/views/widget/widget_interactive_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698