| 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 10 matching lines...) Expand all Loading... |
| 21 virtual ~BubbleDecoration(); | 21 virtual ~BubbleDecoration(); |
| 22 | 22 |
| 23 // Setup the drawing parameters. | 23 // Setup the drawing parameters. |
| 24 NSImage* GetImage(); | 24 NSImage* GetImage(); |
| 25 void SetImage(NSImage* image); | 25 void SetImage(NSImage* image); |
| 26 void SetLabel(NSString* label); | 26 void SetLabel(NSString* label); |
| 27 void SetTextColor(NSColor* text_color); | 27 void SetTextColor(NSColor* text_color); |
| 28 virtual ui::NinePartImageIds GetBubbleImageIds() = 0; | 28 virtual ui::NinePartImageIds GetBubbleImageIds() = 0; |
| 29 | 29 |
| 30 // Implement |LocationBarDecoration|. | 30 // Implement |LocationBarDecoration|. |
| 31 virtual void DrawInFrame(NSRect frame, NSView* control_view) OVERRIDE; | 31 virtual void DrawInFrame(NSRect frame, NSView* control_view) override; |
| 32 virtual void DrawWithBackgroundInFrame(NSRect background_frame, | 32 virtual void DrawWithBackgroundInFrame(NSRect background_frame, |
| 33 NSRect frame, | 33 NSRect frame, |
| 34 NSView* control_view) OVERRIDE; | 34 NSView* control_view) override; |
| 35 virtual CGFloat GetWidthForSpace(CGFloat width) OVERRIDE; | 35 virtual CGFloat GetWidthForSpace(CGFloat width) override; |
| 36 | 36 |
| 37 protected: | 37 protected: |
| 38 // Helper returning bubble width for the given |image| and |label| | 38 // Helper returning bubble width for the given |image| and |label| |
| 39 // assuming |font_| (for sizing text). Arguments can be nil. | 39 // assuming |font_| (for sizing text). Arguments can be nil. |
| 40 CGFloat GetWidthForImageAndLabel(NSImage* image, NSString* label); | 40 CGFloat GetWidthForImageAndLabel(NSImage* image, NSString* label); |
| 41 | 41 |
| 42 // Helper to return where the image is drawn, for subclasses to drag | 42 // Helper to return where the image is drawn, for subclasses to drag |
| 43 // from. |frame| is the decoration's frame in the containing cell. | 43 // from. |frame| is the decoration's frame in the containing cell. |
| 44 NSRect GetImageRectInFrame(NSRect frame); | 44 NSRect GetImageRectInFrame(NSRect frame); |
| 45 | 45 |
| 46 private: | 46 private: |
| 47 friend class SelectedKeywordDecorationTest; | 47 friend class SelectedKeywordDecorationTest; |
| 48 FRIEND_TEST_ALL_PREFIXES(SelectedKeywordDecorationTest, | 48 FRIEND_TEST_ALL_PREFIXES(SelectedKeywordDecorationTest, |
| 49 UsesPartialKeywordIfNarrow); | 49 UsesPartialKeywordIfNarrow); |
| 50 | 50 |
| 51 // Image drawn in the left side of the bubble. | 51 // Image drawn in the left side of the bubble. |
| 52 base::scoped_nsobject<NSImage> image_; | 52 base::scoped_nsobject<NSImage> image_; |
| 53 | 53 |
| 54 // Label to draw to right of image. Can be |nil|. | 54 // Label to draw to right of image. Can be |nil|. |
| 55 base::scoped_nsobject<NSString> label_; | 55 base::scoped_nsobject<NSString> label_; |
| 56 | 56 |
| 57 // Contains attribute for drawing |label_|. | 57 // Contains attribute for drawing |label_|. |
| 58 base::scoped_nsobject<NSMutableDictionary> attributes_; | 58 base::scoped_nsobject<NSMutableDictionary> attributes_; |
| 59 | 59 |
| 60 DISALLOW_COPY_AND_ASSIGN(BubbleDecoration); | 60 DISALLOW_COPY_AND_ASSIGN(BubbleDecoration); |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_BUBBLE_DECORATION_H_ | 63 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_BUBBLE_DECORATION_H_ |
| OLD | NEW |