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 LocationBarDecoration* decoration = | |
522 [[self cell] decorationForEvent:[NSApp currentEvent] | |
shrike
2016/09/07 23:49:27
Relying on [NSApp currentEvent] for the drag event
spqchan
2016/09/08 17:41:43
Done.
| |
523 inRect:[self bounds] | |
524 ofView:self]; | |
525 if (decoration) | |
526 return NSDragOperationNone; | |
527 | |
521 return [dropHandler_ draggingUpdated:sender]; | 528 return [dropHandler_ draggingUpdated:sender]; |
522 } | 529 } |
523 | 530 |
524 // (URLDropTarget protocol) | 531 // (URLDropTarget protocol) |
525 - (void)draggingExited:(id<NSDraggingInfo>)sender { | 532 - (void)draggingExited:(id<NSDraggingInfo>)sender { |
526 return [dropHandler_ draggingExited:sender]; | 533 return [dropHandler_ draggingExited:sender]; |
527 } | 534 } |
528 | 535 |
529 // (URLDropTarget protocol) | 536 // (URLDropTarget protocol) |
530 - (BOOL)performDragOperation:(id<NSDraggingInfo>)sender { | 537 - (BOOL)performDragOperation:(id<NSDraggingInfo>)sender { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
586 NSMinY(frame), | 593 NSMinY(frame), |
587 suggestWidth, | 594 suggestWidth, |
588 NSHeight(frame)); | 595 NSHeight(frame)); |
589 | 596 |
590 gfx::ScopedNSGraphicsContextSaveGState saveGState; | 597 gfx::ScopedNSGraphicsContextSaveGState saveGState; |
591 NSRectClip(suggestRect); | 598 NSRectClip(suggestRect); |
592 [cell drawInteriorWithFrame:frame inView:controlView]; | 599 [cell drawInteriorWithFrame:frame inView:controlView]; |
593 } | 600 } |
594 | 601 |
595 } // namespace autocomplete_text_field | 602 } // namespace autocomplete_text_field |
OLD | NEW |