OLD | NEW |
---|---|
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 "app/gfx/font.h" | |
8 #include "app/resource_bundle.h" | |
7 #include "base/clipboard.h" | 9 #include "base/clipboard.h" |
8 #include "base/string_util.h" | 10 #include "base/string_util.h" |
9 #include "base/sys_string_conversions.h" | 11 #include "base/sys_string_conversions.h" |
10 #include "chrome/browser/autocomplete/autocomplete_edit.h" | 12 #include "chrome/browser/autocomplete/autocomplete_edit.h" |
11 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" | 13 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" |
12 #include "chrome/browser/autocomplete/autocomplete_popup_view_mac.h" | 14 #include "chrome/browser/autocomplete/autocomplete_popup_view_mac.h" |
13 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
14 #include "chrome/browser/cocoa/autocomplete_text_field.h" | 16 #include "chrome/browser/cocoa/autocomplete_text_field.h" |
15 #include "chrome/browser/tab_contents/tab_contents.h" | 17 #include "chrome/browser/tab_contents/tab_contents.h" |
16 | 18 |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
356 } | 358 } |
357 | 359 |
358 void AutocompleteEditViewMac::ClosePopup() { | 360 void AutocompleteEditViewMac::ClosePopup() { |
359 popup_view_->GetModel()->StopAutocomplete(); | 361 popup_view_->GetModel()->StopAutocomplete(); |
360 } | 362 } |
361 | 363 |
362 void AutocompleteEditViewMac::SetText(const std::wstring& display_text) { | 364 void AutocompleteEditViewMac::SetText(const std::wstring& display_text) { |
363 NSString* ss = base::SysWideToNSString(display_text); | 365 NSString* ss = base::SysWideToNSString(display_text); |
364 NSMutableAttributedString* as = | 366 NSMutableAttributedString* as = |
365 [[[NSMutableAttributedString alloc] initWithString:ss] autorelease]; | 367 [[[NSMutableAttributedString alloc] initWithString:ss] autorelease]; |
366 [as addAttribute:NSFontAttributeName value:[field_ font] | 368 NSFont* font = ResourceBundle::GetSharedInstance().GetFont( |
369 ResourceBundle::BaseFont).nativeFont(); | |
rohitrao (ping after 24h)
2009/08/12 21:11:48
I didn't see a BaseFont call in AutocompleteEditVi
| |
370 [as addAttribute:NSFontAttributeName value:font | |
367 range:NSMakeRange(0, [as length])]; | 371 range:NSMakeRange(0, [as length])]; |
368 | 372 |
369 url_parse::Parsed parts; | 373 url_parse::Parsed parts; |
370 AutocompleteInput::Parse(display_text, model_->GetDesiredTLD(), | 374 AutocompleteInput::Parse(display_text, model_->GetDesiredTLD(), |
371 &parts, NULL); | 375 &parts, NULL); |
372 const bool emphasize = model_->CurrentTextIsURL() && (parts.host.len > 0); | 376 const bool emphasize = model_->CurrentTextIsURL() && (parts.host.len > 0); |
373 if (emphasize) { | 377 if (emphasize) { |
374 [as addAttribute:NSForegroundColorAttributeName value:BaseTextColor() | 378 [as addAttribute:NSForegroundColorAttributeName value:BaseTextColor() |
375 range:NSMakeRange(0, [as length])]; | 379 range:NSMakeRange(0, [as length])]; |
376 | 380 |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
745 // prepended and ".com" appended. This calls down to | 749 // prepended and ".com" appended. This calls down to |
746 // AutocompleteEditModel::OnControlKeyChanged() so that it can change | 750 // AutocompleteEditModel::OnControlKeyChanged() so that it can change |
747 // the popup to reflect this. See autocomplete_edit.cc | 751 // the popup to reflect this. See autocomplete_edit.cc |
748 // OnControlKeyChanged() and OnAfterPossibleChange(). | 752 // OnControlKeyChanged() and OnAfterPossibleChange(). |
749 - (void)control:(NSControl*)control flagsChanged:(NSEvent*)theEvent { | 753 - (void)control:(NSControl*)control flagsChanged:(NSEvent*)theEvent { |
750 BOOL controlFlag = ([theEvent modifierFlags]&NSControlKeyMask) != 0; | 754 BOOL controlFlag = ([theEvent modifierFlags]&NSControlKeyMask) != 0; |
751 edit_view_->OnControlKeyChanged(controlFlag); | 755 edit_view_->OnControlKeyChanged(controlFlag); |
752 } | 756 } |
753 | 757 |
754 @end | 758 @end |
OLD | NEW |