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