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

Side by Side Diff: chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h

Issue 2555783002: [Mac] Ensure Omnibox text is always right-aligned in RTL (Closed)
Patch Set: Tweaks Created 4 years 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 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
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 static NSFont* GetLargeFont(); 123 static NSFont* GetLargeFont();
124 static NSFont* GetSmallFont(); 124 static NSFont* GetSmallFont();
125 125
126 // If |resource_id| has a PDF image which can be used, return it. 126 // If |resource_id| has a PDF image which can be used, return it.
127 // Otherwise return the PNG image from the resource bundle. 127 // Otherwise return the PNG image from the resource bundle.
128 static NSImage* ImageForResource(int resource_id); 128 static NSImage* ImageForResource(int resource_id);
129 129
130 // Color used to draw suggest text. 130 // Color used to draw suggest text.
131 static NSColor* SuggestTextColor(); 131 static NSColor* SuggestTextColor();
132 132
133 // Apply our font and paragraph style to |attributedString|.
134 // Public for testing.
Elly Fong-Jones 2016/12/09 18:56:16 It's better to friend the test classes I think
lgrey 2016/12/09 19:43:15 Done.
135 void ApplyTextStyle(NSMutableAttributedString* attributedString);
136
133 AutocompleteTextField* field() const { return field_; } 137 AutocompleteTextField* field() const { return field_; }
134 138
135 private: 139 private:
136 // Called when the user hits backspace in |field_|. Checks whether 140 // Called when the user hits backspace in |field_|. Checks whether
137 // keyword search is being terminated. Returns true if the 141 // keyword search is being terminated. Returns true if the
138 // backspace should be intercepted (not forwarded on to the standard 142 // backspace should be intercepted (not forwarded on to the standard
139 // machinery). 143 // machinery).
140 bool OnBackspacePressed(); 144 bool OnBackspacePressed();
141 145
142 // Returns the field's currently selected range. Only valid if the 146 // Returns the field's currently selected range. Only valid if the
(...skipping 23 matching lines...) Expand all
166 170
167 // Update the field with |display_text| and set the selection. 171 // Update the field with |display_text| and set the selection.
168 void SetTextAndSelectedRange(const base::string16& display_text, 172 void SetTextAndSelectedRange(const base::string16& display_text,
169 const NSRange range); 173 const NSRange range);
170 174
171 // Pass the current content of |field_| to SetText(), maintaining 175 // Pass the current content of |field_| to SetText(), maintaining
172 // any selection. Named to be consistent with GTK and Windows, 176 // any selection. Named to be consistent with GTK and Windows,
173 // though here we cannot really do the in-place operation they do. 177 // though here we cannot really do the in-place operation they do.
174 void EmphasizeURLComponents() override; 178 void EmphasizeURLComponents() override;
175 179
176 // Apply our font and paragraph style to |attributedString|.
177 void ApplyTextStyle(NSMutableAttributedString* attributedString);
178
179 // Calculates text attributes according to |display_text| and applies them 180 // Calculates text attributes according to |display_text| and applies them
180 // to the given |attributedString| object. 181 // to the given |attributedString| object.
181 void ApplyTextAttributes(const base::string16& display_text, 182 void ApplyTextAttributes(const base::string16& display_text,
182 NSMutableAttributedString* attributedString); 183 NSMutableAttributedString* attributedString);
183 184
184 // Return the number of UTF-16 units in the current buffer, excluding the 185 // Return the number of UTF-16 units in the current buffer, excluding the
185 // suggested text. 186 // suggested text.
186 int GetOmniboxTextLength() const override; 187 int GetOmniboxTextLength() const override;
187 NSUInteger GetTextLength() const; 188 NSUInteger GetTextLength() const;
188 189
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 // painted. Used to measure omnibox responsiveness with a histogram. 226 // painted. Used to measure omnibox responsiveness with a histogram.
226 base::TimeTicks insert_char_time_; 227 base::TimeTicks insert_char_time_;
227 228
228 // The time when OnBeforeDrawRect() was called. 229 // The time when OnBeforeDrawRect() was called.
229 base::TimeTicks draw_rect_start_time_; 230 base::TimeTicks draw_rect_start_time_;
230 231
231 DISALLOW_COPY_AND_ASSIGN(OmniboxViewMac); 232 DISALLOW_COPY_AND_ASSIGN(OmniboxViewMac);
232 }; 233 };
233 234
234 #endif // CHROME_BROWSER_UI_COCOA_OMNIBOX_OMNIBOX_VIEW_MAC_H_ 235 #endif // CHROME_BROWSER_UI_COCOA_OMNIBOX_OMNIBOX_VIEW_MAC_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.mm ('k') | chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698