| OLD | NEW |
| 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 Loading... |
| 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 'email': |
| 261 var href = 'mailto:' + message.data.to + '?cc=' + message.data.cc + |
| 262 '&bcc=' + message.data.bcc + '&subject=' + message.data.subject + |
| 263 '&body=' + message.data.body; |
| 264 var w = window.open(href, '_blank', 'width=1,height=1'); |
| 265 if (w) |
| 266 w.close(); |
| 267 break; |
| 260 case 'getAccessibilityJSONReply': | 268 case 'getAccessibilityJSONReply': |
| 261 this.sendScriptingMessage_(message.data); | 269 this.sendScriptingMessage_(message.data); |
| 262 break; | 270 break; |
| 263 case 'getPassword': | 271 case 'getPassword': |
| 264 // If the password screen isn't up, put it up. Otherwise we're | 272 // If the password screen isn't up, put it up. Otherwise we're |
| 265 // responding to an incorrect password so deny it. | 273 // responding to an incorrect password so deny it. |
| 266 if (!this.passwordScreen_.active) | 274 if (!this.passwordScreen_.active) |
| 267 this.passwordScreen_.active = true; | 275 this.passwordScreen_.active = true; |
| 268 else | 276 else |
| 269 this.passwordScreen_.deny(); | 277 this.passwordScreen_.deny(); |
| 270 break; | 278 break; |
| 271 case 'goToPage': | 279 case 'goToPage': |
| 272 this.viewport_.goToPage(message.data.page); | 280 this.viewport_.goToPage(message.data.page); |
| 273 break; | 281 break; |
| 274 case 'loadProgress': | 282 case 'loadProgress': |
| 275 this.updateProgress_(message.data.progress); | 283 this.updateProgress_(message.data.progress); |
| 276 break; | 284 break; |
| 285 case 'navigate': |
| 286 if (message.data.newTab) |
| 287 window.open(message.data.url); |
| 288 else |
| 289 window.location.href = message.data.url; |
| 290 break; |
| 277 case 'setScrollPosition': | 291 case 'setScrollPosition': |
| 278 var position = this.viewport_.position; | 292 var position = this.viewport_.position; |
| 279 if (message.data.x != undefined) | 293 if (message.data.x != undefined) |
| 280 position.x = message.data.x; | 294 position.x = message.data.x; |
| 281 if (message.data.y != undefined) | 295 if (message.data.y != undefined) |
| 282 position.y = message.data.y; | 296 position.y = message.data.y; |
| 283 this.viewport_.position = position; | 297 this.viewport_.position = position; |
| 284 break; | 298 break; |
| 285 case 'setTranslatedStrings': | 299 case 'setTranslatedStrings': |
| 286 this.passwordScreen_.text = message.data.getPasswordString; | 300 this.passwordScreen_.text = message.data.getPasswordString; |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 | 421 |
| 408 /** | 422 /** |
| 409 * @type {Viewport} the viewport of the PDF viewer. | 423 * @type {Viewport} the viewport of the PDF viewer. |
| 410 */ | 424 */ |
| 411 get viewport() { | 425 get viewport() { |
| 412 return this.viewport_; | 426 return this.viewport_; |
| 413 } | 427 } |
| 414 }; | 428 }; |
| 415 | 429 |
| 416 var viewer = new PDFViewer(); | 430 var viewer = new PDFViewer(); |
| OLD | NEW |