Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Side by Side Diff: chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.mm

Issue 2324593002: [Mac] Fix for security indicator drag&drop navigation (Closed)
Patch Set: Fix for shrike Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 return [windowController toolbarController]; 506 return [windowController toolbarController];
507 } 507 }
508 508
509 // (URLDropTarget protocol) 509 // (URLDropTarget protocol)
510 - (NSDragOperation)draggingEntered:(id<NSDraggingInfo>)sender { 510 - (NSDragOperation)draggingEntered:(id<NSDraggingInfo>)sender {
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
517 bool canDropAtLocation =
518 [[self cell] canDropAtLocationInWindow:[sender draggingLocation]
519 ofView:self];
520 return canDropAtLocation ? [dropHandler_ draggingEntered:sender]
521 : NSDragOperationNone;
517 } 522 }
518 523
519 // (URLDropTarget protocol) 524 // (URLDropTarget protocol)
520 - (NSDragOperation)draggingUpdated:(id<NSDraggingInfo>)sender { 525 - (NSDragOperation)draggingUpdated:(id<NSDraggingInfo>)sender {
521 return [dropHandler_ draggingUpdated:sender]; 526 bool canDropAtLocation =
527 [[self cell] canDropAtLocationInWindow:[sender draggingLocation]
528 ofView:self];
529 return canDropAtLocation ? [dropHandler_ draggingUpdated:sender]
530 : NSDragOperationNone;
522 } 531 }
523 532
524 // (URLDropTarget protocol) 533 // (URLDropTarget protocol)
525 - (void)draggingExited:(id<NSDraggingInfo>)sender { 534 - (void)draggingExited:(id<NSDraggingInfo>)sender {
526 return [dropHandler_ draggingExited:sender]; 535 return [dropHandler_ draggingExited:sender];
527 } 536 }
528 537
529 // (URLDropTarget protocol) 538 // (URLDropTarget protocol)
530 - (BOOL)performDragOperation:(id<NSDraggingInfo>)sender { 539 - (BOOL)performDragOperation:(id<NSDraggingInfo>)sender {
531 return [dropHandler_ performDragOperation:sender]; 540 return [dropHandler_ performDragOperation:sender];
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 NSMinY(frame), 595 NSMinY(frame),
587 suggestWidth, 596 suggestWidth,
588 NSHeight(frame)); 597 NSHeight(frame));
589 598
590 gfx::ScopedNSGraphicsContextSaveGState saveGState; 599 gfx::ScopedNSGraphicsContextSaveGState saveGState;
591 NSRectClip(suggestRect); 600 NSRectClip(suggestRect);
592 [cell drawInteriorWithFrame:frame inView:controlView]; 601 [cell drawInteriorWithFrame:frame inView:controlView];
593 } 602 }
594 603
595 } // namespace autocomplete_text_field 604 } // namespace autocomplete_text_field
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698