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

Unified Diff: chrome/browser/resources/pdf/elements/viewer-button/viewer-button.js

Issue 853603002: Merge html-office-public repo into src (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/pdf/elements/viewer-button/viewer-button.js
diff --git a/chrome/browser/resources/pdf/elements/viewer-button/viewer-button.js b/chrome/browser/resources/pdf/elements/viewer-button/viewer-button.js
new file mode 100644
index 0000000000000000000000000000000000000000..73bd53eff1ea293a493a1fbdabfad113857a8854
--- /dev/null
+++ b/chrome/browser/resources/pdf/elements/viewer-button/viewer-button.js
@@ -0,0 +1,33 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+(function() {
+ var dpi = '';
+
+ Polymer('viewer-button', {
+ img: '',
+ latchable: false,
+ ready: function() {
+ if (!dpi) {
+ var mql = window.matchMedia('(-webkit-min-device-pixel-ratio: 1.3');
+ dpi = mql.matches ? 'hi' : 'low';
+ }
+ },
+ imgChanged: function() {
+ if (this.img) {
+ this.$.icon.style.backgroundImage =
+ 'url(' + this.getAttribute('assetpath') + 'img/' + dpi +
+ 'DPI/' + this.img + ')';
+ } else {
+ this.$.icon.style.backgroundImage = '';
+ }
+ },
+ latchableChanged: function() {
+ if (this.latchable)
+ this.classList.add('latchable');
+ else
+ this.classList.remove('latchable');
+ },
+ });
+})();

Powered by Google App Engine
This is Rietveld 408576698