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

Side by Side Diff: chrome/browser/cocoa/autocomplete_text_field.h

Issue 207047: [Mac] Convert Omnibox paste-and-go to use AutocompleteTextFieldObserver. (Closed)
Patch Set: Oops - remove test before its time. 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_COCOA_AUTOCOMPLETE_TEXT_FIELD_H_ 5 #ifndef CHROME_BROWSER_COCOA_AUTOCOMPLETE_TEXT_FIELD_H_
6 #define CHROME_BROWSER_COCOA_AUTOCOMPLETE_TEXT_FIELD_H_ 6 #define CHROME_BROWSER_COCOA_AUTOCOMPLETE_TEXT_FIELD_H_
7 7
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 9
10 @class AutocompleteTextFieldCell; 10 @class AutocompleteTextFieldCell;
(...skipping 17 matching lines...) Expand all
28 28
29 class AutocompleteTextFieldObserver { 29 class AutocompleteTextFieldObserver {
30 public: 30 public:
31 31
32 // Called when the control-key state changes while the field is 32 // Called when the control-key state changes while the field is
33 // first responder. 33 // first responder.
34 virtual void OnControlKeyChanged(bool pressed) = 0; 34 virtual void OnControlKeyChanged(bool pressed) = 0;
35 35
36 // Called when the user pastes into the field. 36 // Called when the user pastes into the field.
37 virtual void OnPaste() = 0; 37 virtual void OnPaste() = 0;
38
39 // Returns true if the current clipboard text supports paste and go
40 // (or paste and search).
41 virtual bool CanPasteAndGo() = 0;
42
43 // Returns the appropriate "Paste and Go" or "Paste and Search"
44 // context menu string, depending on what is currently in the
45 // clipboard. Must not be called unless CanPasteAndGo() returns
46 // true.
47 virtual int GetPasteActionStringId() = 0;
48
49 // Called when the user initiates a "paste and go" or "paste and
50 // search" into |field_|.
51 virtual void OnPasteAndGo() = 0;
38 }; 52 };
39 53
40 @protocol AutocompleteTextFieldDelegateMethods
41 // Returns nil if paste actions are not supported.
42 - (NSString*)control:(NSControl*)control
43 textPasteActionString:(NSText*)fieldEditor;
44 - (void)control:(NSControl*)control textDidPasteAndGo:(NSText*)fieldEditor;
45 @end
46
47 @interface AutocompleteTextField : NSTextField { 54 @interface AutocompleteTextField : NSTextField {
48 @private 55 @private
49 AutocompleteTextFieldObserver* observer_; // weak, owned by location bar. 56 AutocompleteTextFieldObserver* observer_; // weak, owned by location bar.
50 } 57 }
51 58
52 @property AutocompleteTextFieldObserver* observer; 59 @property AutocompleteTextFieldObserver* observer;
53 60
54 // Convenience method to return the cell, casted appropriately. 61 // Convenience method to return the cell, casted appropriately.
55 - (AutocompleteTextFieldCell*)autocompleteTextFieldCell; 62 - (AutocompleteTextFieldCell*)autocompleteTextFieldCell;
56 63
57 // If the keyword, keyword hint, or search hint changed, then the 64 // If the keyword, keyword hint, or search hint changed, then the
58 // field needs to be relaidout. This accomplishes that in a manner 65 // field needs to be relaidout. This accomplishes that in a manner
59 // which doesn't disrupt the field delegate. 66 // which doesn't disrupt the field delegate.
60 - (void)resetFieldEditorFrameIfNeeded; 67 - (void)resetFieldEditorFrameIfNeeded;
61 68
62 @end 69 @end
63 70
64 #endif // CHROME_BROWSER_COCOA_AUTOCOMPLETE_TEXT_FIELD_H_ 71 #endif // CHROME_BROWSER_COCOA_AUTOCOMPLETE_TEXT_FIELD_H_
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_popup_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