| 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 if (chrome::ShouldDisplayOriginChipV2()) { | 778 if (chrome::GetOriginChipV2HideTrigger() == |
| 779 chrome::ORIGIN_CHIP_V2_HIDE_ON_MOUSE_RELEASE) { |
| 779 controller()->GetToolbarModel()->set_origin_chip_enabled(false); | 780 controller()->GetToolbarModel()->set_origin_chip_enabled(false); |
| 780 controller()->OnChanged(); | 781 controller()->OnChanged(); |
| 781 } | 782 } |
| 782 } | 783 } |
| 783 | 784 |
| 784 void OmniboxViewMac::OnKillFocus() { | 785 void OmniboxViewMac::OnKillFocus() { |
| 785 // Tell the model to reset itself. | 786 // Tell the model to reset itself. |
| 786 model()->OnWillKillFocus(NULL); | 787 model()->OnWillKillFocus(NULL); |
| 787 model()->OnKillFocus(); | 788 model()->OnKillFocus(); |
| 788 | 789 |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 977 | 978 |
| 978 NSUInteger OmniboxViewMac::GetTextLength() const { | 979 NSUInteger OmniboxViewMac::GetTextLength() const { |
| 979 return [field_ currentEditor] ? [[[field_ currentEditor] string] length] : | 980 return [field_ currentEditor] ? [[[field_ currentEditor] string] length] : |
| 980 [[field_ stringValue] length]; | 981 [[field_ stringValue] length]; |
| 981 } | 982 } |
| 982 | 983 |
| 983 bool OmniboxViewMac::IsCaretAtEnd() const { | 984 bool OmniboxViewMac::IsCaretAtEnd() const { |
| 984 const NSRange selection = GetSelectedRange(); | 985 const NSRange selection = GetSelectedRange(); |
| 985 return NSMaxRange(selection) == GetTextLength(); | 986 return NSMaxRange(selection) == GetTextLength(); |
| 986 } | 987 } |
| OLD | NEW |