| Index: chrome/test/data/extensions/samples/screenshot/functions.js
|
| ===================================================================
|
| --- chrome/test/data/extensions/samples/screenshot/functions.js (revision 0)
|
| +++ chrome/test/data/extensions/samples/screenshot/functions.js (revision 0)
|
| @@ -0,0 +1,45 @@
|
| +// Copyright (c) 2009 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.
|
| +
|
| +var button = null;
|
| +var my_window = null;
|
| +var screenshot_url = null;
|
| +var child_loaded = false;
|
| +var have_screenshot = false;
|
| +
|
| +function registerHandlers() {
|
| + button = document.getElementById("button");
|
| + button.addEventListener("click",handleClick);
|
| +}
|
| +
|
| +function waitForChildLoaded() {
|
| + if(child_loaded && have_screenshot) {
|
| + var foo = my_window.document.getElementById("replacer");
|
| + foo.src = screenshot_url;
|
| + have_screenshot = false;
|
| + } else {
|
| + window.setTimeout(waitForChildLoaded, 50);
|
| + }
|
| +}
|
| +
|
| +function handleClick() {
|
| + child_loaded = false;
|
| + chrome.tabs.getVisibleTabCapture(null,
|
| + function(img) {
|
| + try {
|
| + have_screenshot = true;
|
| + screenshot_url = img;
|
| + } catch(e) {
|
| + for(var f in e) {
|
| + console.log(f + ":" + e[f]);
|
| + }
|
| + }
|
| + });
|
| + my_window = window.open('popup.html');
|
| + window.setTimeout(waitForChildLoaded, 50);
|
| +}
|
| +
|
| +function childLoaded() {
|
| + child_loaded = true;
|
| +}
|
|
|
| Property changes on: chrome\test\data\extensions\samples\screenshot\functions.js
|
| ___________________________________________________________________
|
| Added: svn:eol-style
|
| + LF
|
|
|
|
|