OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/mac/mac_util.h" | 7 #include "base/mac/mac_util.h" |
8 #include "base/sys_string_conversions.h" | 8 #include "base/sys_string_conversions.h" |
9 #include "chrome/browser/ui/cocoa/browser_window_controller.h" | 9 #include "chrome/browser/ui/cocoa/browser_window_controller.h" |
10 #import "chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.h" | 10 #import "chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.h" |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 // Save the currently-focused view. |findBarView_| is in the view | 246 // Save the currently-focused view. |findBarView_| is in the view |
247 // hierarchy by now. showFindBar can be called even when the | 247 // hierarchy by now. showFindBar can be called even when the |
248 // findbar is already open, so do not overwrite an already saved | 248 // findbar is already open, so do not overwrite an already saved |
249 // view. | 249 // view. |
250 if (!focusTracker_.get()) | 250 if (!focusTracker_.get()) |
251 focusTracker_.reset( | 251 focusTracker_.reset( |
252 [[FocusTracker alloc] initWithWindow:[findBarView_ window]]); | 252 [[FocusTracker alloc] initWithWindow:[findBarView_ window]]); |
253 | 253 |
254 // The browser window might have changed while the FindBar was hidden. | 254 // The browser window might have changed while the FindBar was hidden. |
255 // Update its position now. | 255 // Update its position now. |
256 [browserWindowController_ layoutSubviews]; | 256 if (browserWindowController_) |
| 257 [browserWindowController_ layoutSubviews]; |
257 | 258 |
258 // Move to the correct horizontal position first, to prevent the FindBar | 259 // Move to the correct horizontal position first, to prevent the FindBar |
259 // from jumping around when switching tabs. | 260 // from jumping around when switching tabs. |
260 // Prevent jumping while the FindBar is animating (hiding, then showing) too. | 261 // Prevent jumping while the FindBar is animating (hiding, then showing) too. |
261 if (![self isFindBarVisible]) | 262 if (![self isFindBarVisible]) |
262 [self moveFindBarIfNecessary:NO]; | 263 [self moveFindBarIfNecessary:NO]; |
263 | 264 |
264 // Animate the view into place. | 265 // Animate the view into place. |
265 NSRect frame = [findBarView_ frame]; | 266 NSRect frame = [findBarView_ frame]; |
266 frame.origin = NSMakePoint(0, 0); | 267 frame.origin = NSMakePoint(0, 0); |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 } | 530 } |
530 } | 531 } |
531 | 532 |
532 // Has to happen after |ClearResults()| above. | 533 // Has to happen after |ClearResults()| above. |
533 BOOL buttonsEnabled = [text length] > 0 ? YES : NO; | 534 BOOL buttonsEnabled = [text length] > 0 ? YES : NO; |
534 [previousButton_ setEnabled:buttonsEnabled]; | 535 [previousButton_ setEnabled:buttonsEnabled]; |
535 [nextButton_ setEnabled:buttonsEnabled]; | 536 [nextButton_ setEnabled:buttonsEnabled]; |
536 } | 537 } |
537 | 538 |
538 @end | 539 @end |
OLD | NEW |