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

Side by Side Diff: chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm

Issue 2839893003: cocoa: allow omnibox decorations to become key (Closed)
Patch Set: fix nits Created 3 years, 8 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
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 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h" 5 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/mac/foundation_util.h" 10 #include "base/mac/foundation_util.h"
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 } 729 }
730 730
731 - (void)handleFocusEvent:(NSEvent*)event 731 - (void)handleFocusEvent:(NSEvent*)event
732 ofView:(AutocompleteTextField*)controlView { 732 ofView:(AutocompleteTextField*)controlView {
733 if ([controlView observer]) { 733 if ([controlView observer]) {
734 const bool controlDown = ([event modifierFlags] & NSControlKeyMask) != 0; 734 const bool controlDown = ([event modifierFlags] & NSControlKeyMask) != 0;
735 [controlView observer]->OnSetFocus(controlDown); 735 [controlView observer]->OnSetFocus(controlDown);
736 } 736 }
737 } 737 }
738 738
739 - (int)leadingDecorationIndex:(LocationBarDecoration*)decoration {
740 for (size_t i = 0; i < leadingDecorations_.size(); ++i)
741 if (leadingDecorations_[i] == decoration)
742 return leadingDecorations_.size() - (i + 1);
743 return -1;
744 }
745
739 @end 746 @end
740 747
741 @implementation AutocompleteTextFieldCell (TestingAPI) 748 @implementation AutocompleteTextFieldCell (TestingAPI)
742 749
743 - (const std::vector<LocationBarDecoration*>&)mouseTrackingDecorations { 750 - (const std::vector<LocationBarDecoration*>&)mouseTrackingDecorations {
744 return mouseTrackingDecorations_; 751 return mouseTrackingDecorations_;
745 } 752 }
746 753
747 @end 754 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698