| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 | 6 |
| 7 #import "chrome/browser/cocoa/find_bar_cocoa_controller.h" | 7 #import "chrome/browser/cocoa/find_bar_cocoa_controller.h" |
| 8 | 8 |
| 9 #include "base/scoped_nsobject.h" | 9 #include "base/scoped_nsobject.h" |
| 10 #include "base/string16.h" | 10 #include "base/string16.h" |
| 11 | 11 |
| 12 class BrowserWindowCocoa; | 12 class BrowserWindowCocoa; |
| 13 class FindBarBridge; | 13 class FindBarBridge; |
| 14 class FindNotificationDetails; | 14 class FindNotificationDetails; |
| 15 @class FocusTracker; | 15 @class FocusTracker; |
| 16 | 16 |
| 17 // A controller for the find bar in the browser window. Manages | 17 // A controller for the find bar in the browser window. Manages |
| 18 // updating the state of the find bar and provides a target for the | 18 // updating the state of the find bar and provides a target for the |
| 19 // next/previous/close buttons. Certain operations require a pointer | 19 // next/previous/close buttons. Certain operations require a pointer |
| 20 // to the cross-platform FindBarController, so be sure to call | 20 // to the cross-platform FindBarController, so be sure to call |
| 21 // setFindBarBridge: after creating this controller. | 21 // setFindBarBridge: after creating this controller. |
| 22 | 22 |
| 23 @interface FindBarCocoaController : NSViewController { | 23 @interface FindBarCocoaController : NSViewController { |
| 24 @private | 24 @private |
| 25 IBOutlet NSView* findBarView_; |
| 25 IBOutlet NSTextField* findText_; | 26 IBOutlet NSTextField* findText_; |
| 26 IBOutlet NSTextField* resultsLabel_; | 27 IBOutlet NSTextField* resultsLabel_; |
| 27 IBOutlet NSButton* nextButton_; | 28 IBOutlet NSButton* nextButton_; |
| 28 IBOutlet NSButton* previousButton_; | 29 IBOutlet NSButton* previousButton_; |
| 29 | 30 |
| 30 // Needed to call methods on FindBarController. | 31 // Needed to call methods on FindBarController. |
| 31 FindBarBridge* findBarBridge_; // weak | 32 FindBarBridge* findBarBridge_; // weak |
| 32 | 33 |
| 33 scoped_nsobject<FocusTracker> focusTracker_; | 34 scoped_nsobject<FocusTracker> focusTracker_; |
| 35 |
| 36 // The currently-running animation. This is defined to be non-nil if an |
| 37 // animation is running, and is always nil otherwise. The |
| 38 // FindBarCocoaController should not be deallocated while an animation is |
| 39 // running (stopAnimation is currently called before the last tab in a |
| 40 // window is removed). |
| 41 scoped_nsobject<NSViewAnimation> currentAnimation_; |
| 34 }; | 42 }; |
| 35 | 43 |
| 36 // Initializes a new FindBarCocoaController. | 44 // Initializes a new FindBarCocoaController. |
| 37 - (id)init; | 45 - (id)init; |
| 38 | 46 |
| 39 - (void)setFindBarBridge:(FindBarBridge*)findBar; | 47 - (void)setFindBarBridge:(FindBarBridge*)findBar; |
| 40 | 48 |
| 41 - (IBAction)close:(id)sender; | 49 - (IBAction)close:(id)sender; |
| 42 | 50 |
| 43 - (IBAction)nextResult:(id)sender; | 51 - (IBAction)nextResult:(id)sender; |
| 44 | 52 |
| 45 - (IBAction)previousResult:(id)sender; | 53 - (IBAction)previousResult:(id)sender; |
| 46 | 54 |
| 47 // Positions the find bar based on the location of the infobar container. | 55 // Positions the find bar based on the location of the infobar container. |
| 48 // TODO(rohitrao): Move this logic into BrowserWindowController. | 56 // TODO(rohitrao): Move this logic into BrowserWindowController. |
| 49 - (void)positionFindBarView:(NSView*)infoBarContainerView; | 57 - (void)positionFindBarView:(NSView*)infoBarContainerView; |
| 50 | 58 |
| 51 // Methods called from FindBarBridge. | 59 // Methods called from FindBarBridge. |
| 52 - (void)showFindBar; | 60 - (void)showFindBar:(BOOL)animate; |
| 53 - (void)hideFindBar; | 61 - (void)hideFindBar:(BOOL)animate; |
| 62 - (void)stopAnimation; |
| 54 - (void)setFocusAndSelection; | 63 - (void)setFocusAndSelection; |
| 55 - (void)restoreSavedFocus; | 64 - (void)restoreSavedFocus; |
| 56 - (void)setFindText:(const string16&)findText; | 65 - (void)setFindText:(const string16&)findText; |
| 57 | 66 |
| 58 - (void)clearResults:(const FindNotificationDetails&)results; | 67 - (void)clearResults:(const FindNotificationDetails&)results; |
| 59 - (void)updateUIForFindResult:(const FindNotificationDetails&)results | 68 - (void)updateUIForFindResult:(const FindNotificationDetails&)results |
| 60 withText:(const string16&)findText; | 69 withText:(const string16&)findText; |
| 61 - (BOOL)isFindBarVisible; | 70 - (BOOL)isFindBarVisible; |
| 62 | 71 |
| 63 @end | 72 @end |
| OLD | NEW |