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_UI_COCOA_LOCATION_BAR_EV_BUBBLE_DECORATION_H_ 6 #define CHROME_BROWSER_UI_COCOA_LOCATION_BAR_EV_BUBBLE_DECORATION_H_ 7 #pragma once 8 9 #import <Cocoa/Cocoa.h> 10 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 EVBubbleDecoration(LocationIconDecoration* location_icon, NSFont* font); 27 virtual ~EVBubbleDecoration(); 28 29 // |GetWidthForSpace()| will set |full_label| as the label, if it 30 // fits, else it will set an elided version. 31 void SetFullLabel(NSString* full_label); 32 33 // Get the point where the page info bubble should point within the 34 // decoration's frame, in the cell's coordinates. 35 NSPoint GetBubblePointInFrame(NSRect frame); 36 37 // Implement |LocationBarDecoration|. 38 virtual CGFloat GetWidthForSpace(CGFloat width); 39 virtual bool IsDraggable(); 40 virtual NSPasteboard* GetDragPasteboard(); 41 virtual NSImage* GetDragImage(); 42 virtual NSRect GetDragImageFrame(NSRect frame); 43 virtual bool OnMousePressed(NSRect frame); 44 virtual bool AcceptsMousePress(); 45 46 private: 47 // Keeps a reference to the font for use when eliding. 48 scoped_nsobject<NSFont> font_; 49 50 // The real label. BubbleDecoration's label may be elided. 51 scoped_nsobject<NSString> full_label_; 52 53 LocationIconDecoration* location_icon_; // weak, owned by location bar. 54 55 DISALLOW_COPY_AND_ASSIGN(EVBubbleDecoration); 56 }; 57 58 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_EV_BUBBLE_DECORATION_H_ 59