| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/cocoa/omnibox/omnibox_view_mac.h" | 5 #include "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h" |
| 6 | 6 |
| 7 #include <Carbon/Carbon.h> // kVK_Return | 7 #include <Carbon/Carbon.h> // kVK_Return |
| 8 | 8 |
| 9 #include "base/property_bag.h" | 9 #include "base/property_bag.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 866 return false; | 866 return false; |
| 867 } | 867 } |
| 868 | 868 |
| 869 void OmniboxViewMac::OnSetFocus(bool control_down) { | 869 void OmniboxViewMac::OnSetFocus(bool control_down) { |
| 870 model_->OnSetFocus(control_down); | 870 model_->OnSetFocus(control_down); |
| 871 controller_->OnSetFocus(); | 871 controller_->OnSetFocus(); |
| 872 } | 872 } |
| 873 | 873 |
| 874 void OmniboxViewMac::OnKillFocus() { | 874 void OmniboxViewMac::OnKillFocus() { |
| 875 // Tell the model to reset itself. | 875 // Tell the model to reset itself. |
| 876 model_->OnWillKillFocus(NULL); | 876 model_->OnWillKillFocus(); |
| 877 model_->OnKillFocus(); | 877 model_->OnKillFocus(); |
| 878 controller_->OnKillFocus(); | 878 controller_->OnKillFocus(); |
| 879 } | 879 } |
| 880 | 880 |
| 881 bool OmniboxViewMac::CanCopy() { | 881 bool OmniboxViewMac::CanCopy() { |
| 882 const NSRange selection = GetSelectedRange(); | 882 const NSRange selection = GetSelectedRange(); |
| 883 return selection.length > 0; | 883 return selection.length > 0; |
| 884 } | 884 } |
| 885 | 885 |
| 886 void OmniboxViewMac::CopyToPasteboard(NSPasteboard* pb) { | 886 void OmniboxViewMac::CopyToPasteboard(NSPasteboard* pb) { |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1041 | 1041 |
| 1042 void OmniboxViewMac::PlaceCaretAt(NSUInteger pos) { | 1042 void OmniboxViewMac::PlaceCaretAt(NSUInteger pos) { |
| 1043 DCHECK(pos <= GetTextLength()); | 1043 DCHECK(pos <= GetTextLength()); |
| 1044 SetSelectedRange(NSMakeRange(pos, pos)); | 1044 SetSelectedRange(NSMakeRange(pos, pos)); |
| 1045 } | 1045 } |
| 1046 | 1046 |
| 1047 bool OmniboxViewMac::IsCaretAtEnd() const { | 1047 bool OmniboxViewMac::IsCaretAtEnd() const { |
| 1048 const NSRange selection = GetSelectedRange(); | 1048 const NSRange selection = GetSelectedRange(); |
| 1049 return selection.length == 0 && selection.location == GetTextLength(); | 1049 return selection.length == 0 && selection.location == GetTextLength(); |
| 1050 } | 1050 } |
| OLD | NEW |