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

Side by Side Diff: chrome/browser/resources/pdf/navigator.js

Issue 918953002: Fix for PDFs with lots of named destinations take a long time to load. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes as per review comments. Created 5 years, 10 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 | « no previous file | chrome/browser/resources/pdf/open_pdf_params_parser.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 Navigator for navigating to links inside or outside the PDF. 8 * Creates a new Navigator for navigating to links inside or outside the PDF.
9 * @param {string} originalUrl The original page URL. 9 * @param {string} originalUrl The original page URL.
10 * @param {Object} viewport The viewport info of the page. 10 * @param {Object} viewport The viewport info of the page.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 url == 'https://' || 67 url == 'https://' ||
68 url == 'ftp://' || 68 url == 'ftp://' ||
69 url == 'file://' || 69 url == 'file://' ||
70 url == 'mailto:') { 70 url == 'mailto:') {
71 return; 71 return;
72 } 72 }
73 73
74 if (newTab) { 74 if (newTab) {
75 this.navigateInNewTabCallback_(url); 75 this.navigateInNewTabCallback_(url);
76 } else { 76 } else {
77 var pageNumber = 77 this.paramsParser_.getViewportFromUrlParams(
78 this.paramsParser_.getViewportFromUrlParams(url).page; 78 url, this.onViewportReceived_.bind(this));
79 if (pageNumber != undefined)
80 this.viewport_.goToPage(pageNumber);
81 else
82 this.navigateInCurrentTabCallback_(url);
83 } 79 }
80 },
81
82 /**
83 * @private
84 * Called when the viewport position is received.
85 * @param {Object} viewportPosition Dictionary containing the viewport
86 * position.
87 */
88 onViewportReceived_: function(viewportPosition) {
89 var pageNumber = viewportPosition.page;
90 if (pageNumber != undefined)
91 this.viewport_.goToPage(pageNumber);
92 else
93 this.navigateInCurrentTabCallback_(viewportPosition['url']);
84 } 94 }
85 }; 95 };
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/pdf/open_pdf_params_parser.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698