summaryrefslogtreecommitdiffstats
path: root/chrome/browser/resources
diff options
context:
space:
mode:
authorthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-02 23:14:47 +0000
committerthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-02 23:14:47 +0000
commite9ac075378e8e5c15971600d827ea26787abd1c4 (patch)
tree14eef74a28c37a59b820303ebaae6e2fde8dffae /chrome/browser/resources
parent1f88e16f9354042a79f4b1fcb50f4eeaa997ac22 (diff)
downloadchromium_src-e9ac075378e8e5c15971600d827ea26787abd1c4.zip
chromium_src-e9ac075378e8e5c15971600d827ea26787abd1c4.tar.gz
chromium_src-e9ac075378e8e5c15971600d827ea26787abd1c4.tar.bz2
Print preview: Implement functions to add a PDF plugin to the page and update it.
BUG=57904 TEST=none Review URL: http://codereview.chromium.org/5524004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68101 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/resources')
-rw-r--r--chrome/browser/resources/print_preview.css5
-rw-r--r--chrome/browser/resources/print_preview.html2
-rw-r--r--chrome/browser/resources/print_preview.js27
3 files changed, 32 insertions, 2 deletions
diff --git a/chrome/browser/resources/print_preview.css b/chrome/browser/resources/print_preview.css
index 514210a..f338b98 100644
--- a/chrome/browser/resources/print_preview.css
+++ b/chrome/browser/resources/print_preview.css
@@ -54,6 +54,11 @@ body {
background-color: #ccc;
}
+#pdf-viewer {
+ width: 100%;
+ height: 100%;
+}
+
section {
-webkit-box-orient: horizontal;
display: -webkit-box;
diff --git a/chrome/browser/resources/print_preview.html b/chrome/browser/resources/print_preview.html
index ff755c5..e5aee65 100644
--- a/chrome/browser/resources/print_preview.html
+++ b/chrome/browser/resources/print_preview.html
@@ -75,7 +75,7 @@
</div>
<div id="separator"></div>
<div id="mainview">
- MAIN
+ <p id="loading" i18n-content="loading"></p>
</div>
<script>
diff --git a/chrome/browser/resources/print_preview.js b/chrome/browser/resources/print_preview.js
index 02a1bc4..6af5dd4 100644
--- a/chrome/browser/resources/print_preview.js
+++ b/chrome/browser/resources/print_preview.js
@@ -13,6 +13,7 @@ function load() {
});
chrome.send('getPrinters');
+ chrome.send('getPreview');
};
/**
@@ -34,5 +35,29 @@ function setPrinters(printers) {
}
}
-window.addEventListener('DOMContentLoaded', load);
+function onPDFLoad() {
+ $('pdf-viewer').fitToHeight();
+}
+
+/**
+ * Create the PDF plugin or reload the existing one.
+ */
+function createPDFPlugin(url) {
+ if ($('pdf-viewer')) {
+ pdfPlugin.reload();
+ return;
+ }
+
+ var loadingElement = $('loading');
+ var mainView = loadingElement.parentNode;
+ mainView.removeChild(loadingElement);
+ pdfPlugin = document.createElement('object');
+ pdfPlugin.setAttribute('id', 'pdf-viewer');
+ pdfPlugin.setAttribute('type', 'application/pdf');
+ pdfPlugin.setAttribute('src', url);
+ mainView.appendChild(pdfPlugin);
+ pdfPlugin.onload('onPDFLoad()');
+}
+
+window.addEventListener('DOMContentLoaded', load);