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

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

Issue 2870059: [Mac] Adjust omnibox decoration dragging to keep image under mouse. (Closed) Base URL: git://codf21.jail/chromium.git
Patch Set: Move method per Trung. 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
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 #ifndef CHROME_BROWSER_COCOA_LOCATION_BAR_BUBBLE_DECORATION_H_ 5 #ifndef CHROME_BROWSER_COCOA_LOCATION_BAR_BUBBLE_DECORATION_H_
6 #define CHROME_BROWSER_COCOA_LOCATION_BAR_BUBBLE_DECORATION_H_ 6 #define CHROME_BROWSER_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 18 matching lines...) Expand all
29 29
30 // Implement |LocationBarDecoration|. 30 // Implement |LocationBarDecoration|.
31 virtual void DrawInFrame(NSRect frame, NSView* control_view); 31 virtual void DrawInFrame(NSRect frame, NSView* control_view);
32 virtual CGFloat GetWidthForSpace(CGFloat width); 32 virtual CGFloat GetWidthForSpace(CGFloat width);
33 33
34 protected: 34 protected:
35 // Helper returning bubble width for the given |image| and |label| 35 // Helper returning bubble width for the given |image| and |label|
36 // assuming |font_| (for sizing text). Arguments can be nil. 36 // assuming |font_| (for sizing text). Arguments can be nil.
37 CGFloat GetWidthForImageAndLabel(NSImage* image, NSString* label); 37 CGFloat GetWidthForImageAndLabel(NSImage* image, NSString* label);
38 38
39 // Helper to return where the image is drawn, for subclasses to drag
40 // from. |frame| is the decoration's frame in the containing cell.
41 NSRect GetImageRectInFrame(NSRect frame);
42
39 private: 43 private:
40 friend class SelectedKeywordDecorationTest; 44 friend class SelectedKeywordDecorationTest;
41 FRIEND_TEST_ALL_PREFIXES(SelectedKeywordDecorationTest, 45 FRIEND_TEST_ALL_PREFIXES(SelectedKeywordDecorationTest,
42 UsesPartialKeywordIfNarrow); 46 UsesPartialKeywordIfNarrow);
43 47
44 // Contains font attribute for drawing |label_|. 48 // Contains font attribute for drawing |label_|.
45 scoped_nsobject<NSDictionary> attributes_; 49 scoped_nsobject<NSDictionary> attributes_;
46 50
47 // Image drawn in the left side of the bubble. 51 // Image drawn in the left side of the bubble.
48 scoped_nsobject<NSImage> image_; 52 scoped_nsobject<NSImage> image_;
49 53
50 // Label to draw to right of image. Can be |nil|. 54 // Label to draw to right of image. Can be |nil|.
51 scoped_nsobject<NSString> label_; 55 scoped_nsobject<NSString> label_;
52 56
53 // Colors used to draw the bubble, should be set by the subclass 57 // Colors used to draw the bubble, should be set by the subclass
54 // constructor. 58 // constructor.
55 scoped_nsobject<NSColor> background_color_; 59 scoped_nsobject<NSColor> background_color_;
56 scoped_nsobject<NSColor> border_color_; 60 scoped_nsobject<NSColor> border_color_;
57 scoped_nsobject<NSColor> text_color_; 61 scoped_nsobject<NSColor> text_color_;
58 62
59 DISALLOW_COPY_AND_ASSIGN(BubbleDecoration); 63 DISALLOW_COPY_AND_ASSIGN(BubbleDecoration);
60 }; 64 };
61 65
62 #endif // CHROME_BROWSER_COCOA_LOCATION_BAR_BUBBLE_DECORATION_H_ 66 #endif // CHROME_BROWSER_COCOA_LOCATION_BAR_BUBBLE_DECORATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698