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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 void SetLabel(NSString* text, NSFont* baseFont, NSColor* color); | 146 void SetLabel(NSString* text, NSFont* baseFont, NSColor* color); |
147 | 147 |
148 // Sets the visibility. SetImage() should be called with a valid image | 148 // Sets the visibility. SetImage() should be called with a valid image |
149 // before the visibility is set to |true|. | 149 // before the visibility is set to |true|. |
150 void SetVisible(bool visible); | 150 void SetVisible(bool visible); |
151 | 151 |
152 const NSImage* GetImage() const { return image_; } | 152 const NSImage* GetImage() const { return image_; } |
153 const NSAttributedString* GetLabel() const { return label_; } | 153 const NSAttributedString* GetLabel() const { return label_; } |
154 bool IsVisible() const { return visible_; } | 154 bool IsVisible() const { return visible_; } |
155 | 155 |
| 156 // Default size when no image is present. |
| 157 virtual NSSize GetDefaultImageSize() const; |
| 158 |
| 159 // Returns the size of the image, else the default size. |
| 160 NSSize GetImageSize() const; |
| 161 |
156 // Returns the tooltip for this image view or |nil| if there is none. | 162 // Returns the tooltip for this image view or |nil| if there is none. |
157 virtual const NSString* GetToolTip() { return nil; } | 163 virtual const NSString* GetToolTip() { return nil; } |
158 | 164 |
159 // Called on mouse down. | 165 // Called on mouse down. |
160 virtual void OnMousePressed(NSRect bounds) {} | 166 virtual void OnMousePressed(NSRect bounds) {} |
161 | 167 |
162 // Called to get the icon's context menu. Return |nil| for no menu. | 168 // Called to get the icon's context menu. Return |nil| for no menu. |
163 virtual NSMenu* GetMenu() { return nil; } | 169 virtual NSMenu* GetMenu() { return nil; } |
164 | 170 |
165 private: | 171 private: |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 Profile* profile, | 205 Profile* profile, |
200 ExtensionAction* page_action); | 206 ExtensionAction* page_action); |
201 virtual ~PageActionImageView(); | 207 virtual ~PageActionImageView(); |
202 | 208 |
203 ExtensionAction* page_action() { return page_action_; } | 209 ExtensionAction* page_action() { return page_action_; } |
204 | 210 |
205 int current_tab_id() { return current_tab_id_; } | 211 int current_tab_id() { return current_tab_id_; } |
206 | 212 |
207 void set_preview_enabled(bool enabled) { preview_enabled_ = enabled; } | 213 void set_preview_enabled(bool enabled) { preview_enabled_ = enabled; } |
208 | 214 |
209 bool preview_enabled() { return preview_enabled_; } | 215 bool preview_enabled() const { return preview_enabled_; } |
210 | 216 |
211 // Returns the size of the image, or a default size if no image available. | |
212 // When a new page action is created, all the icons are destroyed and | 217 // When a new page action is created, all the icons are destroyed and |
213 // recreated; at this point we need to calculate sizes to lay out the | 218 // recreated; at this point we need to calculate sizes to lay out the |
214 // icons even though no images are available yet. For this case, we return | 219 // icons even though no images are available yet. For this case, we return |
215 // the default image size for a page icon. | 220 // the default image size for a page icon. |
216 virtual NSSize GetPreferredImageSize(); | 221 virtual NSSize GetDefaultImageSize() const; |
217 | 222 |
218 // Either notify listeners or show a popup depending on the Page Action. | 223 // Either notify listeners or show a popup depending on the Page Action. |
219 virtual void OnMousePressed(NSRect bounds); | 224 virtual void OnMousePressed(NSRect bounds); |
220 | 225 |
221 // Overridden from ImageLoadingTracker. | 226 // Overridden from ImageLoadingTracker. |
222 virtual void OnImageLoaded( | 227 virtual void OnImageLoaded( |
223 SkBitmap* image, ExtensionResource resource, int index); | 228 SkBitmap* image, ExtensionResource resource, int index); |
224 | 229 |
225 // Called to notify the Page Action that it should determine whether to be | 230 // Called to notify the Page Action that it should determine whether to be |
226 // visible or hidden. |contents| is the TabContents that is active, |url| | 231 // visible or hidden. |contents| is the TabContents that is active, |url| |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 // edit, we save the input string so we can give it back to the browser on | 387 // edit, we save the input string so we can give it back to the browser on |
383 // the LocationBar interface via GetInputString(). | 388 // the LocationBar interface via GetInputString(). |
384 std::wstring location_input_; | 389 std::wstring location_input_; |
385 | 390 |
386 // The user's desired disposition for how their input should be opened. | 391 // The user's desired disposition for how their input should be opened. |
387 WindowOpenDisposition disposition_; | 392 WindowOpenDisposition disposition_; |
388 | 393 |
389 // A view that shows an icon to the left of the address. | 394 // A view that shows an icon to the left of the address. |
390 LocationIconView location_icon_view_; | 395 LocationIconView location_icon_view_; |
391 | 396 |
| 397 // Security info as text which floats left of the page actions. |
| 398 LocationBarImageView security_label_view_; |
| 399 |
392 // Any installed Page Actions. | 400 // Any installed Page Actions. |
393 PageActionViewList page_action_views_; | 401 PageActionViewList page_action_views_; |
394 | 402 |
395 // The content blocked views. | 403 // The content blocked views. |
396 ContentSettingViews content_setting_views_; | 404 ContentSettingViews content_setting_views_; |
397 | 405 |
398 Profile* profile_; | 406 Profile* profile_; |
399 | 407 |
400 Browser* browser_; | 408 Browser* browser_; |
401 | 409 |
402 ToolbarModel* toolbar_model_; // Weak, owned by Browser. | 410 ToolbarModel* toolbar_model_; // Weak, owned by Browser. |
403 | 411 |
404 // Image used in drawing keyword hint. | 412 // Image used in drawing keyword hint. |
405 scoped_nsobject<NSImage> tab_button_image_; | 413 scoped_nsobject<NSImage> tab_button_image_; |
406 | 414 |
407 // The transition type to use for the navigation. | 415 // The transition type to use for the navigation. |
408 PageTransition::Type transition_; | 416 PageTransition::Type transition_; |
409 | 417 |
410 // Used to register for notifications received by NotificationObserver. | 418 // Used to register for notifications received by NotificationObserver. |
411 NotificationRegistrar registrar_; | 419 NotificationRegistrar registrar_; |
412 | 420 |
413 DISALLOW_COPY_AND_ASSIGN(LocationBarViewMac); | 421 DISALLOW_COPY_AND_ASSIGN(LocationBarViewMac); |
414 }; | 422 }; |
415 | 423 |
416 #endif // CHROME_BROWSER_COCOA_LOCATION_BAR_VIEW_MAC_H_ | 424 #endif // CHROME_BROWSER_COCOA_LOCATION_BAR_VIEW_MAC_H_ |
OLD | NEW |