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