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

Side by Side Diff: ios/chrome/browser/ui/omnibox/omnibox_view_ios.h

Issue 2641003002: Show scheme in black and content in gray for data: protocol urls (Closed)
Patch Set: Move misplaced #include to mm files Created 3 years, 9 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) 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>
11
12 #include "base/mac/scoped_nsobject.h" 11 #include "base/mac/scoped_nsobject.h"
13 #include "components/omnibox/browser/omnibox_view.h" 12 #include "components/omnibox/browser/omnibox_view.h"
14 #include "components/toolbar/toolbar_model.h" 13 #include "components/toolbar/toolbar_model.h"
15 #import "ios/chrome/browser/ui/omnibox/omnibox_text_field_ios.h" 14 #import "ios/chrome/browser/ui/omnibox/omnibox_text_field_ios.h"
16 15
17 struct AutocompleteMatch; 16 struct AutocompleteMatch;
18 class AutocompleteResult; 17 class AutocompleteResult;
19 @class AutocompleteTextFieldDelegate; 18 @class AutocompleteTextFieldDelegate;
20 class GURL; 19 class GURL;
21 @class OmniboxTextFieldIOS; 20 @class OmniboxTextFieldIOS;
(...skipping 11 matching lines...) Expand all
33 class OmniboxViewIOS : public OmniboxView { 32 class OmniboxViewIOS : public OmniboxView {
34 public: 33 public:
35 // Retains |field|. 34 // Retains |field|.
36 OmniboxViewIOS(OmniboxTextFieldIOS* field, 35 OmniboxViewIOS(OmniboxTextFieldIOS* field,
37 WebOmniboxEditController* controller, 36 WebOmniboxEditController* controller,
38 ios::ChromeBrowserState* browser_state, 37 ios::ChromeBrowserState* browser_state,
39 id<PreloadProvider> prerender, 38 id<PreloadProvider> prerender,
40 id<OmniboxPopupPositioner> positioner); 39 id<OmniboxPopupPositioner> positioner);
41 ~OmniboxViewIOS() override; 40 ~OmniboxViewIOS() override;
42 41
42 // Returns a color representing |security_level|, adjusted based on whether
43 // the browser is in Incognito mode.
44 static UIColor* GetSecureTextColor(
45 security_state::SecurityLevel security_level,
46 bool in_dark_mode);
47
43 // OmniboxView implementation. 48 // OmniboxView implementation.
44 void OpenMatch(const AutocompleteMatch& match, 49 void OpenMatch(const AutocompleteMatch& match,
45 WindowOpenDisposition disposition, 50 WindowOpenDisposition disposition,
46 const GURL& alternate_nav_url, 51 const GURL& alternate_nav_url,
47 const base::string16& pasted_text, 52 const base::string16& pasted_text,
48 size_t selected_line) override; 53 size_t selected_line) override;
49 base::string16 GetText() const override; 54 base::string16 GetText() const override;
50 void SetWindowTextAndCaretPos(const base::string16& text, 55 void SetWindowTextAndCaretPos(const base::string16& text,
51 size_t caret_pos, 56 size_t caret_pos,
52 bool update_popup, 57 bool update_popup,
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 135
131 protected: 136 protected:
132 int GetOmniboxTextLength() const override; 137 int GetOmniboxTextLength() const override;
133 void EmphasizeURLComponents() override; 138 void EmphasizeURLComponents() override;
134 139
135 private: 140 private:
136 // Calculates text attributes according to |display_text| and 141 // Calculates text attributes according to |display_text| and
137 // returns them in an autoreleased object. 142 // returns them in an autoreleased object.
138 NSAttributedString* ApplyTextAttributes(const base::string16& text); 143 NSAttributedString* ApplyTextAttributes(const base::string16& text);
139 144
145 void SetEmphasis(bool emphasize, const gfx::Range& range) override;
146 void UpdateSchemeStyle(const gfx::Range& scheme_range) override;
147
140 // Removes the query refinement chip from the omnibox. 148 // Removes the query refinement chip from the omnibox.
141 void RemoveQueryRefinementChip(); 149 void RemoveQueryRefinementChip();
142 150
143 // Returns true if user input should currently be ignored. On iOS7, 151 // 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 152 // 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 153 // UIKit crash. In order to sidestep that crash, OmniboxViewIOS checks that
146 // voice search is not pending before attempting to process user actions that 154 // voice search is not pending before attempting to process user actions that
147 // may modify text field contents. 155 // may modify text field contents.
148 // TODO(crbug.com/303212): Remove this workaround once the crash is fixed. 156 // TODO(crbug.com/303212): Remove this workaround once the crash is fixed.
149 bool ShouldIgnoreUserInputDueToPendingVoiceSearch(); 157 bool ShouldIgnoreUserInputDueToPendingVoiceSearch();
(...skipping 11 matching lines...) Expand all
161 NSRange old_selection_; 169 NSRange old_selection_;
162 170
163 // TODO(rohitrao): This is a monster hack, needed because closing the popup 171 // TODO(rohitrao): This is a monster hack, needed because closing the popup
164 // ends up inadvertently triggering a new round of autocomplete. Fix the 172 // ends up inadvertently triggering a new round of autocomplete. Fix the
165 // underlying problem, which is that textDidChange: is called when closing the 173 // underlying problem, which is that textDidChange: is called when closing the
166 // popup, and then remove this hack. b/5877366. 174 // popup, and then remove this hack. b/5877366.
167 BOOL ignore_popup_updates_; 175 BOOL ignore_popup_updates_;
168 176
169 // Bridges delegate method calls from |field_| to C++ land. 177 // Bridges delegate method calls from |field_| to C++ land.
170 base::scoped_nsobject<AutocompleteTextFieldDelegate> field_delegate_; 178 base::scoped_nsobject<AutocompleteTextFieldDelegate> field_delegate_;
179
180 // Temporary pointer to the attributed display string, stored as color and
181 // other emphasis attributes are applied by the superclass.
182 NSMutableAttributedString* attributing_display_string_; // weak
171 }; 183 };
172 184
173 #endif // IOS_CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_VIEW_IOS_H_ 185 #endif // IOS_CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_VIEW_IOS_H_
OLDNEW
« no previous file with comments | « components/omnibox/browser/omnibox_view.cc ('k') | ios/chrome/browser/ui/omnibox/omnibox_view_ios.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698