| 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_BUTTON_DECORATION_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_LOCATION_BAR_BUTTON_DECORATION_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_LOCATION_BAR_BUTTON_DECORATION_H_ | 6 #define CHROME_BROWSER_UI_COCOA_LOCATION_BAR_BUTTON_DECORATION_H_ |
| 7 | 7 |
| 8 #import "base/memory/scoped_nsobject.h" | 8 #import "base/memory/scoped_nsobject.h" |
| 9 #include "chrome/browser/ui/cocoa/location_bar/location_bar_decoration.h" | 9 #include "chrome/browser/ui/cocoa/location_bar/location_bar_decoration.h" |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 void SetButtonState(ButtonState state); | 24 void SetButtonState(ButtonState state); |
| 25 ButtonState GetButtonState() const; | 25 ButtonState GetButtonState() const; |
| 26 | 26 |
| 27 // To be called when a mouse click occurs within the decoration, which will | 27 // To be called when a mouse click occurs within the decoration, which will |
| 28 // set and reset the button's state as necessary before calling into | 28 // set and reset the button's state as necessary before calling into |
| 29 // |OnMousePressed| below. | 29 // |OnMousePressed| below. |
| 30 bool OnMousePressedWithView(NSRect frame, NSView* control_view); | 30 bool OnMousePressedWithView(NSRect frame, NSView* control_view); |
| 31 | 31 |
| 32 // Implement |LocationBarDecoration|. | 32 // Implement |LocationBarDecoration|. |
| 33 virtual CGFloat GetWidthForSpace(CGFloat width) OVERRIDE; | 33 virtual CGFloat GetWidthForSpace(CGFloat width, CGFloat text_width) OVERRIDE; |
| 34 virtual void DrawInFrame(NSRect frame, NSView* control_view) OVERRIDE; | 34 virtual void DrawInFrame(NSRect frame, NSView* control_view) OVERRIDE; |
| 35 virtual bool OnMousePressed(NSRect frame) OVERRIDE; | 35 virtual bool OnMousePressed(NSRect frame) OVERRIDE; |
| 36 virtual ButtonDecoration* AsButtonDecoration() OVERRIDE; | 36 virtual ButtonDecoration* AsButtonDecoration() OVERRIDE; |
| 37 | 37 |
| 38 protected: | 38 protected: |
| 39 // Setters for the images for different states. | 39 // Setters for the images for different states. |
| 40 void SetNormalImage(NSImage* normal_image); | 40 void SetNormalImage(NSImage* normal_image); |
| 41 void SetHoverImage(NSImage* hover_image); | 41 void SetHoverImage(NSImage* hover_image); |
| 42 void SetPressedImage(NSImage* pressed_image); | 42 void SetPressedImage(NSImage* pressed_image); |
| 43 | 43 |
| 44 private: | 44 private: |
| 45 scoped_nsobject<NSImage> normal_image_; | 45 scoped_nsobject<NSImage> normal_image_; |
| 46 scoped_nsobject<NSImage> hover_image_; | 46 scoped_nsobject<NSImage> hover_image_; |
| 47 scoped_nsobject<NSImage> pressed_image_; | 47 scoped_nsobject<NSImage> pressed_image_; |
| 48 ButtonState state_; | 48 ButtonState state_; |
| 49 | 49 |
| 50 NSImage* GetImage(); | 50 NSImage* GetImage(); |
| 51 | 51 |
| 52 DISALLOW_COPY_AND_ASSIGN(ButtonDecoration); | 52 DISALLOW_COPY_AND_ASSIGN(ButtonDecoration); |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_BUTTON_DECORATION_H_ | 55 #endif // CHROME_BROWSER_UI_COCOA_LOCATION_BAR_BUTTON_DECORATION_H_ |
| OLD | NEW |