| 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/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 768 } | 768 } |
| 769 } | 769 } |
| 770 | 770 |
| 771 return false; | 771 return false; |
| 772 } | 772 } |
| 773 | 773 |
| 774 void OmniboxViewMac::OnSetFocus(bool control_down) { | 774 void OmniboxViewMac::OnSetFocus(bool control_down) { |
| 775 model()->OnSetFocus(control_down); | 775 model()->OnSetFocus(control_down); |
| 776 controller()->OnSetFocus(); | 776 controller()->OnSetFocus(); |
| 777 | 777 |
| 778 // TODO(groby): Not entirely correct, since the chip should only be disabled | |
| 779 // after mouseDown: was handled, to allow clicking on the origin chip. | |
| 780 if (chrome::ShouldDisplayOriginChipV2()) { | 778 if (chrome::ShouldDisplayOriginChipV2()) { |
| 781 controller()->GetToolbarModel()->set_origin_chip_enabled(false); | 779 controller()->GetToolbarModel()->set_origin_chip_enabled(false); |
| 782 controller()->OnChanged(); | 780 controller()->OnChanged(); |
| 783 } | 781 } |
| 784 } | 782 } |
| 785 | 783 |
| 786 void OmniboxViewMac::OnKillFocus() { | 784 void OmniboxViewMac::OnKillFocus() { |
| 787 // Tell the model to reset itself. | 785 // Tell the model to reset itself. |
| 788 model()->OnWillKillFocus(NULL); | 786 model()->OnWillKillFocus(NULL); |
| 789 model()->OnKillFocus(); | 787 model()->OnKillFocus(); |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 979 | 977 |
| 980 NSUInteger OmniboxViewMac::GetTextLength() const { | 978 NSUInteger OmniboxViewMac::GetTextLength() const { |
| 981 return [field_ currentEditor] ? [[[field_ currentEditor] string] length] : | 979 return [field_ currentEditor] ? [[[field_ currentEditor] string] length] : |
| 982 [[field_ stringValue] length]; | 980 [[field_ stringValue] length]; |
| 983 } | 981 } |
| 984 | 982 |
| 985 bool OmniboxViewMac::IsCaretAtEnd() const { | 983 bool OmniboxViewMac::IsCaretAtEnd() const { |
| 986 const NSRange selection = GetSelectedRange(); | 984 const NSRange selection = GetSelectedRange(); |
| 987 return NSMaxRange(selection) == GetTextLength(); | 985 return NSMaxRange(selection) == GetTextLength(); |
| 988 } | 986 } |
| OLD | NEW |