| OLD | NEW |
| 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 Loading... |
| 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 }); |
| OLD | NEW |