diff options
author | rohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-10 16:36:28 +0000 |
---|---|---|
committer | rohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-10 16:36:28 +0000 |
commit | 479d5bc48969f6de924471de27638409db848229 (patch) | |
tree | 0bff4fee34a82ad69f27f594199761d7c89dbd34 /chrome/browser/cocoa | |
parent | ef73807894f85700900b64917a4809bfec0002d7 (diff) | |
download | chromium_src-479d5bc48969f6de924471de27638409db848229.zip chromium_src-479d5bc48969f6de924471de27638409db848229.tar.gz chromium_src-479d5bc48969f6de924471de27638409db848229.tar.bz2 |
Enables find in page match counts on Mac.
BUG=http://crbug.com/16148
TEST=Find in page should report match counts correctly.
Review URL: http://codereview.chromium.org/155353
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20377 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa')
-rw-r--r-- | chrome/browser/cocoa/find_bar_cocoa_controller.mm | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/chrome/browser/cocoa/find_bar_cocoa_controller.mm b/chrome/browser/cocoa/find_bar_cocoa_controller.mm index e9d38c9..d343577 100644 --- a/chrome/browser/cocoa/find_bar_cocoa_controller.mm +++ b/chrome/browser/cocoa/find_bar_cocoa_controller.mm @@ -114,7 +114,9 @@ } - (void)clearResults:(const FindNotificationDetails&)results { - [findText_ setStringValue:@""]; + // Just call updateUIForFindResult, which will take care of clearing + // the search text and the results label. + [self updateUIForFindResult:results withText:string16()]; } - (void)updateUIForFindResult:(const FindNotificationDetails&)result @@ -134,17 +136,14 @@ [nextButton_ setEnabled:buttonsEnabled]; // Update the results label. - // TODO(rohitrao): The part of the webkit glue that computes match - // ordinals is wrapped in OS_WIN. Figure out why and remove it, - // otherwise match counts won't work on Mac and Linux. + BOOL validRange = result.active_match_ordinal() != -1 && + result.number_of_matches() != -1; NSString* searchString = [findText_ stringValue]; - if ([searchString length] > 0) { - if (result.active_match_ordinal() >= 0 && result.number_of_matches() >= 0) { - [resultsLabel_ setStringValue:base::SysWideToNSString( - l10n_util::GetStringF(IDS_FIND_IN_PAGE_COUNT, - IntToWString(result.active_match_ordinal()), - IntToWString(result.number_of_matches())))]; - } + if ([searchString length] > 0 && validRange) { + [resultsLabel_ setStringValue:base::SysWideToNSString( + l10n_util::GetStringF(IDS_FIND_IN_PAGE_COUNT, + IntToWString(result.active_match_ordinal()), + IntToWString(result.number_of_matches())))]; } else { // If there was no text entered, we don't show anything in the result count // area. |