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 3401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3412 | 3412 |
3413 // Overriding a NSResponder method to support application services. | 3413 // Overriding a NSResponder method to support application services. |
3414 | 3414 |
3415 - (id)validRequestorForSendType:(NSString*)sendType | 3415 - (id)validRequestorForSendType:(NSString*)sendType |
3416 returnType:(NSString*)returnType { | 3416 returnType:(NSString*)returnType { |
3417 id requestor = nil; | 3417 id requestor = nil; |
3418 BOOL sendTypeIsString = [sendType isEqual:NSStringPboardType]; | 3418 BOOL sendTypeIsString = [sendType isEqual:NSStringPboardType]; |
3419 BOOL returnTypeIsString = [returnType isEqual:NSStringPboardType]; | 3419 BOOL returnTypeIsString = [returnType isEqual:NSStringPboardType]; |
3420 const content::TextInputManager::TextSelection* selection = | 3420 const content::TextInputManager::TextSelection* selection = |
3421 renderWidgetHostView_->GetTextSelection(); | 3421 renderWidgetHostView_->GetTextSelection(); |
3422 BOOL hasText = !selection || selection->selected_text().empty(); | 3422 BOOL hasText = selection && !selection->selected_text().empty(); |
EhsanK
2017/03/06 16:15:13
Before the refactoring we had:
BOOL hasText = !re
Avi (use Gerrit)
2017/03/06 16:21:12
Acknowledged.
| |
3423 BOOL takesText = | 3423 BOOL takesText = |
3424 renderWidgetHostView_->GetTextInputType() != ui::TEXT_INPUT_TYPE_NONE; | 3424 renderWidgetHostView_->GetTextInputType() != ui::TEXT_INPUT_TYPE_NONE; |
3425 | 3425 |
3426 if (sendTypeIsString && hasText && !returnType) { | 3426 if (sendTypeIsString && hasText && !returnType) { |
3427 requestor = self; | 3427 requestor = self; |
3428 } else if (!sendType && returnTypeIsString && takesText) { | 3428 } else if (!sendType && returnTypeIsString && takesText) { |
3429 requestor = self; | 3429 requestor = self; |
3430 } else if (sendTypeIsString && returnTypeIsString && hasText && takesText) { | 3430 } else if (sendTypeIsString && returnTypeIsString && hasText && takesText) { |
3431 requestor = self; | 3431 requestor = self; |
3432 } else { | 3432 } else { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3489 | 3489 |
3490 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding | 3490 // "-webkit-app-region: drag | no-drag" is implemented on Mac by excluding |
3491 // regions that are not draggable. (See ControlRegionView in | 3491 // regions that are not draggable. (See ControlRegionView in |
3492 // native_app_window_cocoa.mm). This requires the render host view to be | 3492 // native_app_window_cocoa.mm). This requires the render host view to be |
3493 // draggable by default. | 3493 // draggable by default. |
3494 - (BOOL)mouseDownCanMoveWindow { | 3494 - (BOOL)mouseDownCanMoveWindow { |
3495 return YES; | 3495 return YES; |
3496 } | 3496 } |
3497 | 3497 |
3498 @end | 3498 @end |
OLD | NEW |