| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/cocoa/location_bar/autocomplete_text_field_cell.h" | 5 #import "chrome/browser/cocoa/location_bar/autocomplete_text_field_cell.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #import "chrome/browser/cocoa/image_utils.h" | 8 #import "chrome/browser/cocoa/image_utils.h" |
| 9 #import "chrome/browser/cocoa/location_bar/autocomplete_text_field.h" | 9 #import "chrome/browser/cocoa/location_bar/autocomplete_text_field.h" |
| 10 #import "chrome/browser/cocoa/location_bar/location_bar_decoration.h" | 10 #import "chrome/browser/cocoa/location_bar/location_bar_decoration.h" |
| 11 | 11 |
| 12 namespace { | 12 namespace { |
| 13 | 13 |
| 14 const CGFloat kBaselineAdjust = 3.0; | 14 const CGFloat kBaselineAdjust = 3.0; |
| 15 | 15 |
| 16 // Matches the clipping radius of |GradientButtonCell|. | 16 // Matches the clipping radius of |GradientButtonCell|. |
| 17 const CGFloat kCornerRadius = 4.0; | 17 const CGFloat kCornerRadius = 4.0; |
| 18 | 18 |
| 19 // How far to inset the left-hand decorations from the field's bounds. | 19 // How far to inset the left-hand decorations from the field's bounds. |
| 20 const CGFloat kLeftDecorationXOffset = 4.0; | 20 const CGFloat kLeftDecorationXOffset = 5.0; |
| 21 | 21 |
| 22 // How far to inset the right-hand decorations from the field's bounds. | 22 // How far to inset the right-hand decorations from the field's bounds. |
| 23 // TODO(shess): Why is this different from |kLeftDecorationXOffset|? | 23 // TODO(shess): Why is this different from |kLeftDecorationXOffset|? |
| 24 const CGFloat kRightDecorationXOffset = 4.0; | 24 // |kDecorationOuterXOffset|? |
| 25 const CGFloat kRightDecorationXOffset = 5.0; |
| 25 | 26 |
| 26 // The amount of padding on either side reserved for drawing | 27 // The amount of padding on either side reserved for drawing |
| 27 // decorations. [Views has |kItemPadding| == 3.] | 28 // decorations. [Views has |kItemPadding| == 3.] |
| 28 const CGFloat kDecorationHorizontalPad = 3.0; | 29 const CGFloat kDecorationHorizontalPad = 3.0; |
| 29 | 30 |
| 30 // How long to wait for mouse-up on the location icon before assuming | 31 // How long to wait for mouse-up on the location icon before assuming |
| 31 // that the user wants to drag. | 32 // that the user wants to drag. |
| 32 const NSTimeInterval kLocationIconDragTimeout = 0.25; | 33 const NSTimeInterval kLocationIconDragTimeout = 0.25; |
| 33 | 34 |
| 34 // Calculate the positions for a set of decorations. |frame| is the | 35 // Calculate the positions for a set of decorations. |frame| is the |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 &decorations, &decorationFrames, &textFrame); | 393 &decorations, &decorationFrames, &textFrame); |
| 393 | 394 |
| 394 for (size_t i = 0; i < decorations.size(); ++i) { | 395 for (size_t i = 0; i < decorations.size(); ++i) { |
| 395 NSString* tooltip = decorations[i]->GetToolTip(); | 396 NSString* tooltip = decorations[i]->GetToolTip(); |
| 396 if ([tooltip length] > 0) | 397 if ([tooltip length] > 0) |
| 397 [controlView addToolTip:tooltip forRect:decorationFrames[i]]; | 398 [controlView addToolTip:tooltip forRect:decorationFrames[i]]; |
| 398 } | 399 } |
| 399 } | 400 } |
| 400 | 401 |
| 401 @end | 402 @end |
| OLD | NEW |