Commit c7ada1b8 authored by Lei Zhang's avatar Lei Zhang Committed by Commit Bot

Handle mailto links consistently in the PDF Viewer.

Bug: 1134338
Change-Id: I17c4512511911db84d4485fff143cd0d570d57e7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2454797Reviewed-by: default avatarRebekah Potter <rbpotter@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#814896}
parent 2fbc99bd
......@@ -31,18 +31,6 @@ let SaveAttachmentDataMessageData;
*/
let SaveDataMessageData;
/**
* @typedef {{
* type: string,
* to: string,
* cc: string,
* bcc: string,
* subject: string,
* body: string,
* }}
*/
let EmailMessageData;
/**
* @typedef {{
* type: string,
......@@ -449,13 +437,6 @@ export class PluginController extends ContentController {
}
switch (messageData.type) {
case 'email':
const emailData = /** @type {!EmailMessageData} */ (messageData);
const href = 'mailto:' + emailData.to + '?cc=' + emailData.cc +
'&bcc=' + emailData.bcc + '&subject=' + emailData.subject +
'&body=' + emailData.body;
window.location.href = href;
break;
case 'goToPage':
this.viewport_.goToPage(
/** @type {{type: string, page: number}} */ (messageData).page);
......
......@@ -40,6 +40,18 @@ import {DestinationMessageData, DocumentDimensionsMessageData, shouldIgnoreKeyEv
import {ToolbarManager} from './toolbar_manager.js';
/**
* @typedef {{
* type: string,
* to: string,
* cc: string,
* bcc: string,
* subject: string,
* body: string,
* }}
*/
let EmailMessageData;
/**
* @typedef {{
* type: string,
......@@ -793,6 +805,13 @@ export class PDFViewerElement extends PDFViewerBaseElement {
this.setDocumentDimensions(
/** @type {!DocumentDimensionsMessageData} */ (data));
return;
case 'email':
const emailData = /** @type {!EmailMessageData} */ (data);
const href = 'mailto:' + emailData.to + '?cc=' + emailData.cc +
'&bcc=' + emailData.bcc + '&subject=' + emailData.subject +
'&body=' + emailData.body;
this.handleNavigate_(href, WindowOpenDisposition.CURRENT_TAB);
return;
case 'getPassword':
this.handlePasswordRequest_();
return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment