OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 | 8 |
9 #include "app/clipboard/clipboard.h" | 9 #include "app/clipboard/clipboard.h" |
10 #include "app/clipboard/scoped_clipboard_writer.h" | 10 #include "app/clipboard/scoped_clipboard_writer.h" |
(...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
871 model_->OnControlKeyChanged(pressed); | 871 model_->OnControlKeyChanged(pressed); |
872 } | 872 } |
873 | 873 |
874 void AutocompleteEditViewMac::FocusLocation(bool select_all) { | 874 void AutocompleteEditViewMac::FocusLocation(bool select_all) { |
875 if ([field_ isEditable]) { | 875 if ([field_ isEditable]) { |
876 // If the text field has a field editor, it's the first responder, meaning | 876 // If the text field has a field editor, it's the first responder, meaning |
877 // that it's already focused. makeFirstResponder: will select all, so only | 877 // that it's already focused. makeFirstResponder: will select all, so only |
878 // call it if this behavior is desired. | 878 // call it if this behavior is desired. |
879 if (select_all || ![field_ currentEditor]) | 879 if (select_all || ![field_ currentEditor]) |
880 [[field_ window] makeFirstResponder:field_]; | 880 [[field_ window] makeFirstResponder:field_]; |
881 // FIXME | 881 DCHECK_EQ([field_ currentEditor], [[field_ window] firstResponder]); |
882 DCHECK_EQ((id)[field_ currentEditor], (id)[[field_ window] firstResponder]); | |
883 } | 882 } |
884 } | 883 } |
885 | 884 |
886 // TODO(shess): Copied from autocomplete_edit_view_win.cc. Could this | 885 // TODO(shess): Copied from autocomplete_edit_view_win.cc. Could this |
887 // be pushed into the model? | 886 // be pushed into the model? |
888 std::wstring AutocompleteEditViewMac::GetClipboardText(Clipboard* clipboard) { | 887 std::wstring AutocompleteEditViewMac::GetClipboardText(Clipboard* clipboard) { |
889 // autocomplete_edit_view_win.cc assumes this can never happen, we | 888 // autocomplete_edit_view_win.cc assumes this can never happen, we |
890 // will too. | 889 // will too. |
891 DCHECK(clipboard); | 890 DCHECK(clipboard); |
892 | 891 |
(...skipping 30 matching lines...) Expand all Loading... |
923 } | 922 } |
924 | 923 |
925 return std::wstring(); | 924 return std::wstring(); |
926 } | 925 } |
927 | 926 |
928 // static | 927 // static |
929 NSFont* AutocompleteEditViewMac::GetFieldFont() { | 928 NSFont* AutocompleteEditViewMac::GetFieldFont() { |
930 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 929 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
931 return rb.GetFont(ResourceBundle::BaseFont).nativeFont(); | 930 return rb.GetFont(ResourceBundle::BaseFont).nativeFont(); |
932 } | 931 } |
OLD | NEW |