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 2781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2792 - (void)touchesBeganWithEvent:(NSEvent*)event { | 2792 - (void)touchesBeganWithEvent:(NSEvent*)event { |
2793 [responderDelegate_ touchesBeganWithEvent:event]; | 2793 [responderDelegate_ touchesBeganWithEvent:event]; |
2794 } | 2794 } |
2795 - (void)touchesCancelledWithEvent:(NSEvent*)event { | 2795 - (void)touchesCancelledWithEvent:(NSEvent*)event { |
2796 [responderDelegate_ touchesCancelledWithEvent:event]; | 2796 [responderDelegate_ touchesCancelledWithEvent:event]; |
2797 } | 2797 } |
2798 - (void)touchesEndedWithEvent:(NSEvent*)event { | 2798 - (void)touchesEndedWithEvent:(NSEvent*)event { |
2799 [responderDelegate_ touchesEndedWithEvent:event]; | 2799 [responderDelegate_ touchesEndedWithEvent:event]; |
2800 } | 2800 } |
2801 | 2801 |
| 2802 // This is invoked only on 10.8 or newer when the user taps a word using |
| 2803 // three fingers. |
| 2804 - (void)quickLookWithEvent:(NSEvent*)event { |
| 2805 NSPoint point = [self convertPoint:[event locationInWindow] fromView:nil]; |
| 2806 TextInputClientMac::GetInstance()->GetStringAtPoint( |
| 2807 renderWidgetHostView_->render_widget_host_, |
| 2808 gfx::Point(point.x, NSHeight([self frame]) - point.y), |
| 2809 ^(NSAttributedString* string, NSPoint baselinePoint) { |
| 2810 if (string && [string length] > 0) { |
| 2811 dispatch_async(dispatch_get_main_queue(), ^{ |
| 2812 [self showDefinitionForAttributedString:string |
| 2813 atPoint:baselinePoint]; |
| 2814 }); |
| 2815 } |
| 2816 } |
| 2817 ); |
| 2818 } |
| 2819 |
2802 // This method handles 2 different types of hardware events. | 2820 // This method handles 2 different types of hardware events. |
2803 // (Apple does not distinguish between them). | 2821 // (Apple does not distinguish between them). |
2804 // a. Scrolling the middle wheel of a mouse. | 2822 // a. Scrolling the middle wheel of a mouse. |
2805 // b. Swiping on the track pad. | 2823 // b. Swiping on the track pad. |
2806 // | 2824 // |
2807 // This method is responsible for 2 types of behavior: | 2825 // This method is responsible for 2 types of behavior: |
2808 // a. Scrolling the content of window. | 2826 // a. Scrolling the content of window. |
2809 // b. Navigating forwards/backwards in history. | 2827 // b. Navigating forwards/backwards in history. |
2810 // | 2828 // |
2811 // This is a brief description of the logic: | 2829 // This is a brief description of the logic: |
(...skipping 1450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4262 CGColorGetConstantColor(kCGColorWhite)); | 4280 CGColorGetConstantColor(kCGColorWhite)); |
4263 CGContextFillRect(context, clipRect); | 4281 CGContextFillRect(context, clipRect); |
4264 } | 4282 } |
4265 } | 4283 } |
4266 | 4284 |
4267 - (void)disableRendering { | 4285 - (void)disableRendering { |
4268 renderWidgetHostView_ = NULL; | 4286 renderWidgetHostView_ = NULL; |
4269 } | 4287 } |
4270 | 4288 |
4271 @end // implementation SoftwareLayer | 4289 @end // implementation SoftwareLayer |
OLD | NEW |