diff options
author | slightlyoff@chromium.org <slightlyoff@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-24 05:11:58 +0000 |
---|---|---|
committer | slightlyoff@chromium.org <slightlyoff@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-24 05:11:58 +0000 |
commit | f781782dd67077478e117c61dca4ea5eefce3544 (patch) | |
tree | 4801f724123cfdcbb69c4e7fe40a565b331723ae /chrome_frame/host_w_controls.html | |
parent | 63cf4759efa2373e33436fb5df6849f930081226 (diff) | |
download | chromium_src-f781782dd67077478e117c61dca4ea5eefce3544.zip chromium_src-f781782dd67077478e117c61dca4ea5eefce3544.tar.gz chromium_src-f781782dd67077478e117c61dca4ea5eefce3544.tar.bz2 |
Initial import of the Chrome Frame codebase. Integration in chrome.gyp coming in a separate CL.
BUG=None
TEST=None
Review URL: http://codereview.chromium.org/218019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27042 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/host_w_controls.html')
-rw-r--r-- | chrome_frame/host_w_controls.html | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/chrome_frame/host_w_controls.html b/chrome_frame/host_w_controls.html new file mode 100644 index 0000000..0e44fc5 --- /dev/null +++ b/chrome_frame/host_w_controls.html @@ -0,0 +1,97 @@ +<HTML> +<!-- TODO(slightlyoff): Move to tests directory? --> +<HEAD> +<TITLE> Chrome Frame Test </TITLE> +<SCRIPT type="text/javascript"> +function msg(txt) { + try { + document.getElementById("my_text").innerHTML = txt; + } catch(e) { + alert("error"); + } +} + +function GetChromeFrame() { + var chromeFrame = window.document.ChromeFrame + return chromeFrame; +} + +function OnChromeFrameMessage(text) { + msg("In host: \r\nMessage from ChromeFrame: " + text); + + var chromeFrame = GetChromeFrame(); + chromeFrame.PostMessageToFrame("OnHostMessage", "Hello from host"); + return "OK"; +} + +function OnNavigate() { + var url = document.getElementById('inputurl'); + GetChromeFrame().src = url.value; +} + +function OnFocus() { + msg("OnFocus"); +} + +window.onload = function() { + var chromeFrame = GetChromeFrame(); + var url = location.href; + url = url.substr(0, url.lastIndexOf('/') + 1) + "frame_w_controls.html"; + chromeFrame.src = url; + + try { + var cf = document.getElementById('ChromeFrame'); + cf.addEventListener("focus", OnFocus, true); + cf.addEventListener("blur", function() { msg('blur'); }, true); + msg("ready"); + } catch(e) { + alert("error"); + } +} + +function setFocusToCf() { + var cf = document.getElementById('ChromeFrame'); + cf.focus(); + // alert(cf.hasFocus()); + return true; +} + +</SCRIPT> +<style> +/* CSS magic to avoid the focus rect */ +object:focus { + outline: 0; +} +</style> +<!-- +object:focus { outline: none; } +:focus { outline: none } +a:focus { outline: 1px dotted invert } +--> +</HEAD> +<BODY> +Chrome Frame Test activex +<br><br> +<input id="inputurl" type="text" name="URL"> +<input type="submit" value="Navigate" onClick="OnNavigate();"> +<center> +<OBJECT ID="ChromeFrame" tabindex="0" + WIDTH="500" + HEIGHT="300" + CODEBASE="http://www.google.com" + CLASSID="CLSID:E0A900DF-9611-4446-86BD-4B1D47E7DB2A"> + <!-- <PARAM NAME="BackColor" VALUE="100"> --> + <!-- <PARAM NAME="src" VALUE="file:///z:/code/debug/test.html"> --> + <embed ID="ChromeFramePlugin" WIDTH=500 HEIGHT=300 NAME="ChromeFrame" + SRC="http://www.google.com" TYPE="application/chromeframe"> + </embed> +</OBJECT> +<p>To test the focus: <input id="fake_edit" type="text" name="fake"></p> +<p><button onclick="return setFocusToCf();">SetFocusToCF</button></p> +<p> +Message:<br> +<pre><p id="my_text"></p></pre> +</p> +</center> +</BODY> +</HTML> |