| OLD | NEW |
| 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 "content/browser/renderer_host/render_widget_host_view_mac.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h" |
| 6 | 6 |
| 7 #import <objc/runtime.h> | 7 #import <objc/runtime.h> |
| 8 #include <QuartzCore/QuartzCore.h> | 8 #include <QuartzCore/QuartzCore.h> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 2609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2620 - (void)touchesBeganWithEvent:(NSEvent*)event { | 2620 - (void)touchesBeganWithEvent:(NSEvent*)event { |
| 2621 [responderDelegate_ touchesBeganWithEvent:event]; | 2621 [responderDelegate_ touchesBeganWithEvent:event]; |
| 2622 } | 2622 } |
| 2623 - (void)touchesCancelledWithEvent:(NSEvent*)event { | 2623 - (void)touchesCancelledWithEvent:(NSEvent*)event { |
| 2624 [responderDelegate_ touchesCancelledWithEvent:event]; | 2624 [responderDelegate_ touchesCancelledWithEvent:event]; |
| 2625 } | 2625 } |
| 2626 - (void)touchesEndedWithEvent:(NSEvent*)event { | 2626 - (void)touchesEndedWithEvent:(NSEvent*)event { |
| 2627 [responderDelegate_ touchesEndedWithEvent:event]; | 2627 [responderDelegate_ touchesEndedWithEvent:event]; |
| 2628 } | 2628 } |
| 2629 | 2629 |
| 2630 - (void)quickLookWithEvent:(NSEvent*)event { |
| 2631 NSPoint point = [self convertPoint:[event locationInWindow] fromView:nil]; |
| 2632 TextInputClientMac::GetInstance()->GetStringAtPoint( |
| 2633 renderWidgetHostView_->render_widget_host_, |
| 2634 gfx::Point(point.x, NSHeight([self frame]) - point.y), |
| 2635 ^(NSAttributedString* string, NSRect rect){ |
| 2636 DCHECK([NSThread isMainThread]); |
| 2637 if (string) { |
| 2638 NSPoint stringPoint = rect.origin; |
| 2639 stringPoint.y = NSHeight([self frame]) - NSMaxY(rect); |
| 2640 [self showDefinitionForAttributedString:string atPoint:stringPoint]; |
| 2641 } |
| 2642 } |
| 2643 ); |
| 2644 } |
| 2645 |
| 2630 // This method handles 2 different types of hardware events. | 2646 // This method handles 2 different types of hardware events. |
| 2631 // (Apple does not distinguish between them). | 2647 // (Apple does not distinguish between them). |
| 2632 // a. Scrolling the middle wheel of a mouse. | 2648 // a. Scrolling the middle wheel of a mouse. |
| 2633 // b. Swiping on the track pad. | 2649 // b. Swiping on the track pad. |
| 2634 // | 2650 // |
| 2635 // This method is responsible for 2 types of behavior: | 2651 // This method is responsible for 2 types of behavior: |
| 2636 // a. Scrolling the content of window. | 2652 // a. Scrolling the content of window. |
| 2637 // b. Navigating forwards/backwards in history. | 2653 // b. Navigating forwards/backwards in history. |
| 2638 // | 2654 // |
| 2639 // This is a brief description of the logic: | 2655 // This is a brief description of the logic: |
| (...skipping 1453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4093 return YES; | 4109 return YES; |
| 4094 } | 4110 } |
| 4095 | 4111 |
| 4096 - (BOOL)isOpaque { | 4112 - (BOOL)isOpaque { |
| 4097 if (renderWidgetHostView_->use_core_animation_) | 4113 if (renderWidgetHostView_->use_core_animation_) |
| 4098 return YES; | 4114 return YES; |
| 4099 return [super isOpaque]; | 4115 return [super isOpaque]; |
| 4100 } | 4116 } |
| 4101 | 4117 |
| 4102 @end | 4118 @end |
| OLD | NEW |