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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 return model_->user_input_in_progress() || | 294 return model_->user_input_in_progress() || |
295 ([[field_ stringValue] length] == 0); | 295 ([[field_ stringValue] length] == 0); |
296 } | 296 } |
297 | 297 |
298 int AutocompleteEditViewMac::GetIcon() const { | 298 int AutocompleteEditViewMac::GetIcon() const { |
299 return IsEditingOrEmpty() ? | 299 return IsEditingOrEmpty() ? |
300 AutocompleteMatch::TypeToIcon(model_->CurrentTextType()) : | 300 AutocompleteMatch::TypeToIcon(model_->CurrentTextType()) : |
301 toolbar_model_->GetIcon(); | 301 toolbar_model_->GetIcon(); |
302 } | 302 } |
303 | 303 |
| 304 void AutocompleteEditViewMac::SetUserText(const std::wstring& text) { |
| 305 SetUserText(text, text, true); |
| 306 } |
| 307 |
304 void AutocompleteEditViewMac::SetUserText(const std::wstring& text, | 308 void AutocompleteEditViewMac::SetUserText(const std::wstring& text, |
305 const std::wstring& display_text, | 309 const std::wstring& display_text, |
306 bool update_popup) { | 310 bool update_popup) { |
307 model_->SetUserText(text); | 311 model_->SetUserText(text); |
308 // TODO(shess): TODO below from gtk. | 312 // TODO(shess): TODO below from gtk. |
309 // TODO(deanm): something about selection / focus change here. | 313 // TODO(deanm): something about selection / focus change here. |
310 SetText(display_text); | 314 SetText(display_text); |
311 if (update_popup) { | 315 if (update_popup) { |
312 UpdatePopup(); | 316 UpdatePopup(); |
313 } | 317 } |
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
929 } | 933 } |
930 | 934 |
931 return std::wstring(); | 935 return std::wstring(); |
932 } | 936 } |
933 | 937 |
934 // static | 938 // static |
935 NSFont* AutocompleteEditViewMac::GetFieldFont() { | 939 NSFont* AutocompleteEditViewMac::GetFieldFont() { |
936 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 940 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
937 return rb.GetFont(ResourceBundle::BaseFont).GetNativeFont(); | 941 return rb.GetFont(ResourceBundle::BaseFont).GetNativeFont(); |
938 } | 942 } |
OLD | NEW |