Refactors FindController dependencies.

This commit is contained in:
Yury Delendik 2016-04-13 14:39:29 -05:00
parent 3d49879211
commit 81fc46e666
5 changed files with 60 additions and 43 deletions

View file

@ -204,9 +204,24 @@ var PDFViewerApplication = {
pdfLinkService.setHistory(this.pdfHistory);
this.findController = new PDFFindController({
pdfViewer: this.pdfViewer,
integratedFind: this.supportsIntegratedFind
pdfViewer: this.pdfViewer
});
this.findController.onUpdateResultsCount = function (matchCount) {
if (this.supportsIntegratedFind) {
return;
}
this.findBar.updateResultsCount(matchCount);
}.bind(this);
this.findController.onUpdateState = function (state, previous, matchCount) {
if (this.supportsIntegratedFind) {
FirefoxCom.request('updateFindControlState',
{result: state, findPrevious: previous});
} else {
this.findBar.updateUIState(state, previous, matchCount);
}
}.bind(this);
this.findController.listenWindowEvents();
this.pdfViewer.setFindController(this.findController);
// FIXME better PDFFindBar constructor parameters
@ -214,8 +229,6 @@ var PDFViewerApplication = {
findBarConfig.findController = this.findController;
this.findBar = new PDFFindBar(findBarConfig);
this.findController.setFindBar(this.findBar);
this.overlayManager = OverlayManager;
this.handTool = new HandTool({