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

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

Created:
11 years, 5 months ago by rafaelw
Modified:
9 years, 7 months ago
CC:
chromium-reviews_googlegroups.com
Visibility:
Public.

Description

I have taken over this patch, original authored by Adam Hunter (adamhunter). The original issue is: http://codereview.chromium.org/144019 -------------- 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. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=23259

Patch Set 1 #

Patch Set 2 : minor error cases #

Patch Set 3 : added a few more error cases #

Total comments: 6

Patch Set 4 : fix merge errors #

Patch Set 5 : move patch to source tree #

Patch Set 6 : sync #

Patch Set 7 : cr changes #

Patch Set 8 : added docs #

Unified diffs Side-by-side diffs Delta from patch set Stats (+177 lines, -2 lines) Patch
M chrome/browser/extensions/extension_function_dispatcher.cc View 1 2 3 4 5 6 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/browser/extensions/extension_tabs_module.h View 1 2 3 4 5 6 1 chunk +3 lines, -0 lines 0 comments Download
M chrome/browser/extensions/extension_tabs_module.cc View 1 2 3 4 5 6 3 chunks +83 lines, -0 lines 0 comments Download
M chrome/browser/extensions/extension_tabs_module_constants.h View 1 2 3 4 5 6 2 chunks +3 lines, -0 lines 0 comments Download
M chrome/browser/extensions/extension_tabs_module_constants.cc View 1 2 3 4 5 6 2 chunks +4 lines, -0 lines 0 comments Download
M chrome/common/common_resources.grd View 1 chunk +1 line, -1 line 0 comments Download
M chrome/common/extensions/api/extension_api.json View 1 2 3 4 5 6 7 1 chunk +12 lines, -0 lines 0 comments Download
M chrome/common/extensions/docs/tabs.html View 1 chunk +1 line, -1 line 0 comments Download
M chrome/renderer/extensions/extension_api_client_unittest.cc View 1 2 3 4 5 6 1 chunk +12 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/samples/screenshot/manifest.json View 1 2 3 4 5 6 1 chunk +9 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/samples/screenshot/screenshot.html View 1 chunk +14 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/samples/screenshot/screenshot.js View 1 2 3 4 5 6 1 chunk +23 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/samples/screenshot/toolstrip.html View 1 chunk +10 lines, -0 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
rafaelw
I've taken over this patch from Adam. I've reviewed the comment history of the original ...
11 years, 4 months ago (2009-07-28 01:05:26 UTC) #1
omattos
Have you considered instead of returning a Data: URL, you could return an ImageData object. ...
11 years, 4 months ago (2009-07-28 13:06:33 UTC) #2
rafaelw
I'd like to know whether Aaron, Darin & Brett are LGTM on the this patch, ...
11 years, 4 months ago (2009-07-30 17:45:20 UTC) #3
Aaron Boodman
lgtm, w/ nits http://codereview.chromium.org/160228/diff/1024/14 File chrome/browser/extensions/extension_tabs_module.cc (right): http://codereview.chromium.org/160228/diff/1024/14#newcode671 Line 671: NOTIMPLEMENTED(); I think we should ...
11 years, 4 months ago (2009-07-30 18:18:52 UTC) #4
darin (slow to review)
I defer to Aaron.-Darin On Thu, Jul 30, 2009 at 10:45 AM, <rafaelw@chromium.org> wrote: > ...
11 years, 4 months ago (2009-07-30 19:14:51 UTC) #5
rafaelw
11 years, 4 months ago (2009-08-13 00:35:58 UTC) #6
I had to allow the extension_tabs_module to call GetBackingStore with
force=false. Force=true was causing a crash if the called before the page was
properly setup.

This means that the getVisibleTabCapture() can error if called to early when a
tab opens.

http://codereview.chromium.org/160228/diff/1024/14
File chrome/browser/extensions/extension_tabs_module.cc (right):

http://codereview.chromium.org/160228/diff/1024/14#newcode671
Line 671: NOTIMPLEMENTED();
On 2009/07/30 18:18:53, Aaron Boodman wrote:
> I think we should return an error to the caller in the case of not being
> implemented on other platforms.

Done.

http://codereview.chromium.org/160228/diff/1024/14#newcode671
Line 671: NOTIMPLEMENTED();
On 2009/07/30 18:18:53, Aaron Boodman wrote:
> What is the timeline for implementing this on other platforms? Do we know how
to
> do it? I don't want to have windows-only APIs.

The plan is to implement on linux & mac when time allows. (Hopefully the
platform-specific changes will be small).

http://codereview.chromium.org/160228/diff/1024/18
File chrome/common/extensions/api/extension_api.json (right):

http://codereview.chromium.org/160228/diff/1024/18#newcode332
Line 332: name: "getVisibleTabCapture",
On 2009/07/30 18:18:53, Aaron Boodman wrote:
> Can we change this to captureVisibleTab()?

Done.

Powered by Google App Engine
This is Rietveld 408576698