| 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 #include "chrome/browser/ui/cocoa/location_bar/image_decoration.h" | 11 #include "chrome/browser/ui/cocoa/location_bar/image_decoration.h" | 
| 12 | 12 | 
| 13 class LocationBarViewMac; | 13 class LocationBarViewMac; | 
| 14 @class ZoomBubbleController; | 14 @class ZoomBubbleController; | 
| 15 class ZoomController; | 15 class ZoomController; | 
|  | 16 class ZoomDecorationTest; | 
| 16 | 17 | 
| 17 // Zoom icon at the end of the omnibox (close to page actions) when at a | 18 // Zoom icon at the end of the omnibox (close to page actions) when at a | 
| 18 // non-standard zoom level. | 19 // non-standard zoom level. | 
| 19 class ZoomDecoration : public ImageDecoration { | 20 class ZoomDecoration : public ImageDecoration { | 
| 20  public: | 21  public: | 
| 21   explicit ZoomDecoration(LocationBarViewMac* owner); | 22   explicit ZoomDecoration(LocationBarViewMac* owner); | 
| 22   virtual ~ZoomDecoration(); | 23   virtual ~ZoomDecoration(); | 
| 23 | 24 | 
| 24   // Called when this decoration should show or hide itself in its most current | 25   // Called when this decoration should show or hide itself in its most current | 
| 25   // state. | 26   // state. | 
| 26   void Update(ZoomController* zoom_controller); | 27   void Update(ZoomController* zoom_controller); | 
| 27 | 28 | 
| 28   // Shows the zoom bubble for this decoration. If |auto_close| is YES, then | 29   // Shows the zoom bubble for this decoration. If |auto_close| is YES, then | 
| 29   // the bubble will automatically close after a fixed period of time. | 30   // the bubble will automatically close after a fixed period of time. Closes | 
| 30   void ShowBubble(BOOL auto_close); | 31   // the bubble if it was already visible. | 
|  | 32   void ToggleBubble(BOOL auto_close); | 
| 31 | 33 | 
| 32  private: | 34  private: | 
|  | 35   friend ZoomDecorationTest; | 
|  | 36 | 
| 33   NSPoint GetBubblePointInFrame(NSRect frame); | 37   NSPoint GetBubblePointInFrame(NSRect frame); | 
|  | 38   bool IsAtDefaultZoom() const; | 
|  | 39   bool ShouldShowDecoration() const; | 
| 34 | 40 | 
| 35   // LocationBarDecoration implementation. | 41   // LocationBarDecoration implementation. | 
| 36   virtual bool AcceptsMousePress() OVERRIDE; | 42   virtual bool AcceptsMousePress() OVERRIDE; | 
| 37   virtual bool OnMousePressed(NSRect frame) OVERRIDE; | 43   virtual bool OnMousePressed(NSRect frame) OVERRIDE; | 
| 38   virtual NSString* GetToolTip() OVERRIDE; | 44   virtual NSString* GetToolTip() OVERRIDE; | 
| 39 | 45 | 
| 40   // The control that owns this. Weak. | 46   // The control that owns this. Weak. | 
| 41   LocationBarViewMac* owner_; | 47   LocationBarViewMac* owner_; | 
| 42 | 48 | 
| 43   // The bubble that this decoration shows. Weak, owns self. | 49   // The bubble that this decoration shows. Weak, owns self. | 
| 44   ZoomBubbleController* bubble_; | 50   ZoomBubbleController* bubble_; | 
| 45 | 51 | 
| 46   // The string to show for a tooltip. | 52   // The string to show for a tooltip. | 
| 47   scoped_nsobject<NSString> tooltip_; | 53   scoped_nsobject<NSString> tooltip_; | 
| 48 | 54 | 
| 49   DISALLOW_COPY_AND_ASSIGN(ZoomDecoration); | 55   DISALLOW_COPY_AND_ASSIGN(ZoomDecoration); | 
| 50 }; | 56 }; | 
| 51 | 57 | 
| 52 #endif  // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_ZOOM_DECORATION_H_ | 58 #endif  // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_ZOOM_DECORATION_H_ | 
| OLD | NEW | 
|---|