OLD | NEW |
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_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_MAC_H_ | 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_MAC_H_ |
6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_MAC_H_ | 6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_MAC_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 virtual bool OnInlineAutocompleteTextMaybeChanged( | 86 virtual bool OnInlineAutocompleteTextMaybeChanged( |
87 const std::wstring& display_text, size_t user_text_length); | 87 const std::wstring& display_text, size_t user_text_length); |
88 virtual void OnRevertTemporaryText(); | 88 virtual void OnRevertTemporaryText(); |
89 virtual void OnBeforePossibleChange(); | 89 virtual void OnBeforePossibleChange(); |
90 virtual bool OnAfterPossibleChange(); | 90 virtual bool OnAfterPossibleChange(); |
91 virtual gfx::NativeView GetNativeView() const; | 91 virtual gfx::NativeView GetNativeView() const; |
92 | 92 |
93 // Implement the AutocompleteTextFieldObserver interface. | 93 // Implement the AutocompleteTextFieldObserver interface. |
94 virtual void OnControlKeyChanged(bool pressed); | 94 virtual void OnControlKeyChanged(bool pressed); |
95 virtual void OnPaste(); | 95 virtual void OnPaste(); |
| 96 virtual bool CanPasteAndGo(); |
| 97 virtual int GetPasteActionStringId(); |
| 98 virtual void OnPasteAndGo(); |
96 | 99 |
97 // Helper functions for use from AutocompleteEditHelper Objective-C | 100 // Helper functions for use from AutocompleteEditHelper Objective-C |
98 // class. | 101 // class. |
99 | 102 |
100 // Returns true if |popup_view_| is open. | 103 // Returns true if |popup_view_| is open. |
101 bool IsPopupOpen() const; | 104 bool IsPopupOpen() const; |
102 | 105 |
103 // Trivial wrappers forwarding to |model_| methods. | 106 // Trivial wrappers forwarding to |model_| methods. |
104 void OnEscapeKeyPressed(); | 107 void OnEscapeKeyPressed(); |
105 void OnUpOrDownKeyPressed(bool up, bool by_page); | 108 void OnUpOrDownKeyPressed(bool up, bool by_page); |
106 | 109 |
107 // Called when editing begins in the field, and before the results | 110 // Called when editing begins in the field, and before the results |
108 // of any editing are communicated to |model_|. | 111 // of any editing are communicated to |model_|. |
109 void OnWillBeginEditing(); | 112 void OnWillBeginEditing(); |
110 | 113 |
111 // Called when editing ends in the field. | 114 // Called when editing ends in the field. |
112 void OnDidEndEditing(); | 115 void OnDidEndEditing(); |
113 | 116 |
114 // Called when the window |field_| is in loses key to clean up | 117 // Called when the window |field_| is in loses key to clean up |
115 // visual state (such as closing the popup). | 118 // visual state (such as closing the popup). |
116 void OnDidResignKey(); | 119 void OnDidResignKey(); |
117 | 120 |
118 // Returns true if the current clipboard text supports paste and go (or paste | |
119 // and search). | |
120 bool CanPasteAndGo(); | |
121 | |
122 // Returns the appropriate "Paste and Go" or "Paste and Search" context menu | |
123 // string, depending on what is currently in the clipboard. Must not be | |
124 // called unless CanPasteAndGo() returns true. | |
125 int GetPasteActionStringId(); | |
126 | |
127 // Called when the user initiates a "paste and go" or "paste and search" into | |
128 // |field_|. | |
129 void OnPasteAndGo(); | |
130 | |
131 // Checks if a keyword search is possible and forwards to |model_| | 121 // Checks if a keyword search is possible and forwards to |model_| |
132 // if so. Returns true if the tab should be eaten. | 122 // if so. Returns true if the tab should be eaten. |
133 bool OnTabPressed(); | 123 bool OnTabPressed(); |
134 | 124 |
135 // Called when the user hits backspace in |field_|. Checks whether | 125 // Called when the user hits backspace in |field_|. Checks whether |
136 // keyword search is being terminated. Returns true if the | 126 // keyword search is being terminated. Returns true if the |
137 // backspace should be intercepted (not forwarded on to the standard | 127 // backspace should be intercepted (not forwarded on to the standard |
138 // machinery). | 128 // machinery). |
139 bool OnBackspacePressed(); | 129 bool OnBackspacePressed(); |
140 | 130 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 | 189 |
200 // Tracking state before and after a possible change for reporting | 190 // Tracking state before and after a possible change for reporting |
201 // to model_. | 191 // to model_. |
202 NSRange selection_before_change_; | 192 NSRange selection_before_change_; |
203 std::wstring text_before_change_; | 193 std::wstring text_before_change_; |
204 | 194 |
205 DISALLOW_COPY_AND_ASSIGN(AutocompleteEditViewMac); | 195 DISALLOW_COPY_AND_ASSIGN(AutocompleteEditViewMac); |
206 }; | 196 }; |
207 | 197 |
208 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_MAC_H_ | 198 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_MAC_H_ |
OLD | NEW |