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 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/mac_util.h" | 8 #include "base/mac_util.h" |
9 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
10 #include "grit/generated_resources.h" | 10 #include "grit/generated_resources.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 - (void)showFindBar { | 121 - (void)showFindBar { |
122 [[self view] setHidden:NO]; | 122 [[self view] setHidden:NO]; |
123 } | 123 } |
124 | 124 |
125 - (void)hideFindBar { | 125 - (void)hideFindBar { |
126 [[self view] setHidden:YES]; | 126 [[self view] setHidden:YES]; |
127 } | 127 } |
128 | 128 |
129 - (void)setFocusAndSelection { | 129 - (void)setFocusAndSelection { |
130 [[findText_ window] makeFirstResponder:findText_]; | 130 [[findText_ window] makeFirstResponder:findText_]; |
| 131 |
| 132 // Enable the buttons if the find text is non-empty. |
| 133 BOOL buttonsEnabled = ([[findText_ stringValue] length] > 0) ? YES : NO; |
| 134 [previousButton_ setEnabled:buttonsEnabled]; |
| 135 [nextButton_ setEnabled:buttonsEnabled]; |
| 136 |
131 } | 137 } |
132 | 138 |
133 - (void)setFindText:(const string16&)findText { | 139 - (void)setFindText:(const string16&)findText { |
134 [findText_ setStringValue:base::SysUTF16ToNSString(findText)]; | 140 [findText_ setStringValue:base::SysUTF16ToNSString(findText)]; |
135 } | 141 } |
136 | 142 |
137 - (void)clearResults:(const FindNotificationDetails&)results { | 143 - (void)clearResults:(const FindNotificationDetails&)results { |
138 // Just call updateUIForFindResult, which will take care of clearing | 144 // Just call updateUIForFindResult, which will take care of clearing |
139 // the search text and the results label. | 145 // the search text and the results label. |
140 [self updateUIForFindResult:results withText:string16()]; | 146 [self updateUIForFindResult:results withText:string16()]; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 188 |
183 // TODO(rohitrao): If the search string is too long, then it will overlap with | 189 // TODO(rohitrao): If the search string is too long, then it will overlap with |
184 // the results label. Fix. | 190 // the results label. Fix. |
185 } | 191 } |
186 | 192 |
187 - (BOOL)isFindBarVisible { | 193 - (BOOL)isFindBarVisible { |
188 return [[self view] isHidden] ? NO : YES; | 194 return [[self view] isHidden] ? NO : YES; |
189 } | 195 } |
190 | 196 |
191 @end | 197 @end |
OLD | NEW |