OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_UI_COCOA_OMNIBOX_OMNIBOX_VIEW_MAC_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_OMNIBOX_OMNIBOX_VIEW_MAC_H_ |
6 #define CHROME_BROWSER_UI_COCOA_OMNIBOX_OMNIBOX_VIEW_MAC_H_ | 6 #define CHROME_BROWSER_UI_COCOA_OMNIBOX_OMNIBOX_VIEW_MAC_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 | 10 |
11 #include <memory> | 11 #include <memory> |
12 | 12 |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
15 #include "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h" | 15 #include "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h" |
16 #include "components/omnibox/browser/omnibox_view.h" | 16 #include "components/omnibox/browser/omnibox_view.h" |
17 #include "components/security_state/security_state_model.h" | 17 #include "components/security_state/security_state_model.h" |
| 18 #include "third_party/skia/include/core/SKColor.h" |
18 | 19 |
19 class CommandUpdater; | 20 class CommandUpdater; |
20 class OmniboxPopupView; | 21 class OmniboxPopupView; |
21 class Profile; | 22 class Profile; |
22 | 23 |
23 namespace content { | 24 namespace content { |
24 class WebContents; | 25 class WebContents; |
25 } | 26 } |
26 | 27 |
27 namespace ui { | 28 namespace ui { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 void OpenMatch(const AutocompleteMatch& match, | 60 void OpenMatch(const AutocompleteMatch& match, |
60 WindowOpenDisposition disposition, | 61 WindowOpenDisposition disposition, |
61 const GURL& alternate_nav_url, | 62 const GURL& alternate_nav_url, |
62 const base::string16& pasted_text, | 63 const base::string16& pasted_text, |
63 size_t selected_line) override; | 64 size_t selected_line) override; |
64 base::string16 GetText() const override; | 65 base::string16 GetText() const override; |
65 void SetWindowTextAndCaretPos(const base::string16& text, | 66 void SetWindowTextAndCaretPos(const base::string16& text, |
66 size_t caret_pos, | 67 size_t caret_pos, |
67 bool update_popup, | 68 bool update_popup, |
68 bool notify_text_changed) override; | 69 bool notify_text_changed) override; |
69 void SetForcedQuery() override; | 70 void EnterKeywordModeForDefaultSearchProvider() override; |
70 bool IsSelectAll() const override; | 71 bool IsSelectAll() const override; |
71 bool DeleteAtEndPressed() override; | 72 bool DeleteAtEndPressed() override; |
72 void GetSelectionBounds(base::string16::size_type* start, | 73 void GetSelectionBounds(base::string16::size_type* start, |
73 base::string16::size_type* end) const override; | 74 base::string16::size_type* end) const override; |
74 void SelectAll(bool reversed) override; | 75 void SelectAll(bool reversed) override; |
75 void RevertAll() override; | 76 void RevertAll() override; |
76 void UpdatePopup() override; | 77 void UpdatePopup() override; |
77 void CloseOmniboxPopup() override; | 78 void CloseOmniboxPopup() override; |
78 void SetFocus() override; | 79 void SetFocus() override; |
79 void ApplyCaretVisibility() override; | 80 void ApplyCaretVisibility() override; |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 std::unique_ptr<OmniboxPopupView> popup_view_; | 205 std::unique_ptr<OmniboxPopupView> popup_view_; |
205 | 206 |
206 AutocompleteTextField* field_; // owned by tab controller | 207 AutocompleteTextField* field_; // owned by tab controller |
207 | 208 |
208 // Selection at the point where the user started using the | 209 // Selection at the point where the user started using the |
209 // arrows to move around in the popup. | 210 // arrows to move around in the popup. |
210 NSRange saved_temporary_selection_; | 211 NSRange saved_temporary_selection_; |
211 | 212 |
212 // Tracking state before and after a possible change for reporting | 213 // Tracking state before and after a possible change for reporting |
213 // to model_. | 214 // to model_. |
214 NSRange selection_before_change_; | 215 State state_before_change_; |
215 base::string16 text_before_change_; | |
216 NSRange marked_range_before_change_; | 216 NSRange marked_range_before_change_; |
217 | 217 |
218 // Was delete pressed? | 218 // Was delete pressed? |
219 bool delete_was_pressed_; | 219 bool delete_was_pressed_; |
220 | 220 |
221 // Was the delete key pressed with an empty selection at the end of the edit? | 221 // Was the delete key pressed with an empty selection at the end of the edit? |
222 bool delete_at_end_pressed_; | 222 bool delete_at_end_pressed_; |
223 | 223 |
224 base::string16 suggest_text_; | 224 base::string16 suggest_text_; |
225 | 225 |
226 // State used to coalesce changes to text and selection to avoid drawing | 226 // State used to coalesce changes to text and selection to avoid drawing |
227 // transient state. | 227 // transient state. |
228 bool in_coalesced_update_block_; | 228 bool in_coalesced_update_block_; |
229 bool do_coalesced_text_update_; | 229 bool do_coalesced_text_update_; |
230 base::string16 coalesced_text_update_; | 230 base::string16 coalesced_text_update_; |
231 bool do_coalesced_range_update_; | 231 bool do_coalesced_range_update_; |
232 NSRange coalesced_range_update_; | 232 NSRange coalesced_range_update_; |
233 | 233 |
234 // The time of the first character insert operation that has not yet been | 234 // The time of the first character insert operation that has not yet been |
235 // painted. Used to measure omnibox responsiveness with a histogram. | 235 // painted. Used to measure omnibox responsiveness with a histogram. |
236 base::TimeTicks insert_char_time_; | 236 base::TimeTicks insert_char_time_; |
237 | 237 |
238 DISALLOW_COPY_AND_ASSIGN(OmniboxViewMac); | 238 DISALLOW_COPY_AND_ASSIGN(OmniboxViewMac); |
239 }; | 239 }; |
240 | 240 |
241 #endif // CHROME_BROWSER_UI_COCOA_OMNIBOX_OMNIBOX_VIEW_MAC_H_ | 241 #endif // CHROME_BROWSER_UI_COCOA_OMNIBOX_OMNIBOX_VIEW_MAC_H_ |
OLD | NEW |