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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 // in various DCHECKS to make sure code is running in appropriate | 112 // in various DCHECKS to make sure code is running in appropriate |
113 // situations. | 113 // situations. |
114 bool IsFirstResponder() const; | 114 bool IsFirstResponder() const; |
115 | 115 |
116 // If |model_| believes it has focus, grab focus if needed and set | 116 // If |model_| believes it has focus, grab focus if needed and set |
117 // the selection to |range|. Otherwise does nothing. | 117 // the selection to |range|. Otherwise does nothing. |
118 void SetSelectedRange(const NSRange range); | 118 void SetSelectedRange(const NSRange range); |
119 | 119 |
120 // Update the field with |display_text| and highlight the host and | 120 // Update the field with |display_text| and highlight the host and |
121 // scheme (if it's an URL or URL-fragment). | 121 // scheme (if it's an URL or URL-fragment). |
122 void UpdateAndStyleText(const std::wstring& display_text); | 122 void SetText(const std::wstring& display_text); |
| 123 |
| 124 // Update the field with |display_text| and set the selection. |
| 125 void SetTextAndSelectedRange(const std::wstring& display_text, |
| 126 const NSRange range); |
| 127 |
| 128 // Pass the current content of |field_| to SetText(), maintaining |
| 129 // any selection. Named to be consistent with GTK and Windows, |
| 130 // though here we cannot really do the in-place operation they do. |
| 131 void EmphasizeURLComponents(); |
123 | 132 |
124 scoped_ptr<AutocompleteEditModel> model_; | 133 scoped_ptr<AutocompleteEditModel> model_; |
125 scoped_ptr<AutocompletePopupViewMac> popup_view_; | 134 scoped_ptr<AutocompletePopupViewMac> popup_view_; |
126 | 135 |
127 AutocompleteEditController* controller_; | 136 AutocompleteEditController* controller_; |
128 ToolbarModel* toolbar_model_; | 137 ToolbarModel* toolbar_model_; |
129 | 138 |
130 // The object that handles additional command functionality exposed on the | 139 // The object that handles additional command functionality exposed on the |
131 // edit, such as invoking the keyword editor. | 140 // edit, such as invoking the keyword editor. |
132 CommandUpdater* command_updater_; | 141 CommandUpdater* command_updater_; |
(...skipping 10 matching lines...) Expand all Loading... |
143 | 152 |
144 // Tracking state before and after a possible change for reporting | 153 // Tracking state before and after a possible change for reporting |
145 // to model_. | 154 // to model_. |
146 NSRange selection_before_change_; | 155 NSRange selection_before_change_; |
147 std::wstring text_before_change_; | 156 std::wstring text_before_change_; |
148 | 157 |
149 DISALLOW_COPY_AND_ASSIGN(AutocompleteEditViewMac); | 158 DISALLOW_COPY_AND_ASSIGN(AutocompleteEditViewMac); |
150 }; | 159 }; |
151 | 160 |
152 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_MAC_H_ | 161 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_MAC_H_ |
OLD | NEW |