OLD | NEW |
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_VIEW_MAC_H_ | 5 #ifndef CHROME_BROWSER_COCOA_LOCATION_BAR_VIEW_MAC_H_ |
6 #define CHROME_BROWSER_COCOA_LOCATION_BAR_VIEW_MAC_H_ | 6 #define CHROME_BROWSER_COCOA_LOCATION_BAR_VIEW_MAC_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <map> | 9 #include <map> |
10 #include <vector> | 10 #include <vector> |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 | 160 |
161 // Default size when no image is present. | 161 // Default size when no image is present. |
162 virtual NSSize GetDefaultImageSize() const; | 162 virtual NSSize GetDefaultImageSize() const; |
163 | 163 |
164 // Returns the size of the image, else the default size. | 164 // Returns the size of the image, else the default size. |
165 NSSize GetImageSize() const; | 165 NSSize GetImageSize() const; |
166 | 166 |
167 // Returns the tooltip for this image view or |nil| if there is none. | 167 // Returns the tooltip for this image view or |nil| if there is none. |
168 virtual const NSString* GetToolTip() { return nil; } | 168 virtual const NSString* GetToolTip() { return nil; } |
169 | 169 |
| 170 // Used to determinate if the item can act as a drag source. |
| 171 virtual bool IsDraggable() { return false; } |
| 172 |
| 173 // The drag pasteboard to use if a drag is initiated. |
| 174 virtual NSPasteboard* GetDragPasteboard() { return nil; } |
| 175 |
170 // Called on mouse down. | 176 // Called on mouse down. |
171 virtual void OnMousePressed(NSRect bounds) {} | 177 virtual void OnMousePressed(NSRect bounds) {} |
172 | 178 |
173 // Called to get the icon's context menu. Return |nil| for no menu. | 179 // Called to get the icon's context menu. Return |nil| for no menu. |
174 virtual NSMenu* GetMenu() { return nil; } | 180 virtual NSMenu* GetMenu() { return nil; } |
175 | 181 |
176 private: | 182 private: |
177 scoped_nsobject<NSImage> image_; | 183 scoped_nsobject<NSImage> image_; |
178 | 184 |
179 // The label shown next to the icon, or nil if none. | 185 // The label shown next to the icon, or nil if none. |
180 scoped_nsobject<NSAttributedString> label_; | 186 scoped_nsobject<NSAttributedString> label_; |
181 | 187 |
182 bool visible_; | 188 bool visible_; |
183 | 189 |
184 DISALLOW_COPY_AND_ASSIGN(LocationBarImageView); | 190 DISALLOW_COPY_AND_ASSIGN(LocationBarImageView); |
185 }; | 191 }; |
186 | 192 |
187 // LocationIconView is used to display an icon to the left of the address. | 193 // LocationIconView is used to display an icon to the left of the address. |
188 class LocationIconView : public LocationBarImageView { | 194 class LocationIconView : public LocationBarImageView { |
189 public: | 195 public: |
190 explicit LocationIconView(LocationBarViewMac* owner); | 196 explicit LocationIconView(LocationBarViewMac* owner); |
191 virtual ~LocationIconView(); | 197 virtual ~LocationIconView(); |
192 | 198 |
| 199 // Is draggable if the autocomplete edit view has not be changed. |
| 200 virtual bool IsDraggable(); |
| 201 |
| 202 // Drag the URL and title from the current tab. |
| 203 virtual NSPasteboard* GetDragPasteboard(); |
| 204 |
193 // Shows the page info dialog. | 205 // Shows the page info dialog. |
194 virtual void OnMousePressed(NSRect bounds); | 206 virtual void OnMousePressed(NSRect bounds); |
195 | 207 |
196 private: | 208 private: |
197 // The location bar view that owns us. | 209 // The location bar view that owns us. |
198 LocationBarViewMac* owner_; | 210 LocationBarViewMac* owner_; |
199 | 211 |
200 DISALLOW_COPY_AND_ASSIGN(LocationIconView); | 212 DISALLOW_COPY_AND_ASSIGN(LocationIconView); |
201 }; | 213 }; |
202 | 214 |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 // The transition type to use for the navigation. | 459 // The transition type to use for the navigation. |
448 PageTransition::Type transition_; | 460 PageTransition::Type transition_; |
449 | 461 |
450 // Used to register for notifications received by NotificationObserver. | 462 // Used to register for notifications received by NotificationObserver. |
451 NotificationRegistrar registrar_; | 463 NotificationRegistrar registrar_; |
452 | 464 |
453 DISALLOW_COPY_AND_ASSIGN(LocationBarViewMac); | 465 DISALLOW_COPY_AND_ASSIGN(LocationBarViewMac); |
454 }; | 466 }; |
455 | 467 |
456 #endif // CHROME_BROWSER_COCOA_LOCATION_BAR_VIEW_MAC_H_ | 468 #endif // CHROME_BROWSER_COCOA_LOCATION_BAR_VIEW_MAC_H_ |
OLD | NEW |