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

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

Issue 600133: Mac: Content blocked icons. (Closed)
Patch Set: comments andybons Created 10 years, 10 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 | « chrome/app/nibs/Preferences.xib ('k') | 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
diff --git a/chrome/browser/cocoa/autocomplete_text_field.mm b/chrome/browser/cocoa/autocomplete_text_field.mm
index 2f263f75c65203150f6efd59949a10308badb34b..488a8f2f698d80b893a3cff614fbec1d79b54f04 100644
--- a/chrome/browser/cocoa/autocomplete_text_field.mm
+++ b/chrome/browser/cocoa/autocomplete_text_field.mm
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -115,21 +115,12 @@
return;
}
- // If the user clicked the security hint icon in the cell, display the page
- // info window.
- const NSRect hintIconFrame = [cell securityImageFrameForFrame:bounds];
- if (NSMouseInRect(location, hintIconFrame, flipped)) {
- [cell onSecurityIconMousePressed];
- return;
- }
-
+ // If the user clicked on one of the icons (security icon, Page Actions, etc),
+ // let the icon handle the click.
const BOOL ctrlKey = ([theEvent modifierFlags] & NSControlKeyMask) != 0;
- // If the user left-clicked a Page Action icon, execute its action.
- const size_t pageActionCount = [cell pageActionCount];
- for (size_t i = 0; i < pageActionCount; ++i) {
- NSRect pageActionFrame = [cell pageActionFrameForIndex:i inFrame:bounds];
- if (NSMouseInRect(location, pageActionFrame, flipped) && !ctrlKey) {
- [cell onPageActionMousePressedIn:pageActionFrame forIndex:i];
+ for (AutocompleteTextFieldIcon* icon in [cell layedOutIcons:bounds]) {
+ if (NSMouseInRect(location, [icon rect], flipped) && !ctrlKey) {
+ [icon view]->OnMousePressed([icon rect]);
return;
}
}
@@ -204,14 +195,8 @@
[self addCursorRect:fieldBounds cursor:[NSCursor IBeamCursor]];
AutocompleteTextFieldCell* cell = [self autocompleteTextFieldCell];
- NSRect iconRect = [cell securityImageFrameForFrame:fieldBounds];
- [self addCursorRect:iconRect cursor:[NSCursor arrowCursor]];
-
- const size_t pageActionCount = [cell pageActionCount];
- for (size_t i = 0; i < pageActionCount; ++i) {
- iconRect = [cell pageActionFrameForIndex:i inFrame:fieldBounds];
- [self addCursorRect:iconRect cursor:[NSCursor arrowCursor]];
- }
+ for (AutocompleteTextFieldIcon* icon in [cell layedOutIcons:fieldBounds])
+ [self addCursorRect:[icon rect] cursor:[NSCursor arrowCursor]];
}
- (void)updateCursorAndToolTipRects {
@@ -226,14 +211,13 @@
[currentToolTips_ removeAllObjects];
AutocompleteTextFieldCell* cell = [self autocompleteTextFieldCell];
- const size_t pageActionCount = [cell pageActionCount];
- for (size_t i = 0; i < pageActionCount; ++i) {
- NSRect iconRect = [cell pageActionFrameForIndex:i inFrame:[self bounds]];
- NSString* tooltip = [cell pageActionToolTipForIndex:i];
+ for (AutocompleteTextFieldIcon* icon in [cell layedOutIcons:[self bounds]]) {
+ NSRect iconRect = [icon rect];
+ NSString* tooltip = [icon view]->GetToolTip();
if (!tooltip)
continue;
- // -[NSView addToolTipRect:owner:userData] does _not_ retain the owner!
+ // -[NSView addToolTipRect:owner:userData] does _not_ retain its |owner:|.
// Put the string in a collection so it can't be dealloced while in use.
[currentToolTips_ addObject:tooltip];
[self addToolTipRect:iconRect owner:tooltip userData:nil];
« no previous file with comments | « chrome/app/nibs/Preferences.xib ('k') | chrome/browser/cocoa/autocomplete_text_field_cell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698