summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/autocomplete_text_field_cell.h
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-16 23:45:38 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-16 23:45:38 +0000
commit3263b45534a37c63cbc6d43506cf8cd9bb30bbef (patch)
tree08e2c955f659f9e518847b7e80e439c9f7a27ba0 /chrome/browser/cocoa/autocomplete_text_field_cell.h
parent7803a0551ee242b5da6f646f1165276e13514818 (diff)
downloadchromium_src-3263b45534a37c63cbc6d43506cf8cd9bb30bbef.zip
chromium_src-3263b45534a37c63cbc6d43506cf8cd9bb30bbef.tar.gz
chromium_src-3263b45534a37c63cbc6d43506cf8cd9bb30bbef.tar.bz2
Mac: Content blocked icons.
Also rewrite how omnibox icons are handled, to make it less repetitive to add the content blocked icons. Remove a O(n^2) while I'm at it. BUG=35594,34894 TEST=Go to a page with popups. "popups blocked" icon should appear in omnibox. It should have a tooltip, and a normal arrow cursor on mouse over. Switching tabs should make it go away, coming back to the tab with the blocked popup should make it go back. Page actions should still work (tooltips, clicking, context menu, display). Security icon should still work. Install rss extension; the preview bubble should point to the right icon. http://imgur.com/Yo0Ss Review URL: http://codereview.chromium.org/600133 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39158 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/autocomplete_text_field_cell.h')
-rw-r--r--chrome/browser/cocoa/autocomplete_text_field_cell.h59
1 files changed, 37 insertions, 22 deletions
diff --git a/chrome/browser/cocoa/autocomplete_text_field_cell.h b/chrome/browser/cocoa/autocomplete_text_field_cell.h
index bcd595e..3763e2c 100644
--- a/chrome/browser/cocoa/autocomplete_text_field_cell.h
+++ b/chrome/browser/cocoa/autocomplete_text_field_cell.h
@@ -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.
@@ -11,6 +11,24 @@
class ExtensionAction;
+// Holds a |LocationBarImageView| and its current rect. Do not keep references
+// to this object, only use it directly after calling |-layedOutIcons:|.
+@interface AutocompleteTextFieldIcon : NSObject {
+ // The frame rect of |view_|.
+ NSRect rect_;
+
+ // weak, owned by LocationBarViewMac.
+ LocationBarViewMac::LocationBarImageView* view_;
+}
+
+// Returns a new AutocompleteTextFieldIcon object.
++ (AutocompleteTextFieldIcon*)
+ iconWithRect:(NSRect)rect
+ view:(LocationBarViewMac::LocationBarImageView*)view;
+@property(assign, nonatomic) NSRect rect;
+@property(assign, nonatomic) LocationBarViewMac::LocationBarImageView* view;
+@end
+
// AutocompleteTextFieldCell extends StyledTextFieldCell to provide support for
// certain decorations to be applied to the field. These are the search hint
// ("Type to search" on the right-hand side), the keyword hint ("Press [Tab] to
@@ -35,6 +53,9 @@ class ExtensionAction;
// Display is exclusive WRT the |hintString_| and |keywordString_|.
// This may be NULL during testing.
LocationBarViewMac::PageActionViewList* page_action_views_;
+
+ // List of content blocked icons. This may be NULL during testing.
+ LocationBarViewMac::ContentBlockedViews* content_blocked_views_;
}
// Chooses |partialString| if |width| won't fit |fullString|. Strings
@@ -58,34 +79,21 @@ class ExtensionAction;
- (void)setSecurityImageView:(LocationBarViewMac::SecurityImageView*)view;
- (void)setPageActionViewList:(LocationBarViewMac::PageActionViewList*)list;
+- (void)setContentBlockedViewList:
+ (LocationBarViewMac::ContentBlockedViews*)views;
-// Returns the total number of installed Page Actions, visible or not.
-- (size_t)pageActionCount;
+// Returns an array of the visible AutocompleteTextFieldIcon objects. Returns
+// only visible icons.
+- (NSArray*)layedOutIcons:(NSRect)cellFrame;
-// Called when the security icon is visible and clicked. Passed through to the
-// security_image_view_ to handle the click (i.e., show the page info dialog).
-- (void)onSecurityIconMousePressed;
-
-// Returns the portion of the cell to use for displaying the security (SSL lock)
-// icon, leaving space for its label if any.
-- (NSRect)securityImageFrameForFrame:(NSRect)cellFrame;
// Returns the portion of the cell to use for displaying the Page Action icon
// at the given index. May be NSZeroRect if the index's action is not visible.
+// This does a linear walk over all page actions, so do not call this in a loop
+// to get the position of all page actions. Use |-layedOutIcons:| instead in that
+// case.
- (NSRect)pageActionFrameForIndex:(size_t)index inFrame:(NSRect)cellFrame;
-// Returns the string to be shown on hover for the Page Action icon at the
-// given index.
-- (NSString*)pageActionToolTipForIndex:(size_t)index;
-
-// Returns a pointer to the ExtensionAction object that the view at the
-// specified index represents.
-- (ExtensionAction*)pageActionForIndex:(size_t)index;
-
-// Called when the Page Action at the given index, whose icon is drawn in the
-// iconFrame, is visible and clicked. Passed through to the list of views to
-// handle the click.
-- (void)onPageActionMousePressedIn:(NSRect)iconFrame forIndex:(size_t)index;
@end
@@ -96,4 +104,11 @@ class ExtensionAction;
@property(readonly) NSAttributedString* hintString;
@property(readonly) NSAttributedString* hintIconLabel;
+// Returns the total number of installed Page Actions, visible or not.
+- (size_t)pageActionCount;
+
+// Returns the portion of the cell to use for displaying the security (SSL lock)
+// icon, leaving space for its label if any.
+- (NSRect)securityImageFrameForFrame:(NSRect)cellFrame;
+
@end