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

Side by Side Diff: native_client_sdk/src/build_tools/screenshot_extension/background.js

Issue 23458018: [NaCl SDK] Screen capture extension for use with SDK visual testing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix nits Created 7 years, 3 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
OLDNEW
(Empty)
1 // Copyright (c) 2013 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 function takeScreenshot(onScreenshot) {
6 console.log('Taking screenshot.');
7 chrome.tabs.captureVisibleTab(null, {format: 'png'}, function(img) {
8 console.log('Got screenshot, returning...');
9 onScreenshot(img);
10 });
11 }
12
13 chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
14 if (changeInfo.status != 'complete')
15 return;
16
17 chrome.tabs.executeScript(tabId,
18 {file: 'injected.js', runAt: 'document_start'});
19 });
20
21 chrome.runtime.onMessage.addListener(
22 function(request, sender, sendResponse) {
23 takeScreenshot(sendResponse);
24
25 // Keep the sendResponse channel open, so a response can be sent
26 // asynchronously.
27 return true;
28 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698