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

Issue 144019: Functionality has been requested in the Extension API for Javascript to... (Closed)

Created:
11 years, 6 months ago by adamhunter
Modified:
3 years, 8 months ago
CC:
chromium-reviews_googlegroups.com, darin (slow to review), Ben Goodger (Google)
Visibility:
Public.

Description

Functionality has been requested in the Extension API for Javascript to take screenshots of the currently visible tab. This changelist builds this function, chrome.tabs.getVisibleScreenCapture. This function takes a single callback function and returns to that function a data URL of a JPEG image of the current screen. A simple sample extension is provided as a use case. BUG=14760 TEST=There is an extension in chrome\test\data\extensions\samples\screenshot, load this extension. It creates a toolstrip button. Click this button, you should get a page with a screenshot of the active tab. The API function is found at chrome.tabs.getVisibleScreenCapture.

Patch Set 1 #

Patch Set 2 : '' #

Patch Set 3 : '' #

Patch Set 4 : '' #

Total comments: 43

Patch Set 5 : '' #

Patch Set 6 : '' #

Patch Set 7 : '' #

Total comments: 14

Patch Set 8 : '' #

Total comments: 7

Patch Set 9 : '' #

Patch Set 10 : '' #

Patch Set 11 : '' #

Total comments: 5

Patch Set 12 : '' #

Patch Set 13 : '' #

Total comments: 10

Patch Set 14 : '' #

Total comments: 4

Patch Set 15 : '' #

Patch Set 16 : '' #

Patch Set 17 : '' #

Patch Set 18 : '' #

Patch Set 19 : '' #

Total comments: 5
Unified diffs Side-by-side diffs Delta from patch set Stats (+176 lines, -1 line) Patch
M chrome/browser/extensions/extension_function_dispatcher.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/browser/extensions/extension_tabs_module.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +3 lines, -0 lines 0 comments Download
M chrome/browser/extensions/extension_tabs_module.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 3 chunks +74 lines, -0 lines 2 comments Download
M chrome/browser/extensions/extension_tabs_module_constants.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 2 chunks +2 lines, -0 lines 0 comments Download
M chrome/common/extensions/extension.h View 13 14 15 16 17 18 1 chunk +1 line, -0 lines 1 comment Download
M chrome/renderer/extensions/extension_api_client_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +12 lines, -0 lines 0 comments Download
M chrome/renderer/renderer_resources.grd View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +1 line, -1 line 0 comments Download
M chrome/renderer/resources/extension_process_bindings.js View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 2 chunks +11 lines, -0 lines 2 comments Download
A chrome/test/data/extensions/samples/screenshot/functions.js View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +45 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/samples/screenshot/manifest.json View 1 chunk +8 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/samples/screenshot/my_toolstrip.html View 1 2 3 4 1 chunk +9 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/samples/screenshot/popup.html View 1 chunk +8 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/samples/screenshot/white.jpg View Binary file 0 comments Download

Messages

Total messages: 34 (0 generated)
adamhunter
Hi Erik and Rafael, this is my screenshot checkin. Please feel free to be harsh. ...
11 years, 6 months ago (2009-06-23 00:29:23 UTC) #1
brettw
I didn't look at this in detail, can you clarify some things for me? I ...
11 years, 6 months ago (2009-06-23 05:29:56 UTC) #2
Aaron Boodman
Cool! I didn't realize someone was working on this. http://codereview.chromium.org/144019/diff/2014/2025 File chrome/browser/extensions/extension_tabs_module.cc (right): http://codereview.chromium.org/144019/diff/2014/2025#newcode625 Line ...
11 years, 6 months ago (2009-06-23 06:06:00 UTC) #3
Erik does not do reviews
http://codereview.chromium.org/144019/diff/2014/2025 File chrome/browser/extensions/extension_tabs_module.cc (right): http://codereview.chromium.org/144019/diff/2014/2025#newcode626 Line 626: const SkBitmap *screen_capture = profile()->GetScreenCapture(); Hanging this off ...
11 years, 6 months ago (2009-06-23 17:03:44 UTC) #4
Aaron Boodman
Stepping back from the code, thinking about design issues: * We are returning JPEG data, ...
11 years, 6 months ago (2009-06-23 17:37:16 UTC) #5
adamhunter
Wanted to send these out quickly because they are structural. http://codereview.chromium.org/144019/diff/2014/2022 File chrome/browser/extensions/extension_tabs_module.h (right): http://codereview.chromium.org/144019/diff/2014/2022#newcode91 ...
11 years, 6 months ago (2009-06-23 18:28:55 UTC) #6
brettw
http://codereview.chromium.org/144019/diff/2014/2038 File chrome/renderer/render_view.cc (right): http://codereview.chromium.org/144019/diff/2014/2038#newcode638 Line 638: bool RenderView::CaptureVisibleScreen(WebFrame* frame, On 2009/06/23 18:28:55, adamhunter wrote: ...
11 years, 6 months ago (2009-06-23 18:35:12 UTC) #7
Erik does not do reviews
On 2009/06/23 18:28:55, adamhunter wrote: > Wanted to send these out quickly because they are ...
11 years, 6 months ago (2009-06-23 18:38:08 UTC) #8
adamhunter
http://codereview.chromium.org/144019/diff/2014/2038 File chrome/renderer/render_view.cc (right): http://codereview.chromium.org/144019/diff/2014/2038#newcode638 Line 638: bool RenderView::CaptureVisibleScreen(WebFrame* frame, On 2009/06/23 18:35:12, brettw wrote: ...
11 years, 6 months ago (2009-06-23 18:38:15 UTC) #9
adamhunter
On 2009/06/23 18:38:15, adamhunter wrote: > http://codereview.chromium.org/144019/diff/2014/2038 > File chrome/renderer/render_view.cc (right): > > http://codereview.chromium.org/144019/diff/2014/2038#newcode638 > ...
11 years, 6 months ago (2009-06-23 18:46:36 UTC) #10
adamhunter
I have now rewritten this change structurally to use the backing store, and also tried ...
11 years, 6 months ago (2009-06-23 23:04:20 UTC) #11
brettw
http://codereview.chromium.org/144019/diff/2081/2091 File chrome/browser/extensions/extension_tabs_module.cc (right): http://codereview.chromium.org/144019/diff/2081/2091#newcode651 Line 651: // Get the bitmap out of the canvas ...
11 years, 6 months ago (2009-06-23 23:26:41 UTC) #12
brettw
> http://codereview.chromium.org/144019/diff/2081/2091#newcode655 > Line 655: UNREFERENCED_PARAMETER(backing_store); > Use NOTIMPLEMENTED so other platforms know this isn't ...
11 years, 6 months ago (2009-06-23 23:27:04 UTC) #13
Erik does not do reviews
http://codereview.chromium.org/144019/diff/2081/2091 File chrome/browser/extensions/extension_tabs_module.cc (right): http://codereview.chromium.org/144019/diff/2081/2091#newcode7 Line 7: #include "base/file_util.h" is this being used? http://codereview.chromium.org/144019/diff/2081/2091#newcode9 Line ...
11 years, 6 months ago (2009-06-23 23:27:27 UTC) #14
rafaelw
http://codereview.chromium.org/144019/diff/2101/2111 File chrome/browser/extensions/extension_tabs_module.cc (right): http://codereview.chromium.org/144019/diff/2101/2111#newcode628 Line 628: bool GetVisibleTabCaptureFunction::RunImpl() { It seems like this function ...
11 years, 6 months ago (2009-06-24 22:02:31 UTC) #15
adamhunter
More changes, hopefully things are starting to look good. Let me know what I've missed. ...
11 years, 5 months ago (2009-06-25 18:48:57 UTC) #16
brettw
http://codereview.chromium.org/144019/diff/2081/2091 File chrome/browser/extensions/extension_tabs_module.cc (right): http://codereview.chromium.org/144019/diff/2081/2091#newcode653 Line 653: bmp.copyTo(&screen_capture, SkBitmap::kARGB_8888_Config); On 2009/06/25 18:48:59, adamhunter wrote: > ...
11 years, 5 months ago (2009-06-25 19:23:11 UTC) #17
Aaron Boodman
http://codereview.chromium.org/144019/diff/4005/3080 File chrome/test/data/extensions/samples/screenshot/functions.js (right): http://codereview.chromium.org/144019/diff/4005/3080#newcode1 Line 1: var button = null; On 2009/06/25 19:23:11, brettw ...
11 years, 5 months ago (2009-06-30 21:29:17 UTC) #18
shinyobject
Hi Aaron and Brett, I've made an effort to address your concerns, let me know ...
11 years, 5 months ago (2009-07-06 20:32:13 UTC) #19
adamhunter
My apologies, apparently I was logged in with my personal account at some point.
11 years, 5 months ago (2009-07-06 20:35:34 UTC) #20
Erik does not do reviews
I have one small comment (the optional function parameter), the rest are style nits. http://codereview.chromium.org/144019/diff/5001/6009 ...
11 years, 5 months ago (2009-07-06 20:51:06 UTC) #21
adamhunter
All done.
11 years, 5 months ago (2009-07-07 21:48:15 UTC) #22
adamhunter
On 2009/07/07 21:48:15, adamhunter wrote: > All done. Looks like i have merge errors, i'll ...
11 years, 5 months ago (2009-07-07 21:50:46 UTC) #23
Erik does not do reviews
LGTM - so now brettw, aa, rafaelw?
11 years, 5 months ago (2009-07-09 21:47:47 UTC) #24
Aaron Boodman
http://codereview.chromium.org/144019/diff/4030/7016 File chrome/renderer/resources/extension_process_bindings.js (right): http://codereview.chromium.org/144019/diff/4030/7016#newcode317 Line 317: chrome.tabs.getVisibleTabCapture = function(callback) { api nitpickery: Is it ...
11 years, 5 months ago (2009-07-10 00:56:48 UTC) #25
adamhunter
http://codereview.chromium.org/144019/diff/4005/3080 File chrome/test/data/extensions/samples/screenshot/functions.js (right): http://codereview.chromium.org/144019/diff/4005/3080#newcode1 Line 1: var button = null; On 2009/06/25 19:23:11, brettw ...
11 years, 5 months ago (2009-07-10 01:11:22 UTC) #26
rafaelw
http://codereview.chromium.org/144019/diff/4030/7012 File chrome/browser/extensions/extension_tabs_module.cc (right): http://codereview.chromium.org/144019/diff/4030/7012#newcode625 Line 625: bool GetVisibleTabCaptureFunction::RunImpl() { I didn't see a reply ...
11 years, 5 months ago (2009-07-10 01:14:36 UTC) #27
darin (slow to review)
Apologies for going back in time.... but, I couldn't find where these questions were addressed. ...
11 years, 5 months ago (2009-07-14 05:34:43 UTC) #28
Aaron Boodman
Here was the answer: <snip> Also, I just realized that I missed Aaron's good suggestion ...
11 years, 5 months ago (2009-07-14 17:23:22 UTC) #29
adamhunter
All done.
11 years, 5 months ago (2009-07-14 20:50:00 UTC) #30
rafaelw
LGTM. Really nice work on this.
11 years, 5 months ago (2009-07-14 20:53:10 UTC) #31
Mohamed Mansour
Sorry for dropping by so late, would it be "better" if we do something like: ...
11 years, 4 months ago (2009-07-27 00:43:13 UTC) #32
erikkay
On Sun, Jul 26, 2009 at 5:43 PM, <mhm@chromium.org> wrote: > Sorry for dropping by ...
11 years, 4 months ago (2009-07-27 17:25:07 UTC) #33
Aaron Boodman
11 years, 4 months ago (2009-07-30 18:15:12 UTC) #34
LGTM, with a few nits.

http://codereview.chromium.org/144019/diff/7116/4106
File chrome/browser/extensions/extension_tabs_module.cc (right):

http://codereview.chromium.org/144019/diff/7116/4106#newcode662
Line 662: // TODO(adamhunter): TODO(port): Write this for other platforms.
What about the other platforms? What is the timeline for implementation? Do we
know how to do it?

http://codereview.chromium.org/144019/diff/7116/4106#newcode663
Line 663: NOTIMPLEMENTED();
Also, I forget what the behavior of NOTIMPLEMENTED() is in Release. We should
not crash. I would prefer to just return an error in platforms we don't support.

http://codereview.chromium.org/144019/diff/7116/4111
File chrome/common/extensions/extension.h (right):

http://codereview.chromium.org/144019/diff/7116/4111#newcode56
Line 56: 
remove no-op change.

http://codereview.chromium.org/144019/diff/7116/4110
File chrome/renderer/resources/extension_process_bindings.js (right):

http://codereview.chromium.org/144019/diff/7116/4110#newcode322
Line 322: chrome.tabs.getVisibleTabCapture = function(windowId, callback) {
Shouldn't this be in api.json now?

http://codereview.chromium.org/144019/diff/7116/4110#newcode322
Line 322: chrome.tabs.getVisibleTabCapture = function(windowId, callback) {
Can we change the name to captureVisibleTab()?

Powered by Google App Engine
This is Rietveld 408576698