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

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

Issue 2805070: [Mac] First part of Omnibox decoration refactor. Enable ev bubble. (Closed) Base URL: git://codf21.jail/chromium.git
Patch Set: comment clarification Created 10 years, 5 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_COCOA_LOCATION_BAR_BUBBLE_DECORATION_H_
6 #define CHROME_BROWSER_COCOA_LOCATION_BAR_BUBBLE_DECORATION_H_
7
8 #import <Cocoa/Cocoa.h>
9
10 #include "base/gtest_prod_util.h"
11 #include "base/scoped_nsobject.h"
12 #include "chrome/browser/cocoa/location_bar/location_bar_decoration.h"
13
14 // Draws an outlined rounded rect, with an optional image to the left
15 // and an optional text label to the right.
16
17 class BubbleDecoration : public LocationBarDecoration {
18 public:
19 // |font| will be used when drawing the label, and cannot be |nil|.
20 BubbleDecoration(NSFont* font);
21 ~BubbleDecoration();
22
23 // Setup the drawing parameters.
24 void SetImage(NSImage* image);
25 void SetLabel(NSString* label);
26 void SetColors(NSColor* border_color,
27 NSColor* background_color,
28 NSColor* text_color);
29
30 // Implement |LocationBarDecoration|.
31 virtual void DrawInFrame(NSRect frame, NSView* control_view);
32 virtual CGFloat GetWidthForSpace(CGFloat width);
33
34 protected:
35 // Helper returning bubble width for the given |image| and |label|
36 // assuming |font_| (for sizing text). Arguments can be nil.
37 CGFloat GetWidthForImageAndLabel(NSImage* image, NSString* label);
38
39 private:
40 friend class SelectedKeywordDecorationTest;
41 FRIEND_TEST_ALL_PREFIXES(SelectedKeywordDecorationTest,
42 UsesPartialKeywordIfNarrow);
43
44 // Contains font attribute for drawing |label_|.
45 scoped_nsobject<NSDictionary> attributes_;
46
47 // Image drawn in the left side of the bubble.
48 scoped_nsobject<NSImage> image_;
49
50 // Label to draw to right of image. Can be |nil|.
51 scoped_nsobject<NSString> label_;
52
53 // Colors used to draw the bubble, should be set by the subclass
54 // constructor.
55 scoped_nsobject<NSColor> background_color_;
56 scoped_nsobject<NSColor> border_color_;
57 scoped_nsobject<NSColor> text_color_;
58
59 DISALLOW_COPY_AND_ASSIGN(BubbleDecoration);
60 };
61
62 #endif // CHROME_BROWSER_COCOA_LOCATION_BAR_BUBBLE_DECORATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698