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

Issue 12212031: Add support for redirecting ResourceHandlers to a blob: URL (Closed)

Created:
7 years, 10 months ago by Zachary Kuznia
Modified:
7 years, 4 months ago
CC:
chromium-reviews, nkostylev+watch_chromium.org, jam, joi+watch-content_chromium.org, Aaron Boodman, rginda+watch_chromium.org, darin-cc_chromium.org, oshima+watch_chromium.org, chromium-apps-reviews_chromium.org, stevenjb+watch_chromium.org, davemoore+watch_chromium.org
Base URL:
http://git.chromium.org/chromium/src.git@master
Visibility:
Public.

Description

Add support for redirecting ResourceHandlers to a blob: URL This allows us to redirect a connection to a source that can be read from an extension that has been registered as a mime type handler. BUG=171585

Patch Set 1 #

Patch Set 2 : Rebase #

Total comments: 14

Patch Set 3 : Code review fixes #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1170 lines, -48 lines) Patch
M chrome/browser/chromeos/extensions/file_browser_resource_throttle.cc View 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/chromeos/extensions/file_browser_resource_throttle_browsertest.cc View 1 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.h View 1 chunk +11 lines, -0 lines 0 comments Download
M chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc View 1 7 chunks +161 lines, -0 lines 0 comments Download
M chrome/common/extensions/api/file_browser_handler.json View 1 chunk +5 lines, -0 lines 0 comments Download
M chrome/test/data/extensions/api_test/file_browser/handle_mime_type/background.js View 1 chunk +1 line, -1 line 0 comments Download
M content/browser/loader/buffered_resource_handler.cc View 1 2 2 chunks +31 lines, -0 lines 0 comments Download
M content/browser/loader/resource_dispatcher_host_impl.cc View 1 2 chunks +2 lines, -0 lines 0 comments Download
M content/browser/loader/resource_handler.h View 1 chunk +1 line, -2 lines 0 comments Download
M content/browser/loader/resource_loader.cc View 1 1 chunk +1 line, -1 line 0 comments Download
M content/browser/loader/resource_request_info_impl.h View 3 chunks +6 lines, -0 lines 0 comments Download
M content/browser/loader/resource_request_info_impl.cc View 3 chunks +3 lines, -0 lines 0 comments Download
A + content/browser/loader/stream_resource_handler.h View 1 2 3 chunks +16 lines, -41 lines 0 comments Download
A content/browser/loader/stream_resource_handler.cc View 1 2 1 chunk +113 lines, -0 lines 0 comments Download
M content/browser/resource_context_impl.h View 1 2 2 chunks +4 lines, -0 lines 0 comments Download
M content/browser/resource_context_impl.cc View 1 2 4 chunks +14 lines, -0 lines 0 comments Download
M content/browser/storage_partition_impl_map.cc View 1 2 6 chunks +28 lines, -3 lines 0 comments Download
A content/browser/streams/stream.h View 1 2 1 chunk +97 lines, -0 lines 0 comments Download
A content/browser/streams/stream.cc View 1 2 1 chunk +124 lines, -0 lines 0 comments Download
A content/browser/streams/stream_context.h View 1 2 1 chunk +58 lines, -0 lines 0 comments Download
A content/browser/streams/stream_context.cc View 1 2 1 chunk +52 lines, -0 lines 0 comments Download
A content/browser/streams/stream_read_observer.h View 1 2 1 chunk +27 lines, -0 lines 0 comments Download
A content/browser/streams/stream_registry.h View 1 2 1 chunk +42 lines, -0 lines 0 comments Download
A content/browser/streams/stream_registry.cc View 1 2 1 chunk +44 lines, -0 lines 0 comments Download
A content/browser/streams/stream_url_request_job.h View 1 2 1 chunk +60 lines, -0 lines 0 comments Download
A content/browser/streams/stream_url_request_job.cc View 1 2 1 chunk +198 lines, -0 lines 0 comments Download
A content/browser/streams/stream_write_observer.h View 1 2 1 chunk +24 lines, -0 lines 0 comments Download
M content/content_browser.gypi View 1 2 2 chunks +12 lines, -0 lines 0 comments Download
M content/public/browser/resource_dispatcher_host_delegate.h View 1 chunk +16 lines, -0 lines 0 comments Download
M content/public/browser/resource_dispatcher_host_delegate.cc View 1 chunk +17 lines, -0 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
Zachary Kuznia
Hi Darin, This is the updated patch that hooks the Stream up to a blob: ...
7 years, 10 months ago (2013-02-06 12:01:39 UTC) #1
darin (slow to review)
First pass of feedback... sorry again for the delays!! https://codereview.chromium.org/12212031/diff/7003/content/browser/loader/stream_resource_handler.cc File content/browser/loader/stream_resource_handler.cc (right): https://codereview.chromium.org/12212031/diff/7003/content/browser/loader/stream_resource_handler.cc#newcode83 content/browser/loader/stream_resource_handler.cc:83: ...
7 years, 10 months ago (2013-02-13 09:18:12 UTC) #2
Zachary Kuznia
7 years, 10 months ago (2013-02-13 16:37:14 UTC) #3
https://codereview.chromium.org/12212031/diff/7003/content/browser/loader/str...
File content/browser/loader/stream_resource_handler.cc (right):

https://codereview.chromium.org/12212031/diff/7003/content/browser/loader/str...
content/browser/loader/stream_resource_handler.cc:83: if
(stream_->should_defer()) {
On 2013/02/13 09:18:12, darin wrote:
> nit: instead of should_defer(), I'd use a name that is more connected to the
> AddData() method.  You want to ask the question: "Can I add more data?"  So, a
> method name like CanAddData would work.

Done.

https://codereview.chromium.org/12212031/diff/7003/content/browser/resource_c...
File content/browser/resource_context_impl.h (right):

https://codereview.chromium.org/12212031/diff/7003/content/browser/resource_c...
content/browser/resource_context_impl.h:13: class ChromeStreamContext;
On 2013/02/13 09:18:12, darin wrote:
> I see where you got the Chrome* prefix from.  I suspect this may be a
> side-effect of the Blob code originally existing in src/chrome.  I think it
was
> moved into src/content because it is a core feature of the platform.  There is
> probably a TODO to drop the prefix.

bufdo %s/ChromeStream/Stream/g

https://codereview.chromium.org/12212031/diff/7003/content/browser/storage_pa...
File content/browser/storage_partition_impl_map.cc (right):

https://codereview.chromium.org/12212031/diff/7003/content/browser/storage_pa...
content/browser/storage_partition_impl_map.cc:102: } else {
On 2013/02/13 09:18:12, darin wrote:
> nit: no need for else after return.

Done.

https://codereview.chromium.org/12212031/diff/7003/content/browser/streams/ch...
File content/browser/streams/chrome_stream.cc (right):

https://codereview.chromium.org/12212031/diff/7003/content/browser/streams/ch...
content/browser/streams/chrome_stream.cc:52: int buf_size,
On 2013/02/13 09:18:12, darin wrote:
> it feels like there is some redundancy here with ByteStream{Reader,Writer}:
> 
>
https://code.google.com/searchframe#OAMlx_jo-ck/src/content/browser/download/...

Modified this class to use ByteStream.

https://codereview.chromium.org/12212031/diff/7003/content/browser/streams/ch...
File content/browser/streams/chrome_stream.h (right):

https://codereview.chromium.org/12212031/diff/7003/content/browser/streams/ch...
content/browser/streams/chrome_stream.h:23: class ChromeStreamObserver {
On 2013/02/13 09:18:12, darin wrote:
> nit: We don't usually name classes with a Chrome* prefix.  I realize this was
> probably to match the "chrome-stream:" URL scheme we had discussed.
> 
> nit: I recommend creating a separate header file for the *Observer class. 
There
> will be cases where someone will only need to include the Observer interface
> definition in their header file.

Done.

https://codereview.chromium.org/12212031/diff/7003/content/browser/streams/ch...
content/browser/streams/chrome_stream.h:48: void
AddObserver(ChromeStreamObserver* observer);
On 2013/02/13 09:18:12, darin wrote:
> It seems like the observer interface is used both to notify the producer of
data
> that they can add more data as well as to notify the consumer(s) of data that
> they can get more data.  But, given the signature of ReadRawData, I'm not sure
> that this class really supports multiple readers.  Plus, I remember in our
> discussions you said the stream would only have one reader because it was
> intended to be temporary.
> 
> It'd be good to document the intended processing model in this header file.
> 
> I might look at separating the consumer notifications from the producer
> notifications.  It seems potentially awkward to have those notifications
merged
> into a single interface.

Split the observers into StreamReadObserver and StreamWriteObserver.
Moved observers into separate files
Added comments to describe this class

https://codereview.chromium.org/12212031/diff/7003/content/browser/streams/ch...
File content/browser/streams/chrome_stream_registry.cc (right):

https://codereview.chromium.org/12212031/diff/7003/content/browser/streams/ch...
content/browser/streams/chrome_stream_registry.cc:45: void
ChromeStreamRegistry::OnStreamComplete(ChromeStream* stream) {
On 2013/02/13 09:18:12, darin wrote:
> so does OnStreamComplete mean that the stream was fully consumed?  maybe the
> name of this event should be a bit more specific.  OnStreamConsumed?
> 
> however, if you were to do this without the general purpose Observer
interface,
> then it might just make sense to have the Stream class directly call a
function
> on the StreamRegistry to unregister the stream.

Changed to OnStreamConsumed and now this is called directly.

Powered by Google App Engine
This is Rietveld 408576698