| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011 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 /** | |
| 6 * @fileoverview Implements a compatibility layer for older versions of | |
| 7 * CFInstall.js . | |
| 8 **/ | |
| 9 | |
| 10 goog.provide('google.cf.installer.InlineDelegate'); | |
| 11 | |
| 12 goog.require('goog.style'); | |
| 13 | |
| 14 goog.require('google.cf.installer.InteractionDelegate'); | |
| 15 goog.require('google.cf.installer.frame'); | |
| 16 | |
| 17 /** | |
| 18 * Adds an unadorned iframe into the page, taking arguments to customize it. | |
| 19 * @param {Object} args A map of user-specified properties to set | |
| 20 * @constructor | |
| 21 * @implements {google.cf.installer.InteractionDelegate} | |
| 22 */ | |
| 23 google.cf.installer.InlineDelegate = function(args) { | |
| 24 this.args_ = args; | |
| 25 this.args_.className = 'chromeFrameInstallDefaultStyle ' + | |
| 26 (this.args_.className || ''); | |
| 27 }; | |
| 28 | |
| 29 /** | |
| 30 * Indicates whether the overlay CSS has already been injected. | |
| 31 * @type {boolean} | |
| 32 * @private | |
| 33 */ | |
| 34 google.cf.installer.InlineDelegate.styleInjected_ = false; | |
| 35 | |
| 36 /** | |
| 37 * Generates the CSS for the overlay. | |
| 38 * @private | |
| 39 */ | |
| 40 google.cf.installer.InlineDelegate.injectCss_ = function() { | |
| 41 if (google.cf.installer.InlineDelegate.styleInjected_) | |
| 42 return; | |
| 43 | |
| 44 goog.style.installStyles('.chromeFrameInstallDefaultStyle {' + | |
| 45 'width: 800px;' + | |
| 46 'height: 600px;' + | |
| 47 'position: absolute;' + | |
| 48 'left: 50%;' + | |
| 49 'top: 50%;' + | |
| 50 'margin-left: -400px;' + | |
| 51 'margin-top: -300px;' + | |
| 52 '}'); | |
| 53 google.cf.installer.InlineDelegate.styleInjected_ = true; | |
| 54 }; | |
| 55 | |
| 56 /** | |
| 57 * @inheritDoc | |
| 58 */ | |
| 59 google.cf.installer.InlineDelegate.prototype.getIFrameContainer = function() { | |
| 60 // TODO(user): This will append to the end of the container, whereas | |
| 61 // prior behaviour was beginning... | |
| 62 google.cf.installer.InlineDelegate.injectCss_(); | |
| 63 return google.cf.installer.frame.getParentNode(this.args_); | |
| 64 }; | |
| 65 | |
| 66 /** | |
| 67 * @inheritDoc | |
| 68 */ | |
| 69 google.cf.installer.InlineDelegate.prototype.customizeIFrame = | |
| 70 function(iframe) { | |
| 71 google.cf.installer.frame.setProperties(iframe, this.args_); | |
| 72 }; | |
| 73 | |
| 74 /** | |
| 75 * @inheritDoc | |
| 76 */ | |
| 77 google.cf.installer.InlineDelegate.prototype.show = function() { | |
| 78 // TODO(user): Should start it out hidden and reveal/resize here. | |
| 79 }; | |
| 80 | |
| 81 /** | |
| 82 * @inheritDoc | |
| 83 */ | |
| 84 google.cf.installer.InlineDelegate.prototype.reset = | |
| 85 function() { | |
| 86 // TODO(user): Should hide it here. | |
| 87 }; | |
| OLD | NEW |