| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <Carbon/Carbon.h> | 5 #import <Carbon/Carbon.h> |
| 6 | 6 |
| 7 #include "chrome/browser/tab_contents/tab_contents_view_mac.h" | 7 #include "chrome/browser/tab_contents/tab_contents_view_mac.h" |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 DCHECK([rwhv isKindOfClass:[RenderWidgetHostViewCocoa class]]); | 399 DCHECK([rwhv isKindOfClass:[RenderWidgetHostViewCocoa class]]); |
| 400 [rwhv setIgnoreKeyEvents:YES]; | 400 [rwhv setIgnoreKeyEvents:YES]; |
| 401 BOOL eventHandled = [window redispatchEvent:event]; | 401 BOOL eventHandled = [window redispatchEvent:event]; |
| 402 [rwhv setIgnoreKeyEvents:NO]; | 402 [rwhv setIgnoreKeyEvents:NO]; |
| 403 return eventHandled; | 403 return eventHandled; |
| 404 } | 404 } |
| 405 | 405 |
| 406 - (void)mouseEvent:(NSEvent *)theEvent { | 406 - (void)mouseEvent:(NSEvent *)theEvent { |
| 407 TabContents* tabContents = [self tabContents]; | 407 TabContents* tabContents = [self tabContents]; |
| 408 if (tabContents->delegate()) { | 408 if (tabContents->delegate()) { |
| 409 NSPoint location = [NSEvent mouseLocation]; |
| 409 if ([theEvent type] == NSMouseMoved) | 410 if ([theEvent type] == NSMouseMoved) |
| 410 tabContents->delegate()->ContentsMouseEvent(tabContents, true); | 411 tabContents->delegate()->ContentsMouseEvent( |
| 412 tabContents, gfx::Point(location.x, location.y), true); |
| 411 if ([theEvent type] == NSMouseExited) | 413 if ([theEvent type] == NSMouseExited) |
| 412 tabContents->delegate()->ContentsMouseEvent(tabContents, false); | 414 tabContents->delegate()->ContentsMouseEvent( |
| 415 tabContents, gfx::Point(location.x, location.y), false); |
| 413 } | 416 } |
| 414 } | 417 } |
| 415 | 418 |
| 416 - (BOOL)mouseDownCanMoveWindow { | 419 - (BOOL)mouseDownCanMoveWindow { |
| 417 // This is needed to prevent mouseDowns from moving the window | 420 // This is needed to prevent mouseDowns from moving the window |
| 418 // around. The default implementation returns YES only for opaque | 421 // around. The default implementation returns YES only for opaque |
| 419 // views. TabContentsViewCocoa does not draw itself in any way, but | 422 // views. TabContentsViewCocoa does not draw itself in any way, but |
| 420 // its subviews do paint their entire frames. Returning NO here | 423 // its subviews do paint their entire frames. Returning NO here |
| 421 // saves us the effort of overriding this method in every possible | 424 // saves us the effort of overriding this method in every possible |
| 422 // subview. | 425 // subview. |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 } | 534 } |
| 532 | 535 |
| 533 - (void)closeTabAfterEvent { | 536 - (void)closeTabAfterEvent { |
| 534 tabContentsView_->CloseTab(); | 537 tabContentsView_->CloseTab(); |
| 535 } | 538 } |
| 536 | 539 |
| 537 // Tons of stuff goes here, where we grab events going on in Cocoaland and send | 540 // Tons of stuff goes here, where we grab events going on in Cocoaland and send |
| 538 // them into the C++ system. TODO(avi): all that jazz | 541 // them into the C++ system. TODO(avi): all that jazz |
| 539 | 542 |
| 540 @end | 543 @end |
| OLD | NEW |