OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 'use strict'; | 5 'use strict'; |
6 | 6 |
7 /** | 7 /** |
8 * Creates a new OpenPDFParamsParser. This parses the open pdf parameters | 8 * Creates a new OpenPDFParamsParser. This parses the open pdf parameters |
9 * passed in the url to set initial viewport settings for opening the pdf. | 9 * passed in the url to set initial viewport settings for opening the pdf. |
10 * @param {string} url to be parsed. | |
11 */ | 10 */ |
12 function OpenPDFParamsParser(url) { | 11 function OpenPDFParamsParser() { |
13 // A dictionary of all the named destinations in the PDF. | 12 // A dictionary of all the named destinations in the PDF. |
14 this.namedDestinations = {}; | 13 this.namedDestinations = {}; |
15 } | 14 } |
16 | 15 |
17 OpenPDFParamsParser.prototype = { | 16 OpenPDFParamsParser.prototype = { |
18 /** | 17 /** |
19 * @private | 18 * @private |
20 * Parse zoom parameter of open PDF parameters. If this | 19 * Parse zoom parameter of open PDF parameters. If this |
21 * parameter is passed while opening PDF then PDF should be opened | 20 * parameter is passed while opening PDF then PDF should be opened |
22 * at the specified zoom level. | 21 * at the specified zoom level. |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 if (!isNaN(pageNumber) && pageNumber > 0) | 90 if (!isNaN(pageNumber) && pageNumber > 0) |
92 viewportPosition['page'] = pageNumber - 1; | 91 viewportPosition['page'] = pageNumber - 1; |
93 } | 92 } |
94 | 93 |
95 if ('zoom' in paramsDictionary) | 94 if ('zoom' in paramsDictionary) |
96 this.parseZoomParam_(paramsDictionary['zoom'], viewportPosition); | 95 this.parseZoomParam_(paramsDictionary['zoom'], viewportPosition); |
97 | 96 |
98 return viewportPosition; | 97 return viewportPosition; |
99 } | 98 } |
100 }; | 99 }; |
OLD | NEW |