| 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/mac/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 893 if (model()->CanPasteAndGo(text)) | 893 if (model()->CanPasteAndGo(text)) |
| 894 model()->PasteAndGo(text); | 894 model()->PasteAndGo(text); |
| 895 } | 895 } |
| 896 | 896 |
| 897 void OmniboxViewMac::OnFrameChanged() { | 897 void OmniboxViewMac::OnFrameChanged() { |
| 898 // TODO(shess): UpdatePopupAppearance() is called frequently, so it | 898 // TODO(shess): UpdatePopupAppearance() is called frequently, so it |
| 899 // should be really cheap, but in this case we could probably make | 899 // should be really cheap, but in this case we could probably make |
| 900 // things even cheaper by refactoring between the popup-placement | 900 // things even cheaper by refactoring between the popup-placement |
| 901 // code and the matrix-population code. | 901 // code and the matrix-population code. |
| 902 popup_view_->UpdatePopupAppearance(); | 902 popup_view_->UpdatePopupAppearance(); |
| 903 model()->OnPopupBoundsChanged(popup_view_->GetTargetBounds()); | |
| 904 | 903 |
| 905 // Give controller a chance to rearrange decorations. | 904 // Give controller a chance to rearrange decorations. |
| 906 model()->OnChanged(); | 905 model()->OnChanged(); |
| 907 } | 906 } |
| 908 | 907 |
| 909 void OmniboxViewMac::ClosePopup() { | 908 void OmniboxViewMac::ClosePopup() { |
| 910 OmniboxView::CloseOmniboxPopup(); | 909 OmniboxView::CloseOmniboxPopup(); |
| 911 } | 910 } |
| 912 | 911 |
| 913 bool OmniboxViewMac::OnBackspacePressed() { | 912 bool OmniboxViewMac::OnBackspacePressed() { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 961 | 960 |
| 962 NSUInteger OmniboxViewMac::GetTextLength() const { | 961 NSUInteger OmniboxViewMac::GetTextLength() const { |
| 963 return [field_ currentEditor] ? [[[field_ currentEditor] string] length] : | 962 return [field_ currentEditor] ? [[[field_ currentEditor] string] length] : |
| 964 [[field_ stringValue] length]; | 963 [[field_ stringValue] length]; |
| 965 } | 964 } |
| 966 | 965 |
| 967 bool OmniboxViewMac::IsCaretAtEnd() const { | 966 bool OmniboxViewMac::IsCaretAtEnd() const { |
| 968 const NSRange selection = GetSelectedRange(); | 967 const NSRange selection = GetSelectedRange(); |
| 969 return NSMaxRange(selection) == GetTextLength(); | 968 return NSMaxRange(selection) == GetTextLength(); |
| 970 } | 969 } |
| OLD | NEW |