Chromium Code Reviews| 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 ToolbarModel; | 13 class LocationBarViewMac; |
| 14 @class ZoomBubbleController; | |
| 14 class ZoomController; | 15 class ZoomController; |
| 15 | 16 |
| 16 // Zoom icon at the end of the omnibox (close to page actions) when at a | 17 // Zoom icon at the end of the omnibox (close to page actions) when at a |
| 17 // non-standard zoom level. | 18 // non-standard zoom level. |
| 18 // TODO(dbeam): add mouse event handlers to show a zoom bubble on click. | |
| 19 class ZoomDecoration : public ImageDecoration { | 19 class ZoomDecoration : public ImageDecoration { |
| 20 public: | 20 public: |
| 21 explicit ZoomDecoration(ToolbarModel* toolbar_model); | 21 explicit ZoomDecoration(LocationBarViewMac* owner); |
| 22 virtual ~ZoomDecoration(); | 22 virtual ~ZoomDecoration(); |
| 23 | 23 |
| 24 // Called when this decoration should show or hide itself in its most current | 24 // Called when this decoration should show or hide itself in its most current |
| 25 // state. | 25 // state. |
| 26 void Update(ZoomController* zoom_controller); | 26 void Update(ZoomController* zoom_controller); |
| 27 | 27 |
| 28 private: | 28 private: |
| 29 NSPoint GetBubblePointInFrame(NSRect frame); | |
| 30 | |
| 29 // LocationBarDecoration implementation. | 31 // LocationBarDecoration implementation. |
| 30 virtual bool AcceptsMousePress() OVERRIDE; | 32 virtual bool AcceptsMousePress() OVERRIDE; |
| 33 virtual bool OnMousePressed(NSRect frame) OVERRIDE; | |
| 31 virtual NSString* GetToolTip() OVERRIDE; | 34 virtual NSString* GetToolTip() OVERRIDE; |
| 32 | 35 |
| 33 // A reference to the toolbar model to query whether input is currently | 36 // The control that owns this. Weak. |
| 34 // happening in the location bar. Not owned by this class. | 37 LocationBarViewMac* owner_; |
| 35 ToolbarModel* toolbar_model_; | 38 |
| 39 // The bubble that this decoration shows. Weak, owns self. | |
|
sail
2013/02/15 21:05:12
In a different review thakis recommended using a s
Robert Sesek
2013/02/15 21:39:20
I wrote it like that earlier but the closeObserver
sail
2013/02/15 21:58:20
It should still be easy to test. In closeObserver
| |
| 40 ZoomBubbleController* bubble_; | |
| 36 | 41 |
| 37 // The string to show for a tooltip. | 42 // The string to show for a tooltip. |
| 38 scoped_nsobject<NSString> tooltip_; | 43 scoped_nsobject<NSString> tooltip_; |
| 39 | 44 |
| 40 DISALLOW_COPY_AND_ASSIGN(ZoomDecoration); | 45 DISALLOW_COPY_AND_ASSIGN(ZoomDecoration); |
| 41 }; | 46 }; |
| 42 | 47 |
| 43 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_ZOOM_DECORATION_H_ | 48 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_ZOOM_DECORATION_H_ |
| OLD | NEW |