summaryrefslogtreecommitdiffstats
path: root/ceee
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-12 22:25:54 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-12 22:25:54 +0000
commitc62e2ab24534fa0f2c37fae060bc6c17e1990d0a (patch)
treeacd03cedbb948f4e4a0eba59f3ab01ab82221074 /ceee
parent93a65ac3bc0a38129fb8fb7ec2fb61b969a895c0 (diff)
downloadchromium_src-c62e2ab24534fa0f2c37fae060bc6c17e1990d0a.zip
chromium_src-c62e2ab24534fa0f2c37fae060bc6c17e1990d0a.tar.gz
chromium_src-c62e2ab24534fa0f2c37fae060bc6c17e1990d0a.tar.bz2
Reverting as this causes chrome frame unit tests to crash. Please fix and resubmit
Revert 66002 - Change the FF CEEE to create its chrome frame instance initially hidden, and make it visible only once the content is done loading. This avoids any flicker at startup, and fixes a bug where the chrome frame instance is removed after a print preview. Also added support to chrome frame to send an uninitialized ready state when its being torn down. BUG=62979 TEST=Make sure that there is no UI flicker on chrome frame startup, and make sure that the extenions works correct after showing print preview and closing it. Review URL: http://codereview.chromium.org/4882004 TBR=rogerta@chromium.org Review URL: http://codereview.chromium.org/4855005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66010 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ceee')
-rw-r--r--ceee/firefox/content/cf.js49
-rw-r--r--ceee/firefox/content/overlay.js2
-rw-r--r--ceee/firefox/content/overlay.xul13
-rw-r--r--ceee/firefox/content/userscript_api.js3
4 files changed, 37 insertions, 30 deletions
diff --git a/ceee/firefox/content/cf.js b/ceee/firefox/content/cf.js
index e8dd4f79..48c0328 100644
--- a/ceee/firefox/content/cf.js
+++ b/ceee/firefox/content/cf.js
@@ -168,11 +168,10 @@ CfHelper.prototype.create = function(parent, idValue, onCfReady, onCfMessage) {
'--enable-experimental-extension-apis');
// TODO(joi@chromium.org) Remove this once the "*" default is removed from CF.
this.cf_.setAttribute('chrome_functions_automated', '');
- this.cf_.style.visibility = 'hidden';
// Add ChromeFrame to the DOM. This *must* be done before setting the
// event listeners or things will just silently fail.
- parent.appendChild(this.cf_);
+ parent.insertBefore(this.cf_, parent.firstChild);
// Setup all event handlers.
this.cf_.onprivatemessage = onCfMessage;
@@ -193,9 +192,7 @@ CfHelper.prototype.create = function(parent, idValue, onCfReady, onCfMessage) {
var impl = this;
this.cf_.addEventListener('readystatechanged',
- function() {impl.onReadyStateChange_();}, false);
- this.cf_.addEventListener('load',
- function() {impl.onCFContentLoad_(onCfReady);}, false);
+ function() {impl.onReadyStateChange_(onCfReady);}, false);
return this.cf_;
};
@@ -233,14 +230,13 @@ var READY_STATE_COMPLETED = 4;
/**
* Handle 'embed' element ready state events.
+ * @param {!function()} onCfReady A callback for ChromeFrame becomes ready.
* @private
*/
-CfHelper.prototype.onReadyStateChange_ = function() {
+CfHelper.prototype.onReadyStateChange_ = function(onCfReady) {
this.ceee_.logInfo('CfHelper.readystatechange: state=' +
this.cf_.readystate);
- if (this.cf_.readystate == READY_STATE_UNINITIALIZED) {
- this.cf_.style.visibility = 'hidden';
- } else if (this.cf_.readystate == READY_STATE_COMPLETED) {
+ if (this.cf_.readystate == READY_STATE_COMPLETED) {
// Do this before we even load the extension at the other end so
// that extension automation is set up before any background pages
// in the extension load.
@@ -253,6 +249,7 @@ CfHelper.prototype.onReadyStateChange_ = function() {
//if (!loadExtensions) {
// this.isReady_ = true;
// this.postPendingMessages_();
+ // onCfReady();
// return;
//}
var lastInstallPath =
@@ -273,14 +270,14 @@ CfHelper.prototype.onReadyStateChange_ = function() {
// Install and save the path and file time.
this.cf_.installExtension(extensionPath, function(res) {
impl.cf_.getEnabledExtensions(function(extensionDirs) {
- impl.onGetEnabledExtensionsComplete_(extensionDirs);
+ impl.onGetEnabledExtensionsComplete_(extensionDirs, onCfReady);
});
});
} else {
// We are not installing a CRX file. Before deciding what we should do,
// we need to find out what extension may already be installed.
this.cf_.getEnabledExtensions(function(extensionDirs) {
- impl.onGetEnabledExtensionsComplete_(extensionDirs);
+ impl.onGetEnabledExtensionsComplete_(extensionDirs, onCfReady);
});
}
}
@@ -290,9 +287,11 @@ CfHelper.prototype.onReadyStateChange_ = function() {
* Process response from 'getEnabledExtensions'.
* @param {string} extensionDirs tab-separate list of extension dirs. Only first
* entry is handled.
+ * @param {function()} onCfReady A callback for ChromeFrame becomes ready.
* @private
*/
-CfHelper.prototype.onGetEnabledExtensionsComplete_ = function(extensionDirs) {
+CfHelper.prototype.onGetEnabledExtensionsComplete_ = function (extensionDirs,
+ onCfReady) {
this.ceee_.logInfo('OnGetEnabledExtensions: ' + extensionDirs);
var extensions = extensionDirs.split('\t');
@@ -307,24 +306,24 @@ CfHelper.prototype.onGetEnabledExtensionsComplete_ = function(extensionDirs) {
this.LAST_INSTALL_TIME,
extensionFile.lastModifiedTime.toString());
}
- this.onLoadExtension_(extensions[0]);
+ this.onLoadExtension_(extensions[0], onCfReady);
} else if (extensionFile && !this.ceee_.isCrx(extensionFile.path)) {
this.ceee_.logInfo('Loading exploded path:' + extensionFile.path);
this.cf_.loadExtension(extensionFile.path, function() {
- impl.onLoadExtension_(extensionFile.path);
+ impl.onLoadExtension_(extensionFile.path, onCfReady);
});
} else if (!this.alreadyTriedInstalling_ && extensionFile) {
this.ceee_.logInfo('Attempting to do first-time .crx install.');
this.alreadyTriedInstalling_ = true;
this.cf_.installExtension(extensionFile.path, function(res) {
impl.cf_.getEnabledExtensions(function(extensionDirs) {
- impl.onGetEnabledExtensionsComplete_(extensionDirs);
+ impl.onGetEnabledExtensionsComplete_(extensionDirs, onCfReady);
});
});
} else {
// Remove the toolbar entirely. The direct parent is the toolbaritem
// (check overlay.xul for more information), so we to remove our parentNode.
- var toolbar = this.parent_.parentNode;
+ var toolbar = this.parent_.parentNode.parentNode;
toolbar.parentNode.removeChild(toolbar);
this.ceee_.logInfo('No extension installed.');
}
@@ -333,9 +332,10 @@ CfHelper.prototype.onGetEnabledExtensionsComplete_ = function(extensionDirs) {
/**
* Process response from 'loadExtension' call.
* @param {string} baseDir Extension home dir.
+ * @param {!function()} onCfReady A callback for ChromeFrame becomes ready.
* @private
*/
-CfHelper.prototype.onLoadExtension_ = function (baseDir) {
+CfHelper.prototype.onLoadExtension_ = function (baseDir, onCfReady) {
var extensions = [baseDir];
this.ceee_.logInfo('OnLoadExtension: ' + baseDir);
this.ceee_.initExtensions(extensions);
@@ -349,22 +349,19 @@ CfHelper.prototype.onLoadExtension_ = function (baseDir) {
} else {
// Remove the toolbar entirely. The direct parent is the toolbaritem
// (check overlay.xul for more information), so we to remove our parentNode.
- var toolbar = this.parent_.parentNode;
+ var toolbar = this.parent_.parentNode.parentNode;
toolbar.parentNode.removeChild(toolbar);
this.ceee_.logInfo('No extension URL');
}
-};
-/**
- * Called once the content of the ChromeFrame is loaded and ready.
- * @param {!function()} onCfReady A callback for ChromeFrame becomes ready.
- * @private
- */
-CfHelper.prototype.onCFContentLoad_ = function(onCfReady) {
- this.cf_.style.visibility = 'visible';
this.isReady_ = true;
this.postPendingMessages_();
onCfReady();
+ var parent = this.parent_;
+ setTimeout(function(){
+ parent.selectedIndex = 0;
+ parent.removeChild(parent.lastChild);
+ }, 0);
};
// Make the constructor visible outside this anonymous block.
diff --git a/ceee/firefox/content/overlay.js b/ceee/firefox/content/overlay.js
index 23dbd8e..482f99d 100644
--- a/ceee/firefox/content/overlay.js
+++ b/ceee/firefox/content/overlay.js
@@ -306,7 +306,7 @@ CEEE_Class.prototype.createChromeFrame_ = function() {
var onCfMessage = function(evt, target) {impl.onCfMessage_(evt, target);};
this.cfHelper_ = new CEEE_CfHelper(this);
- var parent = document.getElementById('ceee-browser-item');
+ var parent = document.getElementById('ceee-frame-deck');
var cf = this.cfHelper_.create(parent, this.cfHelper_.CHROME_FRAME_ID,
onCfReady, onCfMessage);
};
diff --git a/ceee/firefox/content/overlay.xul b/ceee/firefox/content/overlay.xul
index c70ab62..883d5ba 100644
--- a/ceee/firefox/content/overlay.xul
+++ b/ceee/firefox/content/overlay.xul
@@ -47,7 +47,12 @@
toolbaritem to appear correctly. -->
<toolbaritem id="ceee-browser-item" title="&ceee.browser.label;"
flex="1" tooltiptext="&ceee.browser.tooltip;">
- <!-- The ChromeFrame will be placed as a child of this element. -->
+ <deck id="ceee-frame-deck" flex="1" selectedIndex="1">
+ <!-- The ChromeFrame will be placed as a child of this element
+ just before the following div element in the overlay.js file. -->
+ <div xmlns="http://www.w3.org/1999/xhtml"
+ style="background-color:white"/>
+ </deck>
</toolbaritem>
</toolbar>
</toolbox>
@@ -64,13 +69,15 @@
<label id="ceee-sidebar-label"
value="My title"
style="font-size:14pt;"/>
- <!-- The ChromeFrame will be placed as a child of this element. -->
+ <!-- The ChromeFrame will be placed as a child of this element
+ just before the following div element in the overlay.js file. -->
</vbox>
</hbox>
<window id="main-window">
<vbox id="ceee-sidebar-icon-box">
- <!-- The ChromeFrame will be placed as a child of this element. -->
+ <!-- The ChromeFrame will be placed as a child of this element
+ just before the following div element in the overlay.js file. -->
</vbox>
</window>
diff --git a/ceee/firefox/content/userscript_api.js b/ceee/firefox/content/userscript_api.js
index 87522d9..aefc66cc 100644
--- a/ceee/firefox/content/userscript_api.js
+++ b/ceee/firefox/content/userscript_api.js
@@ -651,6 +651,9 @@ UserScriptManager.prototype.loadUserScripts = function(manifest) {
pathPattern: new RegExp(pathPattern)
};
patterns.push(pattern);
+
+ ceee.logInfo('loadUserScripts: url=' + spec +
+ ' pattern=' + CEEE_json.encode(pattern));
}
script.patterns = patterns;