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/basictypes.h" | 10 #include "base/basictypes.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; |
| 17 |
| 18 namespace ui_zoom { |
16 class ZoomController; | 19 class ZoomController; |
17 class ZoomDecorationTest; | 20 } |
18 | 21 |
19 // 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 |
20 // non-standard zoom level. | 23 // non-standard zoom level. |
21 class ZoomDecoration : public ImageDecoration, | 24 class ZoomDecoration : public ImageDecoration, |
22 public ZoomBubbleControllerDelegate { | 25 public ZoomBubbleControllerDelegate { |
23 public: | 26 public: |
24 explicit ZoomDecoration(LocationBarViewMac* owner); | 27 explicit ZoomDecoration(LocationBarViewMac* owner); |
25 ~ZoomDecoration() override; | 28 ~ZoomDecoration() override; |
26 | 29 |
27 // 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 |
28 // state. Returns whether any updates were made. | 31 // state. Returns whether any updates were made. |
29 bool UpdateIfNecessary(ZoomController* zoom_controller); | 32 bool UpdateIfNecessary(ui_zoom::ZoomController* zoom_controller); |
30 | 33 |
31 // Shows the zoom bubble for this decoration. If |auto_close| is YES, then | 34 // Shows the zoom bubble for this decoration. If |auto_close| is YES, then |
32 // the bubble will automatically close after a fixed period of time. | 35 // the bubble will automatically close after a fixed period of time. |
33 void ShowBubble(BOOL auto_close); | 36 void ShowBubble(BOOL auto_close); |
34 | 37 |
35 // Closes the zoom bubble. | 38 // Closes the zoom bubble. |
36 void CloseBubble(); | 39 void CloseBubble(); |
37 | 40 |
38 protected: | 41 protected: |
39 // Hides all UI associated with the zoom decoration. | 42 // Hides all UI associated with the zoom decoration. |
40 // Virtual and protected for testing. | 43 // Virtual and protected for testing. |
41 virtual void HideUI(); | 44 virtual void HideUI(); |
42 | 45 |
43 // Show and update UI associated with the zoom decoration. | 46 // Show and update UI associated with the zoom decoration. |
44 // Virtual and protected for testing. | 47 // Virtual and protected for testing. |
45 virtual void ShowAndUpdateUI(ZoomController* zoom_controller, | 48 virtual void ShowAndUpdateUI(ui_zoom::ZoomController* zoom_controller, |
46 NSString* tooltip_string); | 49 NSString* tooltip_string); |
47 | 50 |
48 private: | 51 private: |
49 friend ZoomDecorationTest; | 52 friend ZoomDecorationTest; |
50 | 53 |
51 bool IsAtDefaultZoom() const; | 54 bool IsAtDefaultZoom() const; |
52 | 55 |
53 // Virtual for testing. | 56 // Virtual for testing. |
54 virtual bool ShouldShowDecoration() const; | 57 virtual bool ShouldShowDecoration() const; |
55 | 58 |
(...skipping 13 matching lines...) Expand all Loading... |
69 // The bubble that this decoration shows. Weak, owns self. | 72 // The bubble that this decoration shows. Weak, owns self. |
70 ZoomBubbleController* bubble_; | 73 ZoomBubbleController* bubble_; |
71 | 74 |
72 // The string to show for a tooltip. | 75 // The string to show for a tooltip. |
73 base::scoped_nsobject<NSString> tooltip_; | 76 base::scoped_nsobject<NSString> tooltip_; |
74 | 77 |
75 DISALLOW_COPY_AND_ASSIGN(ZoomDecoration); | 78 DISALLOW_COPY_AND_ASSIGN(ZoomDecoration); |
76 }; | 79 }; |
77 | 80 |
78 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_ZOOM_DECORATION_H_ | 81 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_ZOOM_DECORATION_H_ |
OLD | NEW |