blob: dec7b6b6a4ab237c4c7e1c2b3d6460dc3e8ccd6e [file] [log] [blame]
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import "ios/web/public/find_in_page/find_in_page_manager_delegate_bridge.h"
#import "ios/web/public/find_in_page/find_in_page_manager.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace web {
FindInPageManagerDelegateBridge::FindInPageManagerDelegateBridge(
id<CRWFindInPageManagerDelegate> delegate)
: delegate_(delegate) {}
FindInPageManagerDelegateBridge::~FindInPageManagerDelegateBridge() {}
void FindInPageManagerDelegateBridge::DidHighlightMatches(WebState* web_state,
int match_count,
NSString* query) {
if ([delegate_ respondsToSelector:@selector
(findInPageManager:
didHighlightMatchesOfQuery:withMatchCount:forWebState:)]) {
[delegate_ findInPageManager:web::FindInPageManager::FromWebState(web_state)
didHighlightMatchesOfQuery:query
withMatchCount:match_count
forWebState:web_state];
}
}
void FindInPageManagerDelegateBridge::DidSelectMatch(WebState* web_state,
int index) {
if ([delegate_ respondsToSelector:@selector
(findInPageManager:didSelectMatchAtIndex:forWebState:)]) {
[delegate_ findInPageManager:web::FindInPageManager::FromWebState(web_state)
didSelectMatchAtIndex:index
forWebState:web_state];
}
}
}