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

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

Issue 582583002: Change the OOP PDF plugin to use BrowserPlugin mime type handling. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 | « chrome/browser/resources/pdf/index.html ('k') | chrome/browser/resources/pdf/manifest.json » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 'use strict';
6
7 <include src="../../../../ui/webui/resources/js/util.js">
8 <include src="open_pdf_params_parser.js">
9 <include src="pdf.js">
10 <include src="pdf_scripting_api.js">
11 <include src="viewport.js">
12
13 /**
14 * Global PDFViewer object, accessible for testing.
15 * @type Object
16 */
17 var viewer;
18
19 /**
20 * Entrypoint for starting the PDF viewer. This function obtains the details
21 * of the PDF 'stream' (the data that points to the PDF) and constructs a
22 * PDFViewer object with it.
23 */
24 (function main() {
25 // If the viewer is started from the browser plugin, the view ID will be
26 // passed in which identifies the instance of the plugin.
27 var params = window.location.search.substring(1).split('=');
28 if (params.length == 2 && params[0] == 'id') {
29 var viewId = params[1];
30
31 // Send a message to the background page to obtain the stream details. It
32 // will run the callback function passed in to initialize the viewer.
33 chrome.runtime.sendMessage(
34 'mhjfbmdgcfjbbpaeojofohoefgiehjai',
35 {viewId: viewId},
36 function(streamDetails) { viewer = new PDFViewer(streamDetails); });
37 return;
38 }
39
40 // The viewer may be started directly by passing in the URL of the PDF to load
41 // as the query string. This is used for print preview in particular. The URL
42 // of this page will be of the form
43 // 'chrome-extension://<extension id>?<pdf url>'. We pull out the <pdf url>
44 // part here.
45 var url = window.location.search.substring(1);
46 var streamDetails = {
47 streamUrl: url,
48 originalUrl: url,
49 responseHeaders: ''
50 };
51 viewer = new PDFViewer(streamDetails);
52 })();
OLDNEW
« no previous file with comments | « chrome/browser/resources/pdf/index.html ('k') | chrome/browser/resources/pdf/manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698