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 "base/mac_util.h" | 7 #include "base/mac_util.h" |
8 #include "base/sys_string_conversions.h" | 8 #include "base/sys_string_conversions.h" |
9 #include "chrome/browser/find_bar_controller.h" | 9 #include "chrome/browser/find_bar_controller.h" |
10 #include "chrome/browser/cocoa/browser_window_cocoa.h" | 10 #include "chrome/browser/cocoa/browser_window_cocoa.h" |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 | 335 |
336 // Reset the frame to what was saved above. | 336 // Reset the frame to what was saved above. |
337 [findBarView_ setFrame:startFrame]; | 337 [findBarView_ setFrame:startFrame]; |
338 NSDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys: | 338 NSDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys: |
339 findBarView_, NSViewAnimationTargetKey, | 339 findBarView_, NSViewAnimationTargetKey, |
340 [NSValue valueWithRect:endFrame], NSViewAnimationEndFrameKey, nil]; | 340 [NSValue valueWithRect:endFrame], NSViewAnimationEndFrameKey, nil]; |
341 | 341 |
342 currentAnimation_.reset( | 342 currentAnimation_.reset( |
343 [[NSViewAnimation alloc] | 343 [[NSViewAnimation alloc] |
344 initWithViewAnimations:[NSArray arrayWithObjects:dict, nil]]); | 344 initWithViewAnimations:[NSArray arrayWithObjects:dict, nil]]); |
345 [currentAnimation_ gtm_setDuration:duration]; | 345 [currentAnimation_ gtm_setDuration:duration |
| 346 eventMask:NSLeftMouseDownMask]; |
346 [currentAnimation_ setDelegate:self]; | 347 [currentAnimation_ setDelegate:self]; |
347 [currentAnimation_ startAnimation]; | 348 [currentAnimation_ startAnimation]; |
348 } | 349 } |
349 | 350 |
350 - (void)prepopulateText:(NSString*)text stopSearch:(BOOL)stopSearch{ | 351 - (void)prepopulateText:(NSString*)text stopSearch:(BOOL)stopSearch{ |
351 [self setFindText:text]; | 352 [self setFindText:text]; |
352 | 353 |
353 // End the find session, hide the "x of y" text and disable the | 354 // End the find session, hide the "x of y" text and disable the |
354 // buttons, but do not close the find bar or raise the window here. | 355 // buttons, but do not close the find bar or raise the window here. |
355 if (stopSearch && findBarBridge_) { | 356 if (stopSearch && findBarBridge_) { |
356 TabContents* contents = | 357 TabContents* contents = |
357 findBarBridge_->GetFindBarController()->tab_contents(); | 358 findBarBridge_->GetFindBarController()->tab_contents(); |
358 if (contents) { | 359 if (contents) { |
359 contents->StopFinding(true); | 360 contents->StopFinding(true); |
360 findBarBridge_->ClearResults(contents->find_result()); | 361 findBarBridge_->ClearResults(contents->find_result()); |
361 } | 362 } |
362 } | 363 } |
363 | 364 |
364 // Has to happen after |ClearResults()| above. | 365 // Has to happen after |ClearResults()| above. |
365 BOOL buttonsEnabled = [text length] > 0 ? YES : NO; | 366 BOOL buttonsEnabled = [text length] > 0 ? YES : NO; |
366 [previousButton_ setEnabled:buttonsEnabled]; | 367 [previousButton_ setEnabled:buttonsEnabled]; |
367 [nextButton_ setEnabled:buttonsEnabled]; | 368 [nextButton_ setEnabled:buttonsEnabled]; |
368 } | 369 } |
369 | 370 |
370 @end | 371 @end |
OLD | NEW |