| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 void SetIcon(int resource_id); | 157 void SetIcon(int resource_id); |
| 158 | 158 |
| 159 // Sets the label text, font, and color. |text| may be nil; |color| and | 159 // Sets the label text, font, and color. |text| may be nil; |color| and |
| 160 // |font| are ignored if |text| is nil. | 160 // |font| are ignored if |text| is nil. |
| 161 void SetLabel(NSString* text, NSFont* baseFont, NSColor* color); | 161 void SetLabel(NSString* text, NSFont* baseFont, NSColor* color); |
| 162 | 162 |
| 163 // Sets the visibility. SetImage() should be called with a valid image | 163 // Sets the visibility. SetImage() should be called with a valid image |
| 164 // before the visibility is set to |true|. | 164 // before the visibility is set to |true|. |
| 165 void SetVisible(bool visible); | 165 void SetVisible(bool visible); |
| 166 | 166 |
| 167 const NSImage* GetImage() const { return image_; } | 167 NSImage* GetImage() const { return image_; } |
| 168 const NSAttributedString* GetLabel() const { return label_; } | 168 NSAttributedString* GetLabel() const { return label_; } |
| 169 bool IsVisible() const { return visible_; } | 169 bool IsVisible() const { return visible_; } |
| 170 | 170 |
| 171 // Default size when no image is present. | 171 // Default size when no image is present. |
| 172 virtual NSSize GetDefaultImageSize() const; | 172 virtual NSSize GetDefaultImageSize() const; |
| 173 | 173 |
| 174 // Returns the size of the image, else the default size. | 174 // Returns the size of the image, else the default size. |
| 175 NSSize GetImageSize() const; | 175 NSSize GetImageSize() const; |
| 176 | 176 |
| 177 // Returns the tooltip for this image view or |nil| if there is none. | 177 // Returns the tooltip for this image view or |nil| if there is none. |
| 178 virtual const NSString* GetToolTip() { return nil; } | 178 virtual NSString* GetToolTip() { return nil; } |
| 179 | 179 |
| 180 // Used to determinate if the item can act as a drag source. | 180 // Used to determinate if the item can act as a drag source. |
| 181 virtual bool IsDraggable() { return false; } | 181 virtual bool IsDraggable() { return false; } |
| 182 | 182 |
| 183 // The drag pasteboard to use if a drag is initiated. | 183 // The drag pasteboard to use if a drag is initiated. |
| 184 virtual NSPasteboard* GetDragPasteboard() { return nil; } | 184 virtual NSPasteboard* GetDragPasteboard() { return nil; } |
| 185 | 185 |
| 186 // Called on mouse down. | 186 // Called on mouse down. |
| 187 virtual void OnMousePressed(NSRect bounds) {} | 187 virtual void OnMousePressed(NSRect bounds) {} |
| 188 | 188 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 public: | 227 public: |
| 228 explicit StarIconView(CommandUpdater* command_updater); | 228 explicit StarIconView(CommandUpdater* command_updater); |
| 229 virtual ~StarIconView() {} | 229 virtual ~StarIconView() {} |
| 230 | 230 |
| 231 // Shows the bookmark bubble. | 231 // Shows the bookmark bubble. |
| 232 virtual void OnMousePressed(NSRect bounds); | 232 virtual void OnMousePressed(NSRect bounds); |
| 233 | 233 |
| 234 // Set the image and tooltip based on |starred|. | 234 // Set the image and tooltip based on |starred|. |
| 235 void SetStarred(bool starred); | 235 void SetStarred(bool starred); |
| 236 | 236 |
| 237 virtual const NSString* GetToolTip(); | 237 virtual NSString* GetToolTip(); |
| 238 | 238 |
| 239 private: | 239 private: |
| 240 // For bringing up bookmark bar. | 240 // For bringing up bookmark bar. |
| 241 CommandUpdater* command_updater_; // Weak, owned by Browser. | 241 CommandUpdater* command_updater_; // Weak, owned by Browser. |
| 242 | 242 |
| 243 // The string to show for a tooltip. | 243 // The string to show for a tooltip. |
| 244 scoped_nsobject<NSString> tooltip_; | 244 scoped_nsobject<NSString> tooltip_; |
| 245 | 245 |
| 246 DISALLOW_COPY_AND_ASSIGN(StarIconView); | 246 DISALLOW_COPY_AND_ASSIGN(StarIconView); |
| 247 }; | 247 }; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 // Called to notify the Page Action that it should determine whether to be | 281 // Called to notify the Page Action that it should determine whether to be |
| 282 // visible or hidden. |contents| is the TabContents that is active, |url| | 282 // visible or hidden. |contents| is the TabContents that is active, |url| |
| 283 // is the current page URL. | 283 // is the current page URL. |
| 284 void UpdateVisibility(TabContents* contents, const GURL& url); | 284 void UpdateVisibility(TabContents* contents, const GURL& url); |
| 285 | 285 |
| 286 // Sets the tooltip for this Page Action image. | 286 // Sets the tooltip for this Page Action image. |
| 287 void SetToolTip(NSString* tooltip); | 287 void SetToolTip(NSString* tooltip); |
| 288 void SetToolTip(std::string tooltip); | 288 void SetToolTip(std::string tooltip); |
| 289 | 289 |
| 290 // Returns the tooltip for this Page Action image or |nil| if there is none. | 290 // Returns the tooltip for this Page Action image or |nil| if there is none. |
| 291 virtual const NSString* GetToolTip(); | 291 virtual NSString* GetToolTip(); |
| 292 | 292 |
| 293 // Overridden to return a menu. | 293 // Overridden to return a menu. |
| 294 virtual NSMenu* GetMenu(); | 294 virtual NSMenu* GetMenu(); |
| 295 | 295 |
| 296 protected: | 296 protected: |
| 297 // For unit testing only. | 297 // For unit testing only. |
| 298 PageActionImageView() : owner_(NULL), | 298 PageActionImageView() : owner_(NULL), |
| 299 profile_(NULL), | 299 profile_(NULL), |
| 300 page_action_(NULL), | 300 page_action_(NULL), |
| 301 tracker_(this), | 301 tracker_(this), |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 Profile* profile); | 354 Profile* profile); |
| 355 virtual ~ContentSettingImageView(); | 355 virtual ~ContentSettingImageView(); |
| 356 | 356 |
| 357 // Shows a content settings bubble. | 357 // Shows a content settings bubble. |
| 358 void OnMousePressed(NSRect bounds); | 358 void OnMousePressed(NSRect bounds); |
| 359 | 359 |
| 360 // Updates the image and visibility state based on the supplied TabContents. | 360 // Updates the image and visibility state based on the supplied TabContents. |
| 361 void UpdateFromTabContents(const TabContents* tab_contents); | 361 void UpdateFromTabContents(const TabContents* tab_contents); |
| 362 | 362 |
| 363 // Returns the tooltip for this Page Action image or |nil| if there is none. | 363 // Returns the tooltip for this Page Action image or |nil| if there is none. |
| 364 virtual const NSString* GetToolTip(); | 364 virtual NSString* GetToolTip(); |
| 365 | 365 |
| 366 private: | 366 private: |
| 367 void SetToolTip(NSString* tooltip); | 367 void SetToolTip(NSString* tooltip); |
| 368 | 368 |
| 369 scoped_ptr<ContentSettingImageModel> content_setting_image_model_; | 369 scoped_ptr<ContentSettingImageModel> content_setting_image_model_; |
| 370 | 370 |
| 371 LocationBarViewMac* owner_; | 371 LocationBarViewMac* owner_; |
| 372 Profile* profile_; | 372 Profile* profile_; |
| 373 scoped_nsobject<NSString> tooltip_; | 373 scoped_nsobject<NSString> tooltip_; |
| 374 | 374 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 }; | 415 }; |
| 416 | 416 |
| 417 private: | 417 private: |
| 418 // Sets the location icon we should be showing. | 418 // Sets the location icon we should be showing. |
| 419 void SetIcon(int resource_id); | 419 void SetIcon(int resource_id); |
| 420 | 420 |
| 421 // Sets the label for the SSL state. | 421 // Sets the label for the SSL state. |
| 422 void SetSecurityLabel(); | 422 void SetSecurityLabel(); |
| 423 | 423 |
| 424 // Posts |notification| to the default notification center. | 424 // Posts |notification| to the default notification center. |
| 425 void PostNotification(const NSString* notification); | 425 void PostNotification(NSString* notification); |
| 426 | 426 |
| 427 // Updates visibility of the content settings icons based on the current | 427 // Updates visibility of the content settings icons based on the current |
| 428 // tab contents state. | 428 // tab contents state. |
| 429 void RefreshContentSettingsViews(); | 429 void RefreshContentSettingsViews(); |
| 430 | 430 |
| 431 scoped_ptr<AutocompleteEditViewMac> edit_view_; | 431 scoped_ptr<AutocompleteEditViewMac> edit_view_; |
| 432 | 432 |
| 433 CommandUpdater* command_updater_; // Weak, owned by Browser. | 433 CommandUpdater* command_updater_; // Weak, owned by Browser. |
| 434 | 434 |
| 435 AutocompleteTextField* field_; // owned by tab controller | 435 AutocompleteTextField* field_; // owned by tab controller |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 // The transition type to use for the navigation. | 469 // The transition type to use for the navigation. |
| 470 PageTransition::Type transition_; | 470 PageTransition::Type transition_; |
| 471 | 471 |
| 472 // Used to register for notifications received by NotificationObserver. | 472 // Used to register for notifications received by NotificationObserver. |
| 473 NotificationRegistrar registrar_; | 473 NotificationRegistrar registrar_; |
| 474 | 474 |
| 475 DISALLOW_COPY_AND_ASSIGN(LocationBarViewMac); | 475 DISALLOW_COPY_AND_ASSIGN(LocationBarViewMac); |
| 476 }; | 476 }; |
| 477 | 477 |
| 478 #endif // CHROME_BROWSER_COCOA_LOCATION_BAR_VIEW_MAC_H_ | 478 #endif // CHROME_BROWSER_COCOA_LOCATION_BAR_VIEW_MAC_H_ |
| OLD | NEW |