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 #include "chrome/browser/autocomplete/autocomplete_popup_view_mac.h" | 5 #include "chrome/browser/autocomplete/autocomplete_popup_view_mac.h" |
6 | 6 |
7 #include "app/resource_bundle.h" | 7 #include "app/resource_bundle.h" |
8 #include "app/text_elider.h" | 8 #include "app/text_elider.h" |
9 #include "base/stl_util-inl.h" | 9 #include "base/stl_util-inl.h" |
10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 const CGFloat kPopupRoundingRadius = 3.5; | 33 const CGFloat kPopupRoundingRadius = 3.5; |
34 | 34 |
35 // Gap between the field and the popup. | 35 // Gap between the field and the popup. |
36 const CGFloat kPopupFieldGap = 2.0; | 36 const CGFloat kPopupFieldGap = 2.0; |
37 | 37 |
38 // How opaque the popup window should be. This matches Windows (see | 38 // How opaque the popup window should be. This matches Windows (see |
39 // autocomplete_popup_contents_view.cc, kGlassPopupTransparency). | 39 // autocomplete_popup_contents_view.cc, kGlassPopupTransparency). |
40 const CGFloat kPopupAlpha = 240.0 / 255.0; | 40 const CGFloat kPopupAlpha = 240.0 / 255.0; |
41 | 41 |
42 // How far to offset image column from the left. | 42 // How far to offset image column from the left. |
43 const CGFloat kImageXOffset = 2.0; | 43 const CGFloat kImageXOffset = 3.0; |
44 | 44 |
45 // How far to offset the text column from the left. | 45 // How far to offset the text column from the left. |
46 const CGFloat kTextXOffset = 25.0; | 46 const CGFloat kTextXOffset = 26.0; |
47 | 47 |
48 // Animation duration when animating the popup window smaller. | 48 // Animation duration when animating the popup window smaller. |
49 const NSTimeInterval kShrinkAnimationDuration = 0.1; | 49 const NSTimeInterval kShrinkAnimationDuration = 0.1; |
50 | 50 |
51 // Maximum fraction of the popup width that can be used to display match | 51 // Maximum fraction of the popup width that can be used to display match |
52 // contents. | 52 // contents. |
53 const float kMaxContentsFraction = 0.7; | 53 const float kMaxContentsFraction = 0.7; |
54 | 54 |
55 // NSEvent -buttonNumber for middle mouse button. | 55 // NSEvent -buttonNumber for middle mouse button. |
56 const static NSInteger kMiddleButtonNumber(2); | 56 const static NSInteger kMiddleButtonNumber(2); |
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 yRadius:kPopupRoundingRadius]; | 731 yRadius:kPopupRoundingRadius]; |
732 | 732 |
733 // Draw the matrix clipped to our border. | 733 // Draw the matrix clipped to our border. |
734 [NSGraphicsContext saveGraphicsState]; | 734 [NSGraphicsContext saveGraphicsState]; |
735 [path addClip]; | 735 [path addClip]; |
736 [super drawRect:rect]; | 736 [super drawRect:rect]; |
737 [NSGraphicsContext restoreGraphicsState]; | 737 [NSGraphicsContext restoreGraphicsState]; |
738 } | 738 } |
739 | 739 |
740 @end | 740 @end |
OLD | NEW |