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

Unified Diff: chrome/browser/cocoa/autocomplete_text_field.mm

Issue 427009: Preliminary work toward page actions on Mac. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years 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/cocoa/autocomplete_text_field_cell.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/autocomplete_text_field.mm
===================================================================
--- chrome/browser/cocoa/autocomplete_text_field.mm (revision 34193)
+++ chrome/browser/cocoa/autocomplete_text_field.mm (working copy)
@@ -65,7 +65,7 @@
// decoration area. This allows the user to click-drag starting from
// a decoration area and get the expected selection behaviour,
// likewise for multiple clicks in those areas.
-- (void)mouseDown:(NSEvent *)theEvent {
+- (void)mouseDown:(NSEvent*)theEvent {
const NSPoint locationInWindow = [theEvent locationInWindow];
const NSPoint location = [self convertPoint:locationInWindow fromView:nil];
@@ -108,14 +108,26 @@
return;
}
- // Check to see if the user clicked the security hint icon in the cell. If so,
- // we need to display the page info window.
+ // If the user clicked the security hint icon in the cell, display the page
+ // info window.
const NSRect hintIconFrame = [cell securityImageFrameForFrame:[self bounds]];
if (NSMouseInRect(location, hintIconFrame, [self isFlipped])) {
[cell onSecurityIconMousePressed];
return;
}
+ // If the user clicked a Page Action icon, execute its action.
+ const NSRect iconFrame([self bounds]);
+ const size_t pageActionCount = [cell pageActionCount];
+ for (size_t i = 0; i < pageActionCount; ++i) {
+ NSRect pageActionFrame = [cell pageActionFrameForIndex:i inFrame:iconFrame];
+ if (NSMouseInRect(location, pageActionFrame, [self isFlipped])) {
+ // TODO(pamg): Do we need to send the event?
+ [cell onPageActionMousePressedIn:pageActionFrame forIndex:i];
+ return;
+ }
+ }
+
NSText* editor = [self currentEditor];
// We should only be here if we accepted first-responder status and
« no previous file with comments | « no previous file | chrome/browser/cocoa/autocomplete_text_field_cell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698