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