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

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

Issue 265283005: Add accessibility function to PDFScriptingAPI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/resources/pdf/pdf_scripting_api.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <include src="../../../../ui/webui/resources/js/util.js"> 7 <include src="../../../../ui/webui/resources/js/util.js">
8 <include src="pdf_scripting_api.js"> 8 <include src="pdf_scripting_api.js">
9 <include src="viewport.js"> 9 <include src="viewport.js">
10 10
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 this.viewport_.setDocumentDimensions(this.documentDimensions_); 250 this.viewport_.setDocumentDimensions(this.documentDimensions_);
251 this.toolbar_.style.visibility = 'visible'; 251 this.toolbar_.style.visibility = 'visible';
252 // If we received the document dimensions, the password was good so we 252 // If we received the document dimensions, the password was good so we
253 // can dismiss the password screen. 253 // can dismiss the password screen.
254 if (this.passwordScreen_.active) 254 if (this.passwordScreen_.active)
255 this.passwordScreen_.accept(); 255 this.passwordScreen_.accept();
256 256
257 this.pageIndicator_.initialFadeIn(); 257 this.pageIndicator_.initialFadeIn();
258 this.toolbar_.initialFadeIn(); 258 this.toolbar_.initialFadeIn();
259 break; 259 break;
260 case 'getAccessibilityJSONReply':
261 this.sendScriptingMessage_(message.data);
262 break;
263 case 'getPassword':
264 // If the password screen isn't up, put it up. Otherwise we're
265 // responding to an incorrect password so deny it.
266 if (!this.passwordScreen_.active)
267 this.passwordScreen_.active = true;
268 else
269 this.passwordScreen_.deny();
270 break;
271 case 'goToPage':
272 this.viewport_.goToPage(message.data.page);
273 break;
260 case 'loadProgress': 274 case 'loadProgress':
261 this.updateProgress_(message.data.progress); 275 this.updateProgress_(message.data.progress);
262 break; 276 break;
263 case 'goToPage':
264 this.viewport_.goToPage(message.data.page);
265 break;
266 case 'setScrollPosition': 277 case 'setScrollPosition':
267 var position = this.viewport_.position; 278 var position = this.viewport_.position;
268 if (message.data.x != undefined) 279 if (message.data.x != undefined)
269 position.x = message.data.x; 280 position.x = message.data.x;
270 if (message.data.y != undefined) 281 if (message.data.y != undefined)
271 position.y = message.data.y; 282 position.y = message.data.y;
272 this.viewport_.position = position; 283 this.viewport_.position = position;
273 break; 284 break;
274 case 'getPassword':
275 // If the password screen isn't up, put it up. Otherwise we're
276 // responding to an incorrect password so deny it.
277 if (!this.passwordScreen_.active)
278 this.passwordScreen_.active = true;
279 else
280 this.passwordScreen_.deny();
281 break;
282 case 'setTranslatedStrings': 285 case 'setTranslatedStrings':
283 this.passwordScreen_.text = message.data.getPasswordString; 286 this.passwordScreen_.text = message.data.getPasswordString;
284 this.progressBar_.text = message.data.loadingString; 287 this.progressBar_.text = message.data.loadingString;
285 this.errorScreen_.text = message.data.loadFailedString; 288 this.errorScreen_.text = message.data.loadFailedString;
286 break; 289 break;
287 } 290 }
288 }, 291 },
289 292
290 /** 293 /**
291 * @private 294 * @private
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 type: 'resetPrintPreviewMode', 381 type: 'resetPrintPreviewMode',
379 url: message.data.url, 382 url: message.data.url,
380 grayscale: message.data.grayscale, 383 grayscale: message.data.grayscale,
381 // If the PDF isn't modifiable we send 0 as the page count so that no 384 // If the PDF isn't modifiable we send 0 as the page count so that no
382 // blank placeholder pages get appended to the PDF. 385 // blank placeholder pages get appended to the PDF.
383 pageCount: (message.data.modifiable ? 386 pageCount: (message.data.modifiable ?
384 message.data.pageNumbers.length : 0) 387 message.data.pageNumbers.length : 0)
385 }); 388 });
386 break; 389 break;
387 case 'loadPreviewPage': 390 case 'loadPreviewPage':
391 case 'getAccessibilityJSON':
388 this.plugin_.postMessage(message.data); 392 this.plugin_.postMessage(message.data);
389 break; 393 break;
390 } 394 }
391 395
392 }, 396 },
393 397
394 /** 398 /**
395 * @private 399 * @private
396 * Send a scripting message outside the extension (typically to 400 * Send a scripting message outside the extension (typically to
397 * PDFScriptingAPI in a page containing the extension). 401 * PDFScriptingAPI in a page containing the extension).
398 * @param {Object} message the message to send. 402 * @param {Object} message the message to send.
399 */ 403 */
400 sendScriptingMessage_: function(message) { 404 sendScriptingMessage_: function(message) {
401 window.parent.postMessage(message, '*'); 405 window.parent.postMessage(message, '*');
402 }, 406 },
403 407
404 /** 408 /**
405 * @type {Viewport} the viewport of the PDF viewer. 409 * @type {Viewport} the viewport of the PDF viewer.
406 */ 410 */
407 get viewport() { 411 get viewport() {
408 return this.viewport_; 412 return this.viewport_;
409 } 413 }
410 }; 414 };
411 415
412 var viewer = new PDFViewer(); 416 var viewer = new PDFViewer();
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/pdf/pdf_scripting_api.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698