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

Side by Side Diff: chrome/browser/autocomplete/autocomplete_edit_view_mac.mm

Issue 115334: Use the Mac omnibox field's font as the basis for the fonts used in the field and popup. (Closed)
Patch Set: Address Pink's comments. Created 11 years, 7 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
« no previous file with comments | « no previous file | chrome/browser/autocomplete/autocomplete_popup_view_mac.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "chrome/browser/autocomplete/autocomplete_edit_view_mac.h" 5 #include "chrome/browser/autocomplete/autocomplete_edit_view_mac.h"
6 6
7 #include "base/sys_string_conversions.h" 7 #include "base/sys_string_conversions.h"
8 #include "chrome/browser/autocomplete/autocomplete_edit.h" 8 #include "chrome/browser/autocomplete/autocomplete_edit.h"
9 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" 9 #include "chrome/browser/autocomplete/autocomplete_popup_model.h"
10 #include "chrome/browser/autocomplete/autocomplete_popup_view_mac.h" 10 #include "chrome/browser/autocomplete/autocomplete_popup_view_mac.h"
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 // editor, and check it's selected range against its length. 232 // editor, and check it's selected range against its length.
233 model_->StartAutocomplete(false); 233 model_->StartAutocomplete(false);
234 } 234 }
235 235
236 void AutocompleteEditViewMac::ClosePopup() { 236 void AutocompleteEditViewMac::ClosePopup() {
237 popup_view_->GetModel()->StopAutocomplete(); 237 popup_view_->GetModel()->StopAutocomplete();
238 } 238 }
239 239
240 void AutocompleteEditViewMac::UpdateAndStyleText( 240 void AutocompleteEditViewMac::UpdateAndStyleText(
241 const std::wstring& display_text, size_t user_text_length) { 241 const std::wstring& display_text, size_t user_text_length) {
242 NSDictionary* attributes = [NSDictionary dictionaryWithObjectsAndKeys:
243 [field_ font], NSFontAttributeName,
244 nil];
242 NSString* ss = base::SysWideToNSString(display_text); 245 NSString* ss = base::SysWideToNSString(display_text);
243 NSMutableAttributedString* as = 246 NSMutableAttributedString* as =
244 [[[NSMutableAttributedString alloc] initWithString:ss] autorelease]; 247 [[[NSMutableAttributedString alloc] initWithString:ss
248 attributes:attributes]
249 autorelease];
245 250
246 url_parse::Parsed parts; 251 url_parse::Parsed parts;
247 AutocompleteInput::Parse(display_text, model_->GetDesiredTLD(), 252 AutocompleteInput::Parse(display_text, model_->GetDesiredTLD(),
248 &parts, NULL); 253 &parts, NULL);
249 bool emphasize = model_->CurrentTextIsURL() && (parts.host.len > 0); 254 bool emphasize = model_->CurrentTextIsURL() && (parts.host.len > 0);
250 if (emphasize) { 255 if (emphasize) {
251 // TODO(shess): Pull color out as a constant. 256 // TODO(shess): Pull color out as a constant.
252 [as addAttribute:NSForegroundColorAttributeName 257 [as addAttribute:NSForegroundColorAttributeName
253 value:[NSColor greenColor] 258 value:[NSColor greenColor]
254 range:NSMakeRange((NSInteger)parts.host.begin, 259 range:NSMakeRange((NSInteger)parts.host.begin,
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 } 455 }
451 456
452 - (void)controlTextDidEndEditing:(NSNotification*)aNotification { 457 - (void)controlTextDidEndEditing:(NSNotification*)aNotification {
453 edit_view_->OnKillFocus(); 458 edit_view_->OnKillFocus();
454 459
455 // TODO(shess): Figure out where the selection belongs. On GTK, 460 // TODO(shess): Figure out where the selection belongs. On GTK,
456 // it's set to the start of the text. 461 // it's set to the start of the text.
457 } 462 }
458 463
459 @end 464 @end
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/autocomplete/autocomplete_popup_view_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698