OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_UI_COCOA_LOCATION_BAR_EV_BUBBLE_DECORATION_H_ | |
6 #define CHROME_BROWSER_UI_COCOA_LOCATION_BAR_EV_BUBBLE_DECORATION_H_ | |
7 | |
8 #import <Cocoa/Cocoa.h> | |
9 | |
10 #include "base/macros.h" | |
11 #include "chrome/browser/ui/cocoa/location_bar/bubble_decoration.h" | |
12 | |
13 // Draws the "Extended Validation SSL" bubble. This will be a lock | |
14 // icon plus a label from the certification, and will replace the | |
15 // location icon for URLs which have an EV cert. The |location_icon| | |
16 // is used to fulfill drag-related calls. | |
17 | |
18 // TODO(shess): Refactor to pull the |location_icon| functionality out | |
19 // into a distinct class like views |ClickHandler|. | |
20 // http://crbug.com/48866 | |
21 | |
22 class LocationIconDecoration; | |
23 | |
24 class EVBubbleDecoration : public BubbleDecoration { | |
25 public: | |
26 explicit EVBubbleDecoration(LocationIconDecoration* location_icon); | |
27 ~EVBubbleDecoration() override; | |
28 | |
29 // Return the color used to draw the EvBubbleDecoration background in MD. | |
30 NSColor* GetBackgroundBorderColor() override; | |
31 | |
32 // |GetWidthForSpace()| will set |full_label| as the label, if it | |
33 // fits, else it will set an elided version. | |
34 void SetFullLabel(NSString* full_label); | |
35 | |
36 // Implement |LocationBarDecoration|. | |
37 CGFloat GetWidthForSpace(CGFloat width) override; | |
38 | |
39 // Perform custom drawing for Material Design. | |
40 void DrawWithBackgroundInFrame(NSRect background_frame, | |
41 NSRect frame, | |
42 NSView* control_view) override; | |
43 | |
44 bool IsDraggable() override; | |
45 NSPasteboard* GetDragPasteboard() override; | |
46 NSImage* GetDragImage() override; | |
47 NSRect GetDragImageFrame(NSRect frame) override; | |
48 bool OnMousePressed(NSRect frame, NSPoint location) override; | |
49 bool AcceptsMousePress() override; | |
50 NSPoint GetBubblePointInFrame(NSRect frame) override; | |
51 | |
52 // Implement |BubbleDecoration|. | |
53 ui::NinePartImageIds GetBubbleImageIds() override; | |
54 | |
55 protected: | |
56 NSColor* GetDarkModeTextColor() override; | |
57 | |
58 private: | |
59 // The real label. BubbleDecoration's label may be elided. | |
60 base::scoped_nsobject<NSString> full_label_; | |
61 | |
62 LocationIconDecoration* location_icon_; // weak, owned by location bar. | |
63 | |
64 DISALLOW_COPY_AND_ASSIGN(EVBubbleDecoration); | |
65 }; | |
66 | |
67 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_EV_BUBBLE_DECORATION_H_ | |
OLD | NEW |