OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_UI_COCOA_LOCATION_BAR_BUBBLE_DECORATION_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_LOCATION_BAR_BUBBLE_DECORATION_H_ |
6 #define CHROME_BROWSER_UI_COCOA_LOCATION_BAR_BUBBLE_DECORATION_H_ | 6 #define CHROME_BROWSER_UI_COCOA_LOCATION_BAR_BUBBLE_DECORATION_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 // Implement |LocationBarDecoration|. | 34 // Implement |LocationBarDecoration|. |
35 CGFloat GetWidthForSpace(CGFloat width) override; | 35 CGFloat GetWidthForSpace(CGFloat width) override; |
36 void DrawInFrame(NSRect frame, NSView* control_view) override; | 36 void DrawInFrame(NSRect frame, NSView* control_view) override; |
37 void DrawWithBackgroundInFrame(NSRect background_frame, | 37 void DrawWithBackgroundInFrame(NSRect background_frame, |
38 NSRect frame, | 38 NSRect frame, |
39 NSView* control_view) override; | 39 NSView* control_view) override; |
40 NSFont* GetFont() const override; | 40 NSFont* GetFont() const override; |
41 | 41 |
42 protected: | 42 protected: |
| 43 // Returns the amount of padding between the divider and the omnibox text. |
| 44 // Returns 0 in non-MD since there's no divider. |
| 45 CGFloat DividerPadding() const; |
| 46 |
43 // Helper returning bubble width for the given |image| and |label| | 47 // Helper returning bubble width for the given |image| and |label| |
44 // assuming |font_| (for sizing text). Arguments can be nil. | 48 // assuming |font_| (for sizing text). Arguments can be nil. |
45 CGFloat GetWidthForImageAndLabel(NSImage* image, NSString* label); | 49 CGFloat GetWidthForImageAndLabel(NSImage* image, NSString* label); |
46 | 50 |
47 // Helper to return where the image is drawn, for subclasses to drag | 51 // Helper to return where the image is drawn, for subclasses to drag |
48 // from. |frame| is the decoration's frame in the containing cell. | 52 // from. |frame| is the decoration's frame in the containing cell. |
49 NSRect GetImageRectInFrame(NSRect frame); | 53 NSRect GetImageRectInFrame(NSRect frame); |
50 | 54 |
51 // Returns the text color when the theme is dark. | 55 // Returns the text color when the theme is dark. |
52 virtual NSColor* GetDarkModeTextColor(); | 56 virtual NSColor* GetDarkModeTextColor(); |
53 | 57 |
54 private: | |
55 friend class SelectedKeywordDecorationTest; | |
56 FRIEND_TEST_ALL_PREFIXES(SelectedKeywordDecorationTest, | |
57 UsesPartialKeywordIfNarrow); | |
58 | |
59 // Image drawn in the left side of the bubble. | 58 // Image drawn in the left side of the bubble. |
60 base::scoped_nsobject<NSImage> image_; | 59 base::scoped_nsobject<NSImage> image_; |
61 | 60 |
62 // Label to draw to right of image. Can be |nil|. | 61 // Label to draw to right of image. Can be |nil|. |
63 base::scoped_nsobject<NSString> label_; | 62 base::scoped_nsobject<NSString> label_; |
64 | 63 |
65 // Contains attribute for drawing |label_|. | 64 // Contains attribute for drawing |label_|. |
66 base::scoped_nsobject<NSMutableDictionary> attributes_; | 65 base::scoped_nsobject<NSMutableDictionary> attributes_; |
67 | 66 |
| 67 private: |
| 68 friend class SelectedKeywordDecorationTest; |
| 69 FRIEND_TEST_ALL_PREFIXES(SelectedKeywordDecorationTest, |
| 70 UsesPartialKeywordIfNarrow); |
| 71 |
68 // Contains any Retina-only baseline adjustment for |label_|. | 72 // Contains any Retina-only baseline adjustment for |label_|. |
69 CGFloat retina_baseline_offset_; | 73 CGFloat retina_baseline_offset_; |
70 | 74 |
71 DISALLOW_COPY_AND_ASSIGN(BubbleDecoration); | 75 DISALLOW_COPY_AND_ASSIGN(BubbleDecoration); |
72 }; | 76 }; |
73 | 77 |
74 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_BUBBLE_DECORATION_H_ | 78 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_BUBBLE_DECORATION_H_ |
OLD | NEW |