| 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 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" | 5 #include "chrome/browser/renderer_host/render_widget_host_view_mac.h" |
| 6 | 6 |
| 7 #include "base/histogram.h" | 7 #include "base/histogram.h" |
| 8 #include "base/sys_string_conversions.h" | 8 #include "base/sys_string_conversions.h" |
| 9 #include "chrome/browser/browser_trial.h" | 9 #include "chrome/browser/browser_trial.h" |
| 10 #import "chrome/browser/cocoa/rwhvm_editcommand_helper.h" | 10 #import "chrome/browser/cocoa/rwhvm_editcommand_helper.h" |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 - (void)keyEvent:(NSEvent *)theEvent { | 427 - (void)keyEvent:(NSEvent *)theEvent { |
| 428 // TODO(avi): Possibly kill self? See RenderWidgetHostViewWin::OnKeyEvent and | 428 // TODO(avi): Possibly kill self? See RenderWidgetHostViewWin::OnKeyEvent and |
| 429 // http://b/issue?id=1192881 . | 429 // http://b/issue?id=1192881 . |
| 430 | 430 |
| 431 NativeWebKeyboardEvent event(theEvent); | 431 NativeWebKeyboardEvent event(theEvent); |
| 432 if (renderWidgetHostView_->render_widget_host_) | 432 if (renderWidgetHostView_->render_widget_host_) |
| 433 renderWidgetHostView_->render_widget_host_->ForwardKeyboardEvent(event); | 433 renderWidgetHostView_->render_widget_host_->ForwardKeyboardEvent(event); |
| 434 } | 434 } |
| 435 | 435 |
| 436 - (void)scrollWheel:(NSEvent *)theEvent { | 436 - (void)scrollWheel:(NSEvent *)theEvent { |
| 437 // On Windows, popups are implemented with a popup window style, so that when |
| 438 // an event comes in that would "cancel" it, it receives the OnCancelMode |
| 439 // message and can kill itself. Alas, on the Mac, views cannot capture events |
| 440 // outside of themselves. While a click outside a popup kills it, that's just |
| 441 // a defocusing of the text field in WebCore and our editor client kills the |
| 442 // popup. But a scroll wheel event outside a popup must kill it. |
| 443 // |
| 444 // Thus this lovely case of filicide. If this view can be the key view, it is |
| 445 // not a popup. Therefore, if it has any children, they are popups that need |
| 446 // to be canceled. |
| 447 if (canBeKeyView_) { |
| 448 for (NSView* subview in [self subviews]) { |
| 449 ((RenderWidgetHostViewCocoa*)subview)->renderWidgetHostView_->KillSelf(); |
| 450 } |
| 451 } |
| 452 |
| 437 const WebMouseWheelEvent& event = | 453 const WebMouseWheelEvent& event = |
| 438 WebInputEventFactory::mouseWheelEvent(theEvent, self); | 454 WebInputEventFactory::mouseWheelEvent(theEvent, self); |
| 439 if (renderWidgetHostView_->render_widget_host_) | 455 if (renderWidgetHostView_->render_widget_host_) |
| 440 renderWidgetHostView_->render_widget_host_->ForwardWheelEvent(event); | 456 renderWidgetHostView_->render_widget_host_->ForwardWheelEvent(event); |
| 441 } | 457 } |
| 442 | 458 |
| 443 - (void)setFrame:(NSRect)frameRect { | 459 - (void)setFrame:(NSRect)frameRect { |
| 444 [super setFrame:frameRect]; | 460 [super setFrame:frameRect]; |
| 445 if (renderWidgetHostView_->render_widget_host_) | 461 if (renderWidgetHostView_->render_widget_host_) |
| 446 renderWidgetHostView_->render_widget_host_->WasResized(); | 462 renderWidgetHostView_->render_widget_host_->WasResized(); |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 770 // NSView calls this to get the text when displaying the tooltip. | 786 // NSView calls this to get the text when displaying the tooltip. |
| 771 - (NSString *)view:(NSView *)view | 787 - (NSString *)view:(NSView *)view |
| 772 stringForToolTip:(NSToolTipTag)tag | 788 stringForToolTip:(NSToolTipTag)tag |
| 773 point:(NSPoint)point | 789 point:(NSPoint)point |
| 774 userData:(void *)data { | 790 userData:(void *)data { |
| 775 return [[toolTip_ copy] autorelease]; | 791 return [[toolTip_ copy] autorelease]; |
| 776 } | 792 } |
| 777 | 793 |
| 778 @end | 794 @end |
| 779 | 795 |
| OLD | NEW |