| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 /** | 5 /** |
| 6 * @fileoverview CFInstall.js provides a set of utilities for managing | 6 * @fileoverview CFInstall.js provides a set of utilities for managing |
| 7 * the Chrome Frame detection and installation process. | 7 * the Chrome Frame detection and installation process. |
| 8 * @author slightlyoff@google.com (Alex Russell) | 8 * @author slightlyoff@google.com (Alex Russell) |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 'margin-top: -300px;' + | 102 'margin-top: -300px;' + |
| 103 '}' + | 103 '}' + |
| 104 '.chromeFrameOverlayContent {' + | 104 '.chromeFrameOverlayContent {' + |
| 105 'position: absolute;' + | 105 'position: absolute;' + |
| 106 'margin-left: -400px;' + | 106 'margin-left: -400px;' + |
| 107 'margin-top: -300px;' + | 107 'margin-top: -300px;' + |
| 108 'left: 50%;' + | 108 'left: 50%;' + |
| 109 'top: 50%;' + | 109 'top: 50%;' + |
| 110 'border: 1px solid #93B4D9;' + | 110 'border: 1px solid #93B4D9;' + |
| 111 'background-color: white;' + | 111 'background-color: white;' + |
| 112 'z-index: 2001;' + |
| 112 '}' + | 113 '}' + |
| 113 '.chromeFrameOverlayContent iframe {' + | 114 '.chromeFrameOverlayContent iframe {' + |
| 114 'width: 800px;' + | 115 'width: 800px;' + |
| 115 'height: 600px;' + | 116 'height: 600px;' + |
| 116 'border: none;' + | 117 'border: none;' + |
| 117 '}' + | 118 '}' + |
| 118 '.chromeFrameOverlayCloseBar {' + | 119 '.chromeFrameOverlayCloseBar {' + |
| 119 'height: 1em;' + | 120 'height: 1em;' + |
| 120 'text-align: right;' + | 121 'text-align: right;' + |
| 121 'background-color: #CADEF4;' + | 122 'background-color: #CADEF4;' + |
| 122 '}' + | 123 '}' + |
| 123 '.chromeFrameOverlayUnderlay {' + | 124 '.chromeFrameOverlayUnderlay {' + |
| 124 'position: absolute;' + | 125 'position: absolute;' + |
| 125 'width: 100%;' + | 126 'width: 100%;' + |
| 126 'height: 100%;' + | 127 'height: 100%;' + |
| 127 'background-color: white;' + | 128 'background-color: white;' + |
| 128 'opacity: 0.5;' + | 129 'opacity: 0.5;' + |
| 129 '-moz-opacity: 0.5;' + | 130 '-moz-opacity: 0.5;' + |
| 130 '-webkit-opacity: 0.5;' + | 131 '-webkit-opacity: 0.5;' + |
| 131 '-ms-filter: ' + | 132 '-ms-filter: ' + |
| 132 '"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";' + | 133 '"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";' + |
| 133 'filter: alpha(opacity=50);' + | 134 'filter: alpha(opacity=50);' + |
| 135 'z-index: 2000;' + |
| 134 '}'; | 136 '}'; |
| 135 injectStyleSheet(rules); | 137 injectStyleSheet(rules); |
| 136 cfStyleTagInjected = true; | 138 cfStyleTagInjected = true; |
| 137 }; | 139 }; |
| 138 | 140 |
| 139 /** | 141 /** |
| 140 * Injects style rules to hide the overlay version of the GCF prompt. | 142 * Injects style rules to hide the overlay version of the GCF prompt. |
| 141 * Multiple calls have no effect. | 143 * Multiple calls have no effect. |
| 142 */ | 144 */ |
| 143 var closeOverlay = function() { | 145 var closeOverlay = function() { |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 '<td>' + | 234 '<td>' + |
| 233 // TODO(slightlyoff): i18n | 235 // TODO(slightlyoff): i18n |
| 234 '<button id="chromeFrameCloseButton">close</button>' + | 236 '<button id="chromeFrameCloseButton">close</button>' + |
| 235 '</td>' + | 237 '</td>' + |
| 236 '</tr>' + | 238 '</tr>' + |
| 237 '<tr>' + | 239 '<tr>' + |
| 238 '<td id="chromeFrameIframeHolder"></td>' + | 240 '<td id="chromeFrameIframeHolder"></td>' + |
| 239 '</tr>' + | 241 '</tr>' + |
| 240 '</table>'; | 242 '</table>'; |
| 241 | 243 |
| 242 document.body.appendChild(n); | 244 var b = document.body; |
| 245 // Insert underlay nodes into the document in the right order. |
| 246 while (n.firstChild) { |
| 247 b.insertBefore(n.lastChild, b.firstChild); |
| 248 } |
| 243 var ifr = makeIframe(args); | 249 var ifr = makeIframe(args); |
| 244 byId('chromeFrameIframeHolder').appendChild(ifr); | 250 byId('chromeFrameIframeHolder').appendChild(ifr); |
| 245 byId('chromeFrameCloseButton').onclick = closeOverlay; | 251 byId('chromeFrameCloseButton').onclick = closeOverlay; |
| 246 }; | 252 }; |
| 247 | 253 |
| 248 var CFInstall = {}; | 254 var CFInstall = {}; |
| 249 | 255 |
| 250 /** | 256 /** |
| 251 * Checks to see if Chrome Frame is available, if not, prompts the user to | 257 * Checks to see if Chrome Frame is available, if not, prompts the user to |
| 252 * install. Once installation is begun, a background timer starts, | 258 * install. Once installation is begun, a background timer starts, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 264 | 270 |
| 265 // We currently only support CF in IE | 271 // We currently only support CF in IE |
| 266 // TODO(slightlyoff): Update this should we support other browsers! | 272 // TODO(slightlyoff): Update this should we support other browsers! |
| 267 var ua = navigator.userAgent; | 273 var ua = navigator.userAgent; |
| 268 var ieRe = /MSIE \S+; Windows NT/; | 274 var ieRe = /MSIE \S+; Windows NT/; |
| 269 var bail = false; | 275 var bail = false; |
| 270 if (ieRe.test(ua)) { | 276 if (ieRe.test(ua)) { |
| 271 // We also only support Win2003/XPSP2 or better. See: | 277 // We also only support Win2003/XPSP2 or better. See: |
| 272 // http://msdn.microsoft.com/en-us/library/ms537503%28VS.85%29.aspx | 278 // http://msdn.microsoft.com/en-us/library/ms537503%28VS.85%29.aspx |
| 273 if (parseFloat(ua.split(ieRe)[1]) < 6 && | 279 if (parseFloat(ua.split(ieRe)[1]) < 6 && |
| 274 ua.indexOf('SV1') >= 0) { | 280 // 'SV1' indicates SP2, only bail if not SP2 or Win2K3 |
| 281 ua.indexOf('SV1') < 0) { |
| 275 bail = true; | 282 bail = true; |
| 276 } | 283 } |
| 277 } else { | 284 } else { |
| 285 // Not IE |
| 278 bail = true; | 286 bail = true; |
| 279 } | 287 } |
| 280 if (bail) { | 288 if (bail) { |
| 281 return; | 289 return; |
| 282 } | 290 } |
| 283 | 291 |
| 284 // Inject the default styles | 292 // Inject the default styles |
| 285 injectCFStyleTag(); | 293 injectCFStyleTag(); |
| 286 | 294 |
| 287 if (document.cookie.indexOf("disableGCFCheck=1") >=0) { | 295 if (document.cookie.indexOf("disableGCFCheck=1") >=0) { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 | 347 |
| 340 CFInstall._force = false; | 348 CFInstall._force = false; |
| 341 CFInstall._forceValue = false; | 349 CFInstall._forceValue = false; |
| 342 CFInstall.isAvailable = isAvailable; | 350 CFInstall.isAvailable = isAvailable; |
| 343 | 351 |
| 344 // expose CFInstall to the external scope. We've already checked to make | 352 // expose CFInstall to the external scope. We've already checked to make |
| 345 // sure we're not going to blow existing objects away. | 353 // sure we're not going to blow existing objects away. |
| 346 scope.CFInstall = CFInstall; | 354 scope.CFInstall = CFInstall; |
| 347 | 355 |
| 348 })(this['ChromeFrameInstallScope'] || this); | 356 })(this['ChromeFrameInstallScope'] || this); |
| OLD | NEW |