OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h" | 5 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #import "base/mac/mac_util.h" | 8 #import "base/mac/mac_util.h" |
9 #import "base/mac/sdk_forward_declarations.h" | 9 #import "base/mac/sdk_forward_declarations.h" |
10 #include "chrome/browser/themes/theme_service.h" | 10 #include "chrome/browser/themes/theme_service.h" |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
511 // Make ourself the first responder, which will select the text to indicate | 511 // Make ourself the first responder, which will select the text to indicate |
512 // that our contents would be replaced by a drop. | 512 // that our contents would be replaced by a drop. |
513 // TODO(viettrungluu): crbug.com/30809 -- this is a hack since it steals focus | 513 // TODO(viettrungluu): crbug.com/30809 -- this is a hack since it steals focus |
514 // and doesn't return it. | 514 // and doesn't return it. |
515 [[self window] makeFirstResponder:self]; | 515 [[self window] makeFirstResponder:self]; |
516 return [dropHandler_ draggingEntered:sender]; | 516 return [dropHandler_ draggingEntered:sender]; |
517 } | 517 } |
518 | 518 |
519 // (URLDropTarget protocol) | 519 // (URLDropTarget protocol) |
520 - (NSDragOperation)draggingUpdated:(id<NSDraggingInfo>)sender { | 520 - (NSDragOperation)draggingUpdated:(id<NSDraggingInfo>)sender { |
521 return [dropHandler_ draggingUpdated:sender]; | 521 bool canDropAtLocation = |
522 [[self cell] canDropAtLocationInWindow:[sender draggingLocation] | |
523 ofView:self]; | |
524 return canDropAtLocation ? [dropHandler_ draggingUpdated:sender] | |
shrike
2016/09/16 18:28:41
I think you need to add canDropAtLocation logic to
spqchan
2016/09/20 21:00:00
Done.
| |
525 : NSDragOperationNone; | |
522 } | 526 } |
523 | 527 |
524 // (URLDropTarget protocol) | 528 // (URLDropTarget protocol) |
525 - (void)draggingExited:(id<NSDraggingInfo>)sender { | 529 - (void)draggingExited:(id<NSDraggingInfo>)sender { |
526 return [dropHandler_ draggingExited:sender]; | 530 return [dropHandler_ draggingExited:sender]; |
527 } | 531 } |
528 | 532 |
529 // (URLDropTarget protocol) | 533 // (URLDropTarget protocol) |
530 - (BOOL)performDragOperation:(id<NSDraggingInfo>)sender { | 534 - (BOOL)performDragOperation:(id<NSDraggingInfo>)sender { |
531 return [dropHandler_ performDragOperation:sender]; | 535 return [dropHandler_ performDragOperation:sender]; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
586 NSMinY(frame), | 590 NSMinY(frame), |
587 suggestWidth, | 591 suggestWidth, |
588 NSHeight(frame)); | 592 NSHeight(frame)); |
589 | 593 |
590 gfx::ScopedNSGraphicsContextSaveGState saveGState; | 594 gfx::ScopedNSGraphicsContextSaveGState saveGState; |
591 NSRectClip(suggestRect); | 595 NSRectClip(suggestRect); |
592 [cell drawInteriorWithFrame:frame inView:controlView]; | 596 [cell drawInteriorWithFrame:frame inView:controlView]; |
593 } | 597 } |
594 | 598 |
595 } // namespace autocomplete_text_field | 599 } // namespace autocomplete_text_field |
OLD | NEW |