Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.mm

Issue 2928333002: Mac:Dont always enable findbar buttons when restoring focus with search string (Closed)
Patch Set: Add unit tests for find in bar button enablement on Mac. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/cocoa/find_bar/find_bar_browsertest.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/mac/bundle_locations.h" 8 #include "base/mac/bundle_locations.h"
9 #include "base/strings/sys_string_conversions.h" 9 #include "base/strings/sys_string_conversions.h"
10 #include "chrome/app/vector_icons/vector_icons.h" 10 #include "chrome/app/vector_icons/vector_icons.h"
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 showHideAnimation_.reset(nil); 355 showHideAnimation_.reset(nil);
356 } 356 }
357 if (moveAnimation_.get()) { 357 if (moveAnimation_.get()) {
358 [moveAnimation_ stopAnimation]; 358 [moveAnimation_ stopAnimation];
359 moveAnimation_.reset(nil); 359 moveAnimation_.reset(nil);
360 } 360 }
361 } 361 }
362 362
363 - (void)setFocusAndSelection { 363 - (void)setFocusAndSelection {
364 [[findText_ window] makeFirstResponder:findText_]; 364 [[findText_ window] makeFirstResponder:findText_];
365
366 // Enable the buttons if the find text is non-empty.
rohitrao (ping after 24h) 2017/06/26 13:20:15 Here's a case that appears to have regressed with
367 BOOL buttonsEnabled = ([[findText_ stringValue] length] > 0) ? YES : NO;
rohitrao (ping after 24h) 2017/06/26 13:20:15 So it seems that this function is called from at l
carloschilazo 2017/06/28 22:50:22 Thanks for looking into it Rohit! I agree, we need
368 [previousButton_ setEnabled:buttonsEnabled];
369 [nextButton_ setEnabled:buttonsEnabled];
370 } 365 }
371 366
372 - (void)restoreSavedFocus { 367 - (void)restoreSavedFocus {
373 if (!(focusTracker_.get() && 368 if (!(focusTracker_.get() &&
374 [focusTracker_ restoreFocusInWindow:[findBarView_ window]])) { 369 [focusTracker_ restoreFocusInWindow:[findBarView_ window]])) {
375 // Fall back to giving focus to the tab contents. 370 // Fall back to giving focus to the tab contents.
376 findBarBridge_->GetFindBarController()->web_contents()->Focus(); 371 findBarBridge_->GetFindBarController()->web_contents()->Focus();
377 } 372 }
378 focusTracker_.reset(nil); 373 focusTracker_.reset(nil);
379 } 374 }
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 } 657 }
663 658
664 - (BrowserWindowController*)browserWindowController { 659 - (BrowserWindowController*)browserWindowController {
665 if (!browser_) 660 if (!browser_)
666 return nil; 661 return nil;
667 return [BrowserWindowController 662 return [BrowserWindowController
668 browserWindowControllerForWindow:browser_->window()->GetNativeWindow()]; 663 browserWindowControllerForWindow:browser_->window()->GetNativeWindow()];
669 } 664 }
670 665
671 @end 666 @end
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/find_bar/find_bar_browsertest.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698