Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Side by Side Diff: chrome/test/data/extensions/samples/screenshot/functions.js

Issue 144019: Functionality has been requested in the Extension API for Javascript to... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 var button = null;
6 var my_window = null;
7 var screenshot_url = null;
8 var child_loaded = false;
9 var have_screenshot = false;
10
11 function registerHandlers() {
12 button = document.getElementById("button");
13 button.addEventListener("click",handleClick);
14 }
15
16 function waitForChildLoaded() {
17 if(child_loaded && have_screenshot) {
18 var foo = my_window.document.getElementById("replacer");
19 foo.src = screenshot_url;
20 have_screenshot = false;
21 } else {
22 window.setTimeout(waitForChildLoaded, 50);
23 }
24 }
25
26 function handleClick() {
27 child_loaded = false;
28 chrome.tabs.getVisibleTabCapture(null,
29 function(img) {
30 try {
31 have_screenshot = true;
32 screenshot_url = img;
33 } catch(e) {
34 for(var f in e) {
35 console.log(f + ":" + e[f]);
36 }
37 }
38 });
39 my_window = window.open('popup.html');
40 window.setTimeout(waitForChildLoaded, 50);
41 }
42
43 function childLoaded() {
44 child_loaded = true;
45 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698