ev_bubble_decoration.h revision 68043e1e95eeb07d5cae7aca370b26518b0867d6
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 "chrome/browser/ui/cocoa/location_bar/bubble_decoration.h" 11 12// Draws the "Extended Validation SSL" bubble. This will be a lock 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| 15// is used to fulfill drag-related calls. 16 17// TODO(shess): Refactor to pull the |location_icon| functionality out 18// into a distinct class like views |ClickHandler|. 19// http://crbug.com/48866 20 21class LocationIconDecoration; 22 23class EVBubbleDecoration : public BubbleDecoration { 24 public: 25 explicit EVBubbleDecoration(LocationIconDecoration* location_icon); 26 virtual ~EVBubbleDecoration(); 27 28 // |GetWidthForSpace()| will set |full_label| as the label, if it 29 // fits, else it will set an elided version. 30 void SetFullLabel(NSString* full_label); 31 32 // Get the point where the page info bubble should point within the 33 // decoration's frame, in the cell's coordinates. 34 NSPoint GetBubblePointInFrame(NSRect frame); 35 36 // Implement |LocationBarDecoration|. 37 virtual CGFloat GetWidthForSpace(CGFloat width) OVERRIDE; 38 virtual bool IsDraggable() OVERRIDE; 39 virtual NSPasteboard* GetDragPasteboard() OVERRIDE; 40 virtual NSImage* GetDragImage() OVERRIDE; 41 virtual NSRect GetDragImageFrame(NSRect frame) OVERRIDE; 42 virtual bool OnMousePressed(NSRect frame) OVERRIDE; 43 virtual bool AcceptsMousePress() OVERRIDE; 44 45 // Implement |BubbleDecoration|. 46 virtual ui::NinePartImageIds GetBubbleImageIds() OVERRIDE; 47 48 private: 49 // The real label. BubbleDecoration's label may be elided. 50 base::scoped_nsobject<NSString> full_label_; 51 52 LocationIconDecoration* location_icon_; // weak, owned by location bar. 53 54 DISALLOW_COPY_AND_ASSIGN(EVBubbleDecoration); 55}; 56 57#endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_EV_BUBBLE_DECORATION_H_ 58