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 <Carbon/Carbon.h> // kVK_Return | 7 #include <Carbon/Carbon.h> // kVK_Return |
8 #include "app/gfx/font.h" | 8 #include "app/gfx/font.h" |
9 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
10 #include "base/clipboard.h" | 10 #include "base/clipboard.h" |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 // | 355 // |
356 // One option would seem to be to check for a non-nil field | 356 // One option would seem to be to check for a non-nil field |
357 // editor, and check it's selected range against its length. | 357 // editor, and check it's selected range against its length. |
358 model_->StartAutocomplete(false); | 358 model_->StartAutocomplete(false); |
359 } | 359 } |
360 | 360 |
361 void AutocompleteEditViewMac::ClosePopup() { | 361 void AutocompleteEditViewMac::ClosePopup() { |
362 popup_view_->GetModel()->StopAutocomplete(); | 362 popup_view_->GetModel()->StopAutocomplete(); |
363 } | 363 } |
364 | 364 |
| 365 void AutocompleteEditViewMac::SetFocus() { |
| 366 } |
| 367 |
365 void AutocompleteEditViewMac::SetText(const std::wstring& display_text) { | 368 void AutocompleteEditViewMac::SetText(const std::wstring& display_text) { |
366 NSString* ss = base::SysWideToNSString(display_text); | 369 NSString* ss = base::SysWideToNSString(display_text); |
367 NSMutableAttributedString* as = | 370 NSMutableAttributedString* as = |
368 [[[NSMutableAttributedString alloc] initWithString:ss] autorelease]; | 371 [[[NSMutableAttributedString alloc] initWithString:ss] autorelease]; |
369 NSFont* font = ResourceBundle::GetSharedInstance().GetFont( | 372 NSFont* font = ResourceBundle::GetSharedInstance().GetFont( |
370 ResourceBundle::BaseFont).nativeFont(); | 373 ResourceBundle::BaseFont).nativeFont(); |
371 [as addAttribute:NSFontAttributeName value:font | 374 [as addAttribute:NSFontAttributeName value:font |
372 range:NSMakeRange(0, [as length])]; | 375 range:NSMakeRange(0, [as length])]; |
373 | 376 |
374 url_parse::Parsed parts; | 377 url_parse::Parsed parts; |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
844 // prepended and ".com" appended. This calls down to | 847 // prepended and ".com" appended. This calls down to |
845 // AutocompleteEditModel::OnControlKeyChanged() so that it can change | 848 // AutocompleteEditModel::OnControlKeyChanged() so that it can change |
846 // the popup to reflect this. See autocomplete_edit.cc | 849 // the popup to reflect this. See autocomplete_edit.cc |
847 // OnControlKeyChanged() and OnAfterPossibleChange(). | 850 // OnControlKeyChanged() and OnAfterPossibleChange(). |
848 - (void)control:(NSControl*)control flagsChanged:(NSEvent*)theEvent { | 851 - (void)control:(NSControl*)control flagsChanged:(NSEvent*)theEvent { |
849 bool controlFlag = ([theEvent modifierFlags]&NSControlKeyMask) != 0; | 852 bool controlFlag = ([theEvent modifierFlags]&NSControlKeyMask) != 0; |
850 edit_view_->OnControlKeyChanged(controlFlag); | 853 edit_view_->OnControlKeyChanged(controlFlag); |
851 } | 854 } |
852 | 855 |
853 @end | 856 @end |
OLD | NEW |