| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_UI_COCOA_LOCATION_BAR_ZOOM_DECORATION_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_LOCATION_BAR_ZOOM_DECORATION_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_LOCATION_BAR_ZOOM_DECORATION_H_ | 6 #define CHROME_BROWSER_UI_COCOA_LOCATION_BAR_ZOOM_DECORATION_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #import "chrome/browser/ui/cocoa/browser/zoom_bubble_controller.h" | 11 #import "chrome/browser/ui/cocoa/browser/zoom_bubble_controller.h" |
| 12 #include "chrome/browser/ui/cocoa/location_bar/image_decoration.h" | 12 #include "chrome/browser/ui/cocoa/location_bar/image_decoration.h" |
| 13 | 13 |
| 14 class LocationBarViewMac; | 14 class LocationBarViewMac; |
| 15 @class ZoomBubbleController; | 15 @class ZoomBubbleController; |
| 16 class ZoomDecorationTest; | 16 class ZoomDecorationTest; |
| 17 | 17 |
| 18 namespace ui_zoom { | 18 namespace zoom { |
| 19 class ZoomController; | 19 class ZoomController; |
| 20 } | 20 } |
| 21 | 21 |
| 22 // Zoom icon at the end of the omnibox (close to page actions) when at a | 22 // Zoom icon at the end of the omnibox (close to page actions) when at a |
| 23 // non-standard zoom level. | 23 // non-standard zoom level. |
| 24 class ZoomDecoration : public ImageDecoration, | 24 class ZoomDecoration : public ImageDecoration, |
| 25 public ZoomBubbleControllerDelegate { | 25 public ZoomBubbleControllerDelegate { |
| 26 public: | 26 public: |
| 27 explicit ZoomDecoration(LocationBarViewMac* owner); | 27 explicit ZoomDecoration(LocationBarViewMac* owner); |
| 28 ~ZoomDecoration() override; | 28 ~ZoomDecoration() override; |
| 29 | 29 |
| 30 // Called when this decoration should show or hide itself in its most current | 30 // Called when this decoration should show or hide itself in its most current |
| 31 // state. Returns whether any updates were made. | 31 // state. Returns whether any updates were made. |
| 32 bool UpdateIfNecessary(ui_zoom::ZoomController* zoom_controller, | 32 bool UpdateIfNecessary(zoom::ZoomController* zoom_controller, |
| 33 bool default_zoom_changed, | 33 bool default_zoom_changed, |
| 34 bool location_bar_is_dark); | 34 bool location_bar_is_dark); |
| 35 | 35 |
| 36 // Shows the zoom bubble for this decoration. If |auto_close| is YES, then | 36 // Shows the zoom bubble for this decoration. If |auto_close| is YES, then |
| 37 // the bubble will automatically close after a fixed period of time. | 37 // the bubble will automatically close after a fixed period of time. |
| 38 // If a bubble is already showing, the |auto_close| timer is reset. | 38 // If a bubble is already showing, the |auto_close| timer is reset. |
| 39 void ShowBubble(BOOL auto_close); | 39 void ShowBubble(BOOL auto_close); |
| 40 | 40 |
| 41 // Closes the zoom bubble. | 41 // Closes the zoom bubble. |
| 42 void CloseBubble(); | 42 void CloseBubble(); |
| 43 | 43 |
| 44 protected: | 44 protected: |
| 45 // Hides all UI associated with the zoom decoration. | 45 // Hides all UI associated with the zoom decoration. |
| 46 // Virtual and protected for testing. | 46 // Virtual and protected for testing. |
| 47 virtual void HideUI(); | 47 virtual void HideUI(); |
| 48 | 48 |
| 49 // Show and update UI associated with the zoom decoration. | 49 // Show and update UI associated with the zoom decoration. |
| 50 // Virtual and protected for testing. | 50 // Virtual and protected for testing. |
| 51 virtual void ShowAndUpdateUI(ui_zoom::ZoomController* zoom_controller, | 51 virtual void ShowAndUpdateUI(zoom::ZoomController* zoom_controller, |
| 52 NSString* tooltip_string, | 52 NSString* tooltip_string, |
| 53 bool location_bar_is_dark); | 53 bool location_bar_is_dark); |
| 54 | 54 |
| 55 // Overridden from LocationBarDecoration: | 55 // Overridden from LocationBarDecoration: |
| 56 gfx::VectorIconId GetMaterialVectorIconId() const override; | 56 gfx::VectorIconId GetMaterialVectorIconId() const override; |
| 57 | 57 |
| 58 private: | 58 private: |
| 59 friend ZoomDecorationTest; | 59 friend ZoomDecorationTest; |
| 60 | 60 |
| 61 bool IsAtDefaultZoom() const; | 61 bool IsAtDefaultZoom() const; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 81 | 81 |
| 82 // The string to show for a tooltip. | 82 // The string to show for a tooltip. |
| 83 base::scoped_nsobject<NSString> tooltip_; | 83 base::scoped_nsobject<NSString> tooltip_; |
| 84 | 84 |
| 85 gfx::VectorIconId vector_icon_id_; | 85 gfx::VectorIconId vector_icon_id_; |
| 86 | 86 |
| 87 DISALLOW_COPY_AND_ASSIGN(ZoomDecoration); | 87 DISALLOW_COPY_AND_ASSIGN(ZoomDecoration); |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_ZOOM_DECORATION_H_ | 90 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_ZOOM_DECORATION_H_ |
| OLD | NEW |