| 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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 &decorationFrames, &textFrame); | 241 &decorationFrames, &textFrame); |
| 242 | 242 |
| 243 // Find our decoration and return the corresponding frame. | 243 // Find our decoration and return the corresponding frame. |
| 244 std::vector<LocationBarDecoration*>::const_iterator iter = | 244 std::vector<LocationBarDecoration*>::const_iterator iter = |
| 245 std::find(decorations.begin(), decorations.end(), aDecoration); | 245 std::find(decorations.begin(), decorations.end(), aDecoration); |
| 246 if (iter != decorations.end()) { | 246 if (iter != decorations.end()) { |
| 247 const size_t index = iter - decorations.begin(); | 247 const size_t index = iter - decorations.begin(); |
| 248 return decorationFrames[index]; | 248 return decorationFrames[index]; |
| 249 } | 249 } |
| 250 | 250 |
| 251 // Decorations which are not visible should have been filtered out | 251 // Decorations which are not visible usually have been filtered out at the |
| 252 // at the top, but return |NSZeroRect| rather than a 0-width rect | 252 // top. However, in some cases they are not (e.g., new tabs that have never |
| 253 // for consistency. | 253 // been foregrounded). As a default, return |NSZeroRect| rather than a 0-width |
| 254 NOTREACHED(); | 254 // rect for consistency. |
| 255 return NSZeroRect; | 255 return NSZeroRect; |
| 256 } | 256 } |
| 257 | 257 |
| 258 - (NSRect)backgroundFrameForDecoration:(LocationBarDecoration*)decoration | 258 - (NSRect)backgroundFrameForDecoration:(LocationBarDecoration*)decoration |
| 259 inFrame:(NSRect)cellFrame | 259 inFrame:(NSRect)cellFrame |
| 260 isLeftDecoration:(BOOL*)isLeftDecoration { | 260 isLeftDecoration:(BOOL*)isLeftDecoration { |
| 261 NSRect decorationFrame = | 261 NSRect decorationFrame = |
| 262 [self frameForDecoration:decoration inFrame:cellFrame]; | 262 [self frameForDecoration:decoration inFrame:cellFrame]; |
| 263 std::vector<LocationBarDecoration*>& left_decorations = | 263 std::vector<LocationBarDecoration*>& left_decorations = |
| 264 cocoa_l10n_util::ShouldDoExperimentalRTLLayout() ? trailingDecorations_ | 264 cocoa_l10n_util::ShouldDoExperimentalRTLLayout() ? trailingDecorations_ |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 | 728 |
| 729 @end | 729 @end |
| 730 | 730 |
| 731 @implementation AutocompleteTextFieldCell (TestingAPI) | 731 @implementation AutocompleteTextFieldCell (TestingAPI) |
| 732 | 732 |
| 733 - (const std::vector<LocationBarDecoration*>&)mouseTrackingDecorations { | 733 - (const std::vector<LocationBarDecoration*>&)mouseTrackingDecorations { |
| 734 return mouseTrackingDecorations_; | 734 return mouseTrackingDecorations_; |
| 735 } | 735 } |
| 736 | 736 |
| 737 @end | 737 @end |
| OLD | NEW |