OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 /* | 5 /* |
6 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. |
7 * Copyright (C) 2006-2009 Google Inc. | 7 * Copyright (C) 2006-2009 Google Inc. |
8 * | 8 * |
9 * Redistribution and use in source and binary forms, with or without | 9 * Redistribution and use in source and binary forms, with or without |
10 * modification, are permitted provided that the following conditions | 10 * modification, are permitted provided that the following conditions |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 | 329 |
330 blink::WebMouseEvent WebMouseEventBuilder::Build(NSEvent* event, NSView* view) { | 330 blink::WebMouseEvent WebMouseEventBuilder::Build(NSEvent* event, NSView* view) { |
331 blink::WebMouseEvent result; | 331 blink::WebMouseEvent result; |
332 | 332 |
333 result.clickCount = 0; | 333 result.clickCount = 0; |
334 | 334 |
335 NSEventType type = [event type]; | 335 NSEventType type = [event type]; |
336 switch (type) { | 336 switch (type) { |
337 case NSMouseExited: | 337 case NSMouseExited: |
338 result.type = blink::WebInputEvent::MouseLeave; | 338 result.type = blink::WebInputEvent::MouseLeave; |
339 result.button = blink::WebMouseEvent::ButtonNone; | 339 result.button = blink::WebMouseEvent::Button::NoButton; |
340 break; | 340 break; |
341 case NSLeftMouseDown: | 341 case NSLeftMouseDown: |
342 result.type = blink::WebInputEvent::MouseDown; | 342 result.type = blink::WebInputEvent::MouseDown; |
343 result.clickCount = [event clickCount]; | 343 result.clickCount = [event clickCount]; |
344 result.button = blink::WebMouseEvent::ButtonLeft; | 344 result.button = blink::WebMouseEvent::Button::Left; |
345 break; | 345 break; |
346 case NSOtherMouseDown: | 346 case NSOtherMouseDown: |
347 result.type = blink::WebInputEvent::MouseDown; | 347 result.type = blink::WebInputEvent::MouseDown; |
348 result.clickCount = [event clickCount]; | 348 result.clickCount = [event clickCount]; |
349 result.button = blink::WebMouseEvent::ButtonMiddle; | 349 result.button = blink::WebMouseEvent::Button::Middle; |
350 break; | 350 break; |
351 case NSRightMouseDown: | 351 case NSRightMouseDown: |
352 result.type = blink::WebInputEvent::MouseDown; | 352 result.type = blink::WebInputEvent::MouseDown; |
353 result.clickCount = [event clickCount]; | 353 result.clickCount = [event clickCount]; |
354 result.button = blink::WebMouseEvent::ButtonRight; | 354 result.button = blink::WebMouseEvent::Button::Right; |
355 break; | 355 break; |
356 case NSLeftMouseUp: | 356 case NSLeftMouseUp: |
357 result.type = blink::WebInputEvent::MouseUp; | 357 result.type = blink::WebInputEvent::MouseUp; |
358 result.clickCount = [event clickCount]; | 358 result.clickCount = [event clickCount]; |
359 result.button = blink::WebMouseEvent::ButtonLeft; | 359 result.button = blink::WebMouseEvent::Button::Left; |
360 break; | 360 break; |
361 case NSOtherMouseUp: | 361 case NSOtherMouseUp: |
362 result.type = blink::WebInputEvent::MouseUp; | 362 result.type = blink::WebInputEvent::MouseUp; |
363 result.clickCount = [event clickCount]; | 363 result.clickCount = [event clickCount]; |
364 result.button = blink::WebMouseEvent::ButtonMiddle; | 364 result.button = blink::WebMouseEvent::Button::Middle; |
365 break; | 365 break; |
366 case NSRightMouseUp: | 366 case NSRightMouseUp: |
367 result.type = blink::WebInputEvent::MouseUp; | 367 result.type = blink::WebInputEvent::MouseUp; |
368 result.clickCount = [event clickCount]; | 368 result.clickCount = [event clickCount]; |
369 result.button = blink::WebMouseEvent::ButtonRight; | 369 result.button = blink::WebMouseEvent::Button::Right; |
370 break; | 370 break; |
371 case NSMouseMoved: | 371 case NSMouseMoved: |
372 case NSMouseEntered: | 372 case NSMouseEntered: |
373 result.type = blink::WebInputEvent::MouseMove; | 373 result.type = blink::WebInputEvent::MouseMove; |
374 break; | 374 break; |
375 case NSLeftMouseDragged: | 375 case NSLeftMouseDragged: |
376 result.type = blink::WebInputEvent::MouseMove; | 376 result.type = blink::WebInputEvent::MouseMove; |
377 result.button = blink::WebMouseEvent::ButtonLeft; | 377 result.button = blink::WebMouseEvent::Button::Left; |
378 break; | 378 break; |
379 case NSOtherMouseDragged: | 379 case NSOtherMouseDragged: |
380 result.type = blink::WebInputEvent::MouseMove; | 380 result.type = blink::WebInputEvent::MouseMove; |
381 result.button = blink::WebMouseEvent::ButtonMiddle; | 381 result.button = blink::WebMouseEvent::Button::Middle; |
382 break; | 382 break; |
383 case NSRightMouseDragged: | 383 case NSRightMouseDragged: |
384 result.type = blink::WebInputEvent::MouseMove; | 384 result.type = blink::WebInputEvent::MouseMove; |
385 result.button = blink::WebMouseEvent::ButtonRight; | 385 result.button = blink::WebMouseEvent::Button::Right; |
386 break; | 386 break; |
387 default: | 387 default: |
388 NOTIMPLEMENTED(); | 388 NOTIMPLEMENTED(); |
389 } | 389 } |
390 | 390 |
391 SetWebEventLocationFromEventInView(&result, event, view); | 391 SetWebEventLocationFromEventInView(&result, event, view); |
392 | 392 |
393 result.modifiers = ModifiersFromEvent(event); | 393 result.modifiers = ModifiersFromEvent(event); |
394 | 394 |
395 result.timeStampSeconds = [event timestamp]; | 395 result.timeStampSeconds = [event timestamp]; |
(...skipping 21 matching lines...) Expand all Loading... |
417 } | 417 } |
418 | 418 |
419 // WebMouseWheelEvent --------------------------------------------------------- | 419 // WebMouseWheelEvent --------------------------------------------------------- |
420 | 420 |
421 blink::WebMouseWheelEvent WebMouseWheelEventBuilder::Build( | 421 blink::WebMouseWheelEvent WebMouseWheelEventBuilder::Build( |
422 NSEvent* event, | 422 NSEvent* event, |
423 NSView* view) { | 423 NSView* view) { |
424 blink::WebMouseWheelEvent result; | 424 blink::WebMouseWheelEvent result; |
425 | 425 |
426 result.type = blink::WebInputEvent::MouseWheel; | 426 result.type = blink::WebInputEvent::MouseWheel; |
427 result.button = blink::WebMouseEvent::ButtonNone; | 427 result.button = blink::WebMouseEvent::Button::NoButton; |
428 | 428 |
429 result.modifiers = ModifiersFromEvent(event); | 429 result.modifiers = ModifiersFromEvent(event); |
430 | 430 |
431 SetWebEventLocationFromEventInView(&result, event, view); | 431 SetWebEventLocationFromEventInView(&result, event, view); |
432 | 432 |
433 // Of Mice and Men | 433 // Of Mice and Men |
434 // --------------- | 434 // --------------- |
435 // | 435 // |
436 // There are three types of scroll data available on a scroll wheel CGEvent. | 436 // There are three types of scroll data available on a scroll wheel CGEvent. |
437 // Apple's documentation ([1]) is rather vague in their differences, and not | 437 // Apple's documentation ([1]) is rather vague in their differences, and not |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 break; | 607 break; |
608 default: | 608 default: |
609 NOTIMPLEMENTED(); | 609 NOTIMPLEMENTED(); |
610 result.type = blink::WebInputEvent::Undefined; | 610 result.type = blink::WebInputEvent::Undefined; |
611 } | 611 } |
612 | 612 |
613 return result; | 613 return result; |
614 } | 614 } |
615 | 615 |
616 } // namespace content | 616 } // namespace content |
OLD | NEW |