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 13 matching lines...) Expand all Loading... |
24 #include "third_party/skia/include/core/SkBitmap.h" | 24 #include "third_party/skia/include/core/SkBitmap.h" |
25 | 25 |
26 @class AutocompleteTextField; | 26 @class AutocompleteTextField; |
27 class CommandUpdater; | 27 class CommandUpdater; |
28 class ContentSettingImageModel; | 28 class ContentSettingImageModel; |
29 class EVBubbleDecoration; | 29 class EVBubbleDecoration; |
30 @class ExtensionPopupController; | 30 @class ExtensionPopupController; |
31 class LocationIconDecoration; | 31 class LocationIconDecoration; |
32 class Profile; | 32 class Profile; |
33 class SelectedKeywordDecoration; | 33 class SelectedKeywordDecoration; |
| 34 class StarDecoration; |
34 class ToolbarModel; | 35 class ToolbarModel; |
35 | 36 |
36 // A C++ bridge class that represents the location bar UI element to | 37 // A C++ bridge class that represents the location bar UI element to |
37 // the portable code. Wires up an AutocompleteEditViewMac instance to | 38 // the portable code. Wires up an AutocompleteEditViewMac instance to |
38 // the location bar text field, which handles most of the work. | 39 // the location bar text field, which handles most of the work. |
39 | 40 |
40 class LocationBarViewMac : public AutocompleteEditController, | 41 class LocationBarViewMac : public AutocompleteEditController, |
41 public LocationBar, | 42 public LocationBar, |
42 public LocationBarTesting, | 43 public LocationBarTesting, |
43 public NotificationObserver { | 44 public NotificationObserver { |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 scoped_nsobject<NSImage> image_; | 193 scoped_nsobject<NSImage> image_; |
193 | 194 |
194 // The label shown next to the icon, or nil if none. | 195 // The label shown next to the icon, or nil if none. |
195 scoped_nsobject<NSAttributedString> label_; | 196 scoped_nsobject<NSAttributedString> label_; |
196 | 197 |
197 bool visible_; | 198 bool visible_; |
198 | 199 |
199 DISALLOW_COPY_AND_ASSIGN(LocationBarImageView); | 200 DISALLOW_COPY_AND_ASSIGN(LocationBarImageView); |
200 }; | 201 }; |
201 | 202 |
202 // Used to display the bookmark star in the RHS. | |
203 class StarIconView : public LocationBarImageView { | |
204 public: | |
205 explicit StarIconView(CommandUpdater* command_updater); | |
206 virtual ~StarIconView() {} | |
207 | |
208 // Shows the bookmark bubble. | |
209 virtual void OnMousePressed(NSRect bounds); | |
210 | |
211 // Set the image and tooltip based on |starred|. | |
212 void SetStarred(bool starred); | |
213 | |
214 virtual NSString* GetToolTip(); | |
215 | |
216 private: | |
217 // For bringing up bookmark bar. | |
218 CommandUpdater* command_updater_; // Weak, owned by Browser. | |
219 | |
220 // The string to show for a tooltip. | |
221 scoped_nsobject<NSString> tooltip_; | |
222 | |
223 DISALLOW_COPY_AND_ASSIGN(StarIconView); | |
224 }; | |
225 | |
226 // PageActionImageView is used to display the icon for a given Page Action | 203 // PageActionImageView is used to display the icon for a given Page Action |
227 // and notify the extension when the icon is clicked. | 204 // and notify the extension when the icon is clicked. |
228 class PageActionImageView : public LocationBarImageView, | 205 class PageActionImageView : public LocationBarImageView, |
229 public ImageLoadingTracker::Observer, | 206 public ImageLoadingTracker::Observer, |
230 public NotificationObserver { | 207 public NotificationObserver { |
231 public: | 208 public: |
232 PageActionImageView(LocationBarViewMac* owner, | 209 PageActionImageView(LocationBarViewMac* owner, |
233 Profile* profile, | 210 Profile* profile, |
234 ExtensionAction* page_action); | 211 ExtensionAction* page_action); |
235 virtual ~PageActionImageView(); | 212 virtual ~PageActionImageView(); |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 scoped_ptr<LocationIconDecoration> location_icon_decoration_; | 396 scoped_ptr<LocationIconDecoration> location_icon_decoration_; |
420 | 397 |
421 // A decoration that shows the keyword-search bubble on the left. | 398 // A decoration that shows the keyword-search bubble on the left. |
422 scoped_ptr<SelectedKeywordDecoration> selected_keyword_decoration_; | 399 scoped_ptr<SelectedKeywordDecoration> selected_keyword_decoration_; |
423 | 400 |
424 // A decoration that shows a lock icon and ev-cert label in a bubble | 401 // A decoration that shows a lock icon and ev-cert label in a bubble |
425 // on the left. | 402 // on the left. |
426 scoped_ptr<EVBubbleDecoration> ev_bubble_decoration_; | 403 scoped_ptr<EVBubbleDecoration> ev_bubble_decoration_; |
427 | 404 |
428 // Bookmark star right of page actions. | 405 // Bookmark star right of page actions. |
429 StarIconView star_icon_view_; | 406 scoped_ptr<StarDecoration> star_decoration_; |
430 | 407 |
431 // Any installed Page Actions. | 408 // Any installed Page Actions. |
432 PageActionViewList page_action_views_; | 409 PageActionViewList page_action_views_; |
433 | 410 |
434 // The content blocked views. | 411 // The content blocked views. |
435 ContentSettingViews content_setting_views_; | 412 ContentSettingViews content_setting_views_; |
436 | 413 |
437 Profile* profile_; | 414 Profile* profile_; |
438 | 415 |
439 Browser* browser_; | 416 Browser* browser_; |
440 | 417 |
441 ToolbarModel* toolbar_model_; // Weak, owned by Browser. | 418 ToolbarModel* toolbar_model_; // Weak, owned by Browser. |
442 | 419 |
443 // Image used in drawing keyword hint. | 420 // Image used in drawing keyword hint. |
444 scoped_nsobject<NSImage> tab_button_image_; | 421 scoped_nsobject<NSImage> tab_button_image_; |
445 | 422 |
446 // The transition type to use for the navigation. | 423 // The transition type to use for the navigation. |
447 PageTransition::Type transition_; | 424 PageTransition::Type transition_; |
448 | 425 |
449 // Used to register for notifications received by NotificationObserver. | 426 // Used to register for notifications received by NotificationObserver. |
450 NotificationRegistrar registrar_; | 427 NotificationRegistrar registrar_; |
451 | 428 |
452 // Used to schedule a task for the first run info bubble. | 429 // Used to schedule a task for the first run info bubble. |
453 ScopedRunnableMethodFactory<LocationBarViewMac> first_run_bubble_; | 430 ScopedRunnableMethodFactory<LocationBarViewMac> first_run_bubble_; |
454 | 431 |
455 DISALLOW_COPY_AND_ASSIGN(LocationBarViewMac); | 432 DISALLOW_COPY_AND_ASSIGN(LocationBarViewMac); |
456 }; | 433 }; |
457 | 434 |
458 #endif // CHROME_BROWSER_COCOA_LOCATION_BAR_VIEW_MAC_H_ | 435 #endif // CHROME_BROWSER_COCOA_LOCATION_BAR_VIEW_MAC_H_ |
OLD | NEW |