Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #import "ui/views/cocoa/bridged_content_view.h" | 5 #import "ui/views/cocoa/bridged_content_view.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #import "base/mac/mac_util.h" | 8 #import "base/mac/mac_util.h" |
| 9 #import "base/mac/scoped_nsobject.h" | 9 #import "base/mac/scoped_nsobject.h" |
| 10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 298 } | 298 } |
| 299 | 299 |
| 300 - (void)clearView { | 300 - (void)clearView { |
| 301 textInputClient_ = nullptr; | 301 textInputClient_ = nullptr; |
| 302 hostedView_ = nullptr; | 302 hostedView_ = nullptr; |
| 303 [[NSDistributedNotificationCenter defaultCenter] removeObserver:self]; | 303 [[NSDistributedNotificationCenter defaultCenter] removeObserver:self]; |
| 304 [cursorTrackingArea_.get() clearOwner]; | 304 [cursorTrackingArea_.get() clearOwner]; |
| 305 [self removeTrackingArea:cursorTrackingArea_.get()]; | 305 [self removeTrackingArea:cursorTrackingArea_.get()]; |
| 306 } | 306 } |
| 307 | 307 |
| 308 - (void)resendCapturedMouseEvent:(NSEvent*)theEvent { | |
|
tapted
2016/09/19 00:31:01
I think this method has no effect in combination w
snake
2016/09/20 15:04:26
We can use #if !defined(TOOLKIT_VIEWS) macros in b
tapted
2016/09/21 10:07:05
TOOLKIT_VIEWS is always defined on Mac, so that wo
snake
2016/09/21 12:29:52
Done.
| |
| 309 // We should resend messages by type, to correct processing it in | |
| 310 // base_view.mm. | |
| 311 switch ([theEvent type]) { | |
| 312 case NSLeftMouseDown: | |
| 313 [self mouseDown:theEvent]; | |
| 314 break; | |
| 315 case NSLeftMouseUp: | |
| 316 [self mouseUp:theEvent]; | |
| 317 break; | |
| 318 case NSRightMouseDown: | |
| 319 [self rightMouseDown:theEvent]; | |
| 320 break; | |
| 321 case NSRightMouseUp: | |
| 322 [self rightMouseUp:theEvent]; | |
| 323 break; | |
| 324 case NSOtherMouseDown: | |
| 325 [self otherMouseDown:theEvent]; | |
| 326 break; | |
| 327 case NSOtherMouseUp: | |
| 328 [self otherMouseUp:theEvent]; | |
| 329 break; | |
| 330 case NSMouseMoved: | |
| 331 [self mouseMoved:theEvent]; | |
| 332 break; | |
| 333 case NSLeftMouseDragged: | |
| 334 [self mouseDragged:theEvent]; | |
| 335 break; | |
| 336 case NSRightMouseDragged: | |
| 337 [self rightMouseDragged:theEvent]; | |
| 338 break; | |
| 339 case NSOtherMouseDragged: | |
| 340 [self otherMouseDragged:theEvent]; | |
| 341 break; | |
| 342 case NSMouseEntered: | |
| 343 [self mouseEntered:theEvent]; | |
| 344 break; | |
| 345 case NSMouseExited: | |
| 346 [self mouseExited:theEvent]; | |
| 347 break; | |
| 348 default: | |
| 349 [self mouseEvent:theEvent]; | |
| 350 } | |
| 351 } | |
| 352 | |
| 308 - (void)processCapturedMouseEvent:(NSEvent*)theEvent { | 353 - (void)processCapturedMouseEvent:(NSEvent*)theEvent { |
| 309 if (!hostedView_) | 354 if (!hostedView_) |
| 310 return; | 355 return; |
| 311 | 356 |
| 312 NSWindow* source = [theEvent window]; | 357 NSWindow* source = [theEvent window]; |
| 313 NSWindow* target = [self window]; | 358 NSWindow* target = [self window]; |
| 314 DCHECK(target); | 359 DCHECK(target); |
| 315 | 360 |
| 316 // If it's the view's window, process normally. | 361 // If it's the view's window, process normally. |
| 317 if ([target isEqual:source]) { | 362 if ([target isEqual:source]) { |
| 318 [self mouseEvent:theEvent]; | 363 [self resendCapturedMouseEvent:theEvent]; |
| 319 return; | 364 return; |
| 320 } | 365 } |
| 321 | 366 |
| 322 ui::MouseEvent event(theEvent); | 367 ui::MouseEvent event(theEvent); |
| 323 event.set_location( | 368 event.set_location( |
| 324 MovePointToWindow([theEvent locationInWindow], source, target)); | 369 MovePointToWindow([theEvent locationInWindow], source, target)); |
| 325 hostedView_->GetWidget()->OnMouseEvent(&event); | 370 hostedView_->GetWidget()->OnMouseEvent(&event); |
| 326 } | 371 } |
| 327 | 372 |
| 328 - (void)updateTooltipIfRequiredAt:(const gfx::Point&)locationInContent { | 373 - (void)updateTooltipIfRequiredAt:(const gfx::Point&)locationInContent { |
| (...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1356 } | 1401 } |
| 1357 | 1402 |
| 1358 return [super accessibilityAttributeValue:attribute]; | 1403 return [super accessibilityAttributeValue:attribute]; |
| 1359 } | 1404 } |
| 1360 | 1405 |
| 1361 - (id)accessibilityHitTest:(NSPoint)point { | 1406 - (id)accessibilityHitTest:(NSPoint)point { |
| 1362 return [hostedView_->GetNativeViewAccessible() accessibilityHitTest:point]; | 1407 return [hostedView_->GetNativeViewAccessible() accessibilityHitTest:point]; |
| 1363 } | 1408 } |
| 1364 | 1409 |
| 1365 @end | 1410 @end |
| OLD | NEW |