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 IOS_CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_VIEW_IOS_H_ | 5 #ifndef IOS_CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_VIEW_IOS_H_ |
6 #define IOS_CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_VIEW_IOS_H_ | 6 #define IOS_CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_VIEW_IOS_H_ |
7 | 7 |
8 #import <UIKit/UIKit.h> | 8 #import <UIKit/UIKit.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 22 matching lines...) Expand all Loading... | |
33 class OmniboxViewIOS : public OmniboxView { | 33 class OmniboxViewIOS : public OmniboxView { |
34 public: | 34 public: |
35 // Retains |field|. | 35 // Retains |field|. |
36 OmniboxViewIOS(OmniboxTextFieldIOS* field, | 36 OmniboxViewIOS(OmniboxTextFieldIOS* field, |
37 WebOmniboxEditController* controller, | 37 WebOmniboxEditController* controller, |
38 ios::ChromeBrowserState* browser_state, | 38 ios::ChromeBrowserState* browser_state, |
39 id<PreloadProvider> prerender, | 39 id<PreloadProvider> prerender, |
40 id<OmniboxPopupPositioner> positioner); | 40 id<OmniboxPopupPositioner> positioner); |
41 ~OmniboxViewIOS() override; | 41 ~OmniboxViewIOS() override; |
42 | 42 |
43 static UIColor* GetSecureTextColor( | |
Eugene But (OOO till 7-30)
2017/02/28 23:04:38
Could you please add comments
elawrence
2017/03/01 21:49:02
Done.
| |
44 security_state::SecurityLevel security_level, | |
45 bool in_dark_mode); | |
Eugene But (OOO till 7-30)
2017/02/28 23:04:38
Do you want to add enum instead of this bool? Othe
elawrence
2017/03/01 21:49:02
I'm inclined to leave this as it is to match Mac's
| |
46 | |
43 // OmniboxView implementation. | 47 // OmniboxView implementation. |
44 void OpenMatch(const AutocompleteMatch& match, | 48 void OpenMatch(const AutocompleteMatch& match, |
45 WindowOpenDisposition disposition, | 49 WindowOpenDisposition disposition, |
46 const GURL& alternate_nav_url, | 50 const GURL& alternate_nav_url, |
47 const base::string16& pasted_text, | 51 const base::string16& pasted_text, |
48 size_t selected_line) override; | 52 size_t selected_line) override; |
49 base::string16 GetText() const override; | 53 base::string16 GetText() const override; |
50 void SetWindowTextAndCaretPos(const base::string16& text, | 54 void SetWindowTextAndCaretPos(const base::string16& text, |
51 size_t caret_pos, | 55 size_t caret_pos, |
52 bool update_popup, | 56 bool update_popup, |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
130 | 134 |
131 protected: | 135 protected: |
132 int GetOmniboxTextLength() const override; | 136 int GetOmniboxTextLength() const override; |
133 void EmphasizeURLComponents() override; | 137 void EmphasizeURLComponents() override; |
134 | 138 |
135 private: | 139 private: |
136 // Calculates text attributes according to |display_text| and | 140 // Calculates text attributes according to |display_text| and |
137 // returns them in an autoreleased object. | 141 // returns them in an autoreleased object. |
138 NSAttributedString* ApplyTextAttributes(const base::string16& text); | 142 NSAttributedString* ApplyTextAttributes(const base::string16& text); |
139 | 143 |
144 // Update colors in |attributing_display_string_|. | |
Eugene But (OOO till 7-30)
2017/02/28 23:04:38
Do you want to explain what this method does from
Eugene But (OOO till 7-30)
2017/02/28 23:04:38
s/Update/Updates
Peter Kasting
2017/03/01 02:39:11
Wouldn't one expect to find such comments on the b
Eugene But (OOO till 7-30)
2017/03/01 06:08:08
Oh, right. I missed that these are override method
elawrence
2017/03/01 21:49:02
Removed.
| |
145 void SetEmphasis(bool emphasize, gfx::Range range) override; | |
146 | |
147 // Update color and font for scheme in |attributing_display_string_|. | |
148 void UpdateSchemeEmphasis(gfx::Range scheme_range) override; | |
149 | |
140 // Removes the query refinement chip from the omnibox. | 150 // Removes the query refinement chip from the omnibox. |
141 void RemoveQueryRefinementChip(); | 151 void RemoveQueryRefinementChip(); |
142 | 152 |
143 // Returns true if user input should currently be ignored. On iOS7, | 153 // Returns true if user input should currently be ignored. On iOS7, |
144 // modifying the contents of a text field while Siri is pending leads to a | 154 // modifying the contents of a text field while Siri is pending leads to a |
145 // UIKit crash. In order to sidestep that crash, OmniboxViewIOS checks that | 155 // UIKit crash. In order to sidestep that crash, OmniboxViewIOS checks that |
146 // voice search is not pending before attempting to process user actions that | 156 // voice search is not pending before attempting to process user actions that |
147 // may modify text field contents. | 157 // may modify text field contents. |
148 // TODO(crbug.com/303212): Remove this workaround once the crash is fixed. | 158 // TODO(crbug.com/303212): Remove this workaround once the crash is fixed. |
149 bool ShouldIgnoreUserInputDueToPendingVoiceSearch(); | 159 bool ShouldIgnoreUserInputDueToPendingVoiceSearch(); |
(...skipping 11 matching lines...) Expand all Loading... | |
161 NSRange old_selection_; | 171 NSRange old_selection_; |
162 | 172 |
163 // TODO(rohitrao): This is a monster hack, needed because closing the popup | 173 // TODO(rohitrao): This is a monster hack, needed because closing the popup |
164 // ends up inadvertently triggering a new round of autocomplete. Fix the | 174 // ends up inadvertently triggering a new round of autocomplete. Fix the |
165 // underlying problem, which is that textDidChange: is called when closing the | 175 // underlying problem, which is that textDidChange: is called when closing the |
166 // popup, and then remove this hack. b/5877366. | 176 // popup, and then remove this hack. b/5877366. |
167 BOOL ignore_popup_updates_; | 177 BOOL ignore_popup_updates_; |
168 | 178 |
169 // Bridges delegate method calls from |field_| to C++ land. | 179 // Bridges delegate method calls from |field_| to C++ land. |
170 base::scoped_nsobject<AutocompleteTextFieldDelegate> field_delegate_; | 180 base::scoped_nsobject<AutocompleteTextFieldDelegate> field_delegate_; |
181 | |
182 // Temporary pointer to the attributed display string, stored as color and | |
183 // other emphasis attributes are applied by the superclass. | |
184 NSMutableAttributedString* attributing_display_string_; | |
171 }; | 185 }; |
172 | 186 |
173 #endif // IOS_CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_VIEW_IOS_H_ | 187 #endif // IOS_CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_VIEW_IOS_H_ |
OLD | NEW |