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

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

Issue 211030: [Mac] Expose AutocompleteEditViewMac to Cocoa code. (Closed)
Patch Set: Rohit's comments Created 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/cocoa/autocomplete_text_field.h
diff --git a/chrome/browser/cocoa/autocomplete_text_field.h b/chrome/browser/cocoa/autocomplete_text_field.h
index 51afa05fe06c644f5bddd3039e1c2fd6f56232d7..2f87c43ca25088d408036391f4e04157181aa4af 100644
--- a/chrome/browser/cocoa/autocomplete_text_field.h
+++ b/chrome/browser/cocoa/autocomplete_text_field.h
@@ -23,30 +23,33 @@
// Chrome internals, though it's really more of a mish-mash of model,
// view, and controller.
-// AutocompleteTextFieldDelegateMethods are meant to be similar to
-// NSControl delegate methods, adding additional intercepts relevant
-// to the Omnibox implementation.
+// Provides a hook so that we can call directly down to
+// AutocompleteEditViewMac rather than traversing the delegate chain.
-@protocol AutocompleteTextFieldDelegateMethods
+class AutocompleteTextFieldObserver {
+ public:
+
+ // Called when the control-key state changes while the field is
+ // first responder.
+ virtual void OnControlKeyChanged(bool pressed) = 0;
-// Delegate -textShouldPaste: implementation to the field being
-// edited. See AutocompleteTextFieldEditor implementation.
-- (BOOL)control:(NSControl*)control textShouldPaste:(NSText*)fieldEditor;
+ // Called when the user pastes into the field.
+ virtual void OnPaste() = 0;
+};
+@protocol AutocompleteTextFieldDelegateMethods
// Returns nil if paste actions are not supported.
- (NSString*)control:(NSControl*)control
textPasteActionString:(NSText*)fieldEditor;
- (void)control:(NSControl*)control textDidPasteAndGo:(NSText*)fieldEditor;
-
-// Let the delegate track -flagsChanged: events.
-- (void)control:(NSControl*)control flagsChanged:(NSEvent*)theEvent;
-
@end
@interface AutocompleteTextField : NSTextField {
+ @private
+ AutocompleteTextFieldObserver* observer_; // weak, owned by location bar.
}
-- (BOOL)textShouldPaste:(NSText*)fieldEditor;
+@property AutocompleteTextFieldObserver* observer;
// Convenience method to return the cell, casted appropriately.
- (AutocompleteTextFieldCell*)autocompleteTextFieldCell;
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_edit_view_mac.mm ('k') | chrome/browser/cocoa/autocomplete_text_field.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698