| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_COCOA_RELOAD_BUTTON_H_ | 5 #ifndef CHROME_BROWSER_COCOA_RELOAD_BUTTON_H_ |
| 6 #define CHROME_BROWSER_COCOA_RELOAD_BUTTON_H_ | 6 #define CHROME_BROWSER_COCOA_RELOAD_BUTTON_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #import "base/scoped_nsobject.h" | 10 #import "base/scoped_nsobject.h" |
| 11 #import "chrome/browser/cocoa/button_with_viewid.h" |
| 11 | 12 |
| 12 // NSButton subclass which defers certain state changes when the mouse | 13 // NSButton subclass which defers certain state changes when the mouse |
| 13 // is hovering over it. | 14 // is hovering over it. |
| 14 | 15 |
| 15 @interface ReloadButton : NSButton { | 16 @interface ReloadButton : ButtonWithViewID { |
| 16 @private | 17 @private |
| 17 // Tracks whether the mouse is hovering for purposes of not making | 18 // Tracks whether the mouse is hovering for purposes of not making |
| 18 // unexpected state changes. | 19 // unexpected state changes. |
| 19 BOOL isMouseInside_; | 20 BOOL isMouseInside_; |
| 20 scoped_nsobject<NSTrackingArea> trackingArea_; | 21 scoped_nsobject<NSTrackingArea> trackingArea_; |
| 21 | 22 |
| 22 // Set when reload mode is requested, but not forced, and the mouse | 23 // Set when reload mode is requested, but not forced, and the mouse |
| 23 // is hovering. | 24 // is hovering. |
| 24 BOOL pendingReloadMode_; | 25 BOOL pendingReloadMode_; |
| 25 } | 26 } |
| 26 | 27 |
| 27 // Returns YES if the mouse is currently inside the bounds. | 28 // Returns YES if the mouse is currently inside the bounds. |
| 28 - (BOOL)isMouseInside; | 29 - (BOOL)isMouseInside; |
| 29 | 30 |
| 30 // Update the button to be a reload button or stop button depending on | 31 // Update the button to be a reload button or stop button depending on |
| 31 // |isLoading|. If |force|, always sets the indicated mode. If | 32 // |isLoading|. If |force|, always sets the indicated mode. If |
| 32 // |!force|, and the mouse is over the button, defer the transition | 33 // |!force|, and the mouse is over the button, defer the transition |
| 33 // from stop button to reload button until the mouse has left the | 34 // from stop button to reload button until the mouse has left the |
| 34 // button. This prevents an inadvertent click _just_ as the state | 35 // button. This prevents an inadvertent click _just_ as the state |
| 35 // changes. | 36 // changes. |
| 36 - (void)setIsLoading:(BOOL)isLoading force:(BOOL)force; | 37 - (void)setIsLoading:(BOOL)isLoading force:(BOOL)force; |
| 37 | 38 |
| 38 @end | 39 @end |
| 39 | 40 |
| 40 @interface ReloadButton (PrivateTestingMethods) | 41 @interface ReloadButton (PrivateTestingMethods) |
| 41 - (NSTrackingArea*)trackingArea; | 42 - (NSTrackingArea*)trackingArea; |
| 42 @end | 43 @end |
| 43 | 44 |
| 44 #endif // CHROME_BROWSER_COCOA_RELOAD_BUTTON_H_ | 45 #endif // CHROME_BROWSER_COCOA_RELOAD_BUTTON_H_ |
| OLD | NEW |