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

Side by Side Diff: chrome/common/extensions/docs/examples/api/tabs/screenshot/background.js

Issue 8318001: Adding `content_security_policy` to a few sample extensions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Docs. Zips. Created 9 years, 2 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
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // To make sure we can uniquely identify each screenshot tab, add an id as a 5 // To make sure we can uniquely identify each screenshot tab, add an id as a
6 // query param to the url that displays the screenshot. 6 // query param to the url that displays the screenshot.
7 var id = 100; 7 var id = 100;
8 8
9 function takeScreenshot() { 9 function takeScreenshot() {
10 chrome.tabs.captureVisibleTab(null, function(img) { 10 chrome.tabs.captureVisibleTab(null, function(img) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 } 47 }
48 48
49 // Listen for a click on the camera icon. On that click, take a screenshot. 49 // Listen for a click on the camera icon. On that click, take a screenshot.
50 chrome.browserAction.onClicked.addListener(function(tab) { 50 chrome.browserAction.onClicked.addListener(function(tab) {
51 if (tab.url.match(/code.google.com/)) { 51 if (tab.url.match(/code.google.com/)) {
52 takeScreenshot(); 52 takeScreenshot();
53 } else { 53 } else {
54 alert('This sample can only take screenshots of code.google.com pages'); 54 alert('This sample can only take screenshots of code.google.com pages');
55 } 55 }
56 }); 56 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698