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 <Carbon/Carbon.h> | 7 #import <Carbon/Carbon.h> |
8 #import <objc/runtime.h> | 8 #import <objc/runtime.h> |
9 #include <OpenGL/gl.h> | 9 #include <OpenGL/gl.h> |
10 #include <QuartzCore/QuartzCore.h> | 10 #include <QuartzCore/QuartzCore.h> |
(...skipping 3404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3415 | 3415 |
3416 // Overriding a NSResponder method to support application services. | 3416 // Overriding a NSResponder method to support application services. |
3417 | 3417 |
3418 - (id)validRequestorForSendType:(NSString*)sendType | 3418 - (id)validRequestorForSendType:(NSString*)sendType |
3419 returnType:(NSString*)returnType { | 3419 returnType:(NSString*)returnType { |
3420 id requestor = nil; | 3420 id requestor = nil; |
3421 BOOL sendTypeIsString = [sendType isEqual:NSStringPboardType]; | 3421 BOOL sendTypeIsString = [sendType isEqual:NSStringPboardType]; |
3422 BOOL returnTypeIsString = [returnType isEqual:NSStringPboardType]; | 3422 BOOL returnTypeIsString = [returnType isEqual:NSStringPboardType]; |
3423 const content::TextInputManager::TextSelection* selection = | 3423 const content::TextInputManager::TextSelection* selection = |
3424 renderWidgetHostView_->GetTextSelection(); | 3424 renderWidgetHostView_->GetTextSelection(); |
3425 BOOL hasText = !selection || selection->selected_text().empty(); | 3425 BOOL hasText = selection && !selection->selected_text().empty(); |
3426 BOOL takesText = | 3426 BOOL takesText = |
3427 renderWidgetHostView_->GetTextInputType() != ui::TEXT_INPUT_TYPE_NONE; | 3427 renderWidgetHostView_->GetTextInputType() != ui::TEXT_INPUT_TYPE_NONE; |
3428 | 3428 |
3429 if (sendTypeIsString && hasText && !returnType) { | 3429 if (sendTypeIsString && hasText && !returnType) { |
3430 requestor = self; | 3430 requestor = self; |
3431 } else if (!sendType && returnTypeIsString && takesText) { | 3431 } else if (!sendType && returnTypeIsString && takesText) { |
3432 requestor = self; | 3432 requestor = self; |
3433 } else if (sendTypeIsString && returnTypeIsString && hasText && takesText) { | 3433 } else if (sendTypeIsString && returnTypeIsString && hasText && takesText) { |
3434 requestor = self; | 3434 requestor = self; |
3435 } else { | 3435 } else { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3492 | 3492 |
3493 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding | 3493 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding |
3494 // regions that are not draggable. (See ControlRegionView in | 3494 // regions that are not draggable. (See ControlRegionView in |
3495 // native_app_window_cocoa.mm). This requires the render host view to be | 3495 // native_app_window_cocoa.mm). This requires the render host view to be |
3496 // draggable by default. | 3496 // draggable by default. |
3497 - (BOOL)mouseDownCanMoveWindow { | 3497 - (BOOL)mouseDownCanMoveWindow { |
3498 return YES; | 3498 return YES; |
3499 } | 3499 } |
3500 | 3500 |
3501 @end | 3501 @end |
OLD | NEW |