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 2777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2788 - (void)touchesBeganWithEvent:(NSEvent*)event { | 2788 - (void)touchesBeganWithEvent:(NSEvent*)event { |
2789 [responderDelegate_ touchesBeganWithEvent:event]; | 2789 [responderDelegate_ touchesBeganWithEvent:event]; |
2790 } | 2790 } |
2791 - (void)touchesCancelledWithEvent:(NSEvent*)event { | 2791 - (void)touchesCancelledWithEvent:(NSEvent*)event { |
2792 [responderDelegate_ touchesCancelledWithEvent:event]; | 2792 [responderDelegate_ touchesCancelledWithEvent:event]; |
2793 } | 2793 } |
2794 - (void)touchesEndedWithEvent:(NSEvent*)event { | 2794 - (void)touchesEndedWithEvent:(NSEvent*)event { |
2795 [responderDelegate_ touchesEndedWithEvent:event]; | 2795 [responderDelegate_ touchesEndedWithEvent:event]; |
2796 } | 2796 } |
2797 | 2797 |
| 2798 // This is invoked only on 10.8 or newer when the user taps a word using |
| 2799 // three fingers. |
| 2800 - (void)quickLookWithEvent:(NSEvent*)event { |
| 2801 NSPoint point = [self convertPoint:[event locationInWindow] fromView:nil]; |
| 2802 TextInputClientMac::GetInstance()->GetStringAtPoint( |
| 2803 renderWidgetHostView_->render_widget_host_, |
| 2804 gfx::Point(point.x, NSHeight([self frame]) - point.y), |
| 2805 ^(NSAttributedString* string, NSPoint baselinePoint) { |
| 2806 if (string && [string length] > 0) { |
| 2807 dispatch_async(dispatch_get_main_queue(), ^{ |
| 2808 [self showDefinitionForAttributedString:string |
| 2809 atPoint:baselinePoint]; |
| 2810 }); |
| 2811 } |
| 2812 } |
| 2813 ); |
| 2814 } |
| 2815 |
2798 // This method handles 2 different types of hardware events. | 2816 // This method handles 2 different types of hardware events. |
2799 // (Apple does not distinguish between them). | 2817 // (Apple does not distinguish between them). |
2800 // a. Scrolling the middle wheel of a mouse. | 2818 // a. Scrolling the middle wheel of a mouse. |
2801 // b. Swiping on the track pad. | 2819 // b. Swiping on the track pad. |
2802 // | 2820 // |
2803 // This method is responsible for 2 types of behavior: | 2821 // This method is responsible for 2 types of behavior: |
2804 // a. Scrolling the content of window. | 2822 // a. Scrolling the content of window. |
2805 // b. Navigating forwards/backwards in history. | 2823 // b. Navigating forwards/backwards in history. |
2806 // | 2824 // |
2807 // This is a brief description of the logic: | 2825 // This is a brief description of the logic: |
(...skipping 1466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4274 CGColorGetConstantColor(kCGColorWhite)); | 4292 CGColorGetConstantColor(kCGColorWhite)); |
4275 CGContextFillRect(context, clipRect); | 4293 CGContextFillRect(context, clipRect); |
4276 } | 4294 } |
4277 } | 4295 } |
4278 | 4296 |
4279 - (void)disableRendering { | 4297 - (void)disableRendering { |
4280 renderWidgetHostView_ = NULL; | 4298 renderWidgetHostView_ = NULL; |
4281 } | 4299 } |
4282 | 4300 |
4283 @end // implementation SoftwareLayer | 4301 @end // implementation SoftwareLayer |
OLD | NEW |