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

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

Issue 163913011: [OSX, OmniTheatre] Handle OriginChip click properly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Account for becomeFirstResponder without corresponding event. 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 | « chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm ('k') | 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 // 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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698