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

Unified Diff: chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm

Issue 233623002: Shows the info bubble when the location bar icon is clicked in the origin chip. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase. Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm
diff --git a/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm b/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm
index 16d56a8b9b7a725811913f92cf5e0d6683726851..34f2fc6742079f980ba9fe73f9f2460d804de39b 100644
--- a/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm
+++ b/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm
@@ -501,31 +501,40 @@ size_t CalculatePositionsInFrame(
// Track the mouse until the user releases the button.
[self trackMouse:theEvent
- inRect:cellFrame
+ inRect:decorationRect
ofView:controlView
untilMouseUp:YES];
+ const NSPoint mouseLocation = [[NSApp currentEvent] locationInWindow];
+ const NSPoint point = [controlView convertPoint:mouseLocation fromView:nil];
+
// Post delayed focus notification, if necessary.
- if (focusEvent.get())
+ if (focusEvent.get() && !button->PreventFocus(point))
[self focusNotificationFor:focusEvent ofView:controlView];
+ focusEvent.reset();
// Set the proper state (hover or normal) once the mouse has been released,
// and call |OnMousePressed| if the button was released while the mouse was
// within the bounds of the button.
- const NSPoint mouseLocation = [[NSApp currentEvent] locationInWindow];
- const NSPoint point = [controlView convertPoint:mouseLocation fromView:nil];
if (NSMouseInRect(point, decorationRect, [controlView isFlipped])) {
button->SetButtonState(ButtonDecoration::kButtonStateHover);
[controlView setNeedsDisplay:YES];
- handled = decoration->AsButtonDecoration()->OnMousePressed(
- [self frameForDecoration:decoration inFrame:cellFrame]);
+ handled = decoration->OnMousePressed(
+ [self frameForDecoration:decoration inFrame:cellFrame],
+ NSMakePoint(point.x - decorationRect.origin.x,
+ point.y - decorationRect.origin.y));
} else {
button->SetButtonState(ButtonDecoration::kButtonStateNormal);
[controlView setNeedsDisplay:YES];
handled = true;
}
} else {
- handled = decoration->OnMousePressed(decorationRect);
+ const NSPoint mouseLocation = [theEvent locationInWindow];
+ const NSPoint point = [controlView convertPoint:mouseLocation fromView:nil];
+ handled = decoration->OnMousePressed(
+ decorationRect,
+ NSMakePoint(point.x - decorationRect.origin.x,
+ point.y - decorationRect.origin.y));
}
return handled ? YES : NO;
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698