Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Side by Side Diff: chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm

Issue 181383017: [OriginChip, OSX] Hide on focus is switchable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Now with proper formatting. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698