Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(330)

Side by Side Diff: chrome/browser/ui/cocoa/location_bar/bubble_decoration.h

Issue 671653002: Standardize usage of virtual/override/final in chrome/browser/ui/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "base/mac/scoped_nsobject.h" 11 #include "base/mac/scoped_nsobject.h"
12 #include "chrome/browser/ui/cocoa/location_bar/location_bar_decoration.h" 12 #include "chrome/browser/ui/cocoa/location_bar/location_bar_decoration.h"
13 #import "ui/base/cocoa/appkit_utils.h" 13 #import "ui/base/cocoa/appkit_utils.h"
14 14
15 // Draws an outlined rounded rect, with an optional image to the left 15 // Draws an outlined rounded rect, with an optional image to the left
16 // and an optional text label to the right. 16 // and an optional text label to the right.
17 17
18 class BubbleDecoration : public LocationBarDecoration { 18 class BubbleDecoration : public LocationBarDecoration {
19 public: 19 public:
20 BubbleDecoration(); 20 BubbleDecoration();
21 virtual ~BubbleDecoration(); 21 ~BubbleDecoration() override;
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 void DrawInFrame(NSRect frame, NSView* control_view) override;
32 virtual void DrawWithBackgroundInFrame(NSRect background_frame, 32 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 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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698