Chromium Code Reviews| 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 #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 Loading... | |
| 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) | |
|
Mark Mentovai
2017/04/25 20:44:31
I like to use std::find and std::distance for this
Elly Fong-Jones
2017/04/26 16:50:01
I prefer the explicit loop, but I'm not quite sure
| |
| 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 |
| OLD | NEW |