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/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
923 if (model()->CanPasteAndGo(text)) | 923 if (model()->CanPasteAndGo(text)) |
924 model()->PasteAndGo(text); | 924 model()->PasteAndGo(text); |
925 } | 925 } |
926 | 926 |
927 void OmniboxViewMac::OnFrameChanged() { | 927 void OmniboxViewMac::OnFrameChanged() { |
928 // TODO(shess): UpdatePopupAppearance() is called frequently, so it | 928 // TODO(shess): UpdatePopupAppearance() is called frequently, so it |
929 // should be really cheap, but in this case we could probably make | 929 // should be really cheap, but in this case we could probably make |
930 // things even cheaper by refactoring between the popup-placement | 930 // things even cheaper by refactoring between the popup-placement |
931 // code and the matrix-population code. | 931 // code and the matrix-population code. |
932 popup_view_->UpdatePopupAppearance(); | 932 popup_view_->UpdatePopupAppearance(); |
933 model()->PopupBoundsChangedTo(popup_view_->GetTargetBounds()); | 933 model()->OnPopupBoundsChanged(popup_view_->GetTargetBounds()); |
934 | 934 |
935 // Give controller a chance to rearrange decorations. | 935 // Give controller a chance to rearrange decorations. |
936 model()->OnChanged(); | 936 model()->OnChanged(); |
937 } | 937 } |
938 | 938 |
939 void OmniboxViewMac::ClosePopup() { | 939 void OmniboxViewMac::ClosePopup() { |
940 OmniboxView::CloseOmniboxPopup(); | 940 OmniboxView::CloseOmniboxPopup(); |
941 } | 941 } |
942 | 942 |
943 bool OmniboxViewMac::OnBackspacePressed() { | 943 bool OmniboxViewMac::OnBackspacePressed() { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1014 NSUInteger OmniboxViewMac::GetTextLength() const { | 1014 NSUInteger OmniboxViewMac::GetTextLength() const { |
1015 return ([field_ currentEditor] ? | 1015 return ([field_ currentEditor] ? |
1016 [[[field_ currentEditor] string] length] : | 1016 [[[field_ currentEditor] string] length] : |
1017 [[field_ stringValue] length]) - suggest_text_length_; | 1017 [[field_ stringValue] length]) - suggest_text_length_; |
1018 } | 1018 } |
1019 | 1019 |
1020 bool OmniboxViewMac::IsCaretAtEnd() const { | 1020 bool OmniboxViewMac::IsCaretAtEnd() const { |
1021 const NSRange selection = GetSelectedRange(); | 1021 const NSRange selection = GetSelectedRange(); |
1022 return selection.length == 0 && selection.location == GetTextLength(); | 1022 return selection.length == 0 && selection.location == GetTextLength(); |
1023 } | 1023 } |
OLD | NEW |