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

Side by Side Diff: webkit/glue/media/simple_data_source.cc

Issue 7205011: Revert 89532 - Not allow compression when requesting multimedia (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 6 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
« no previous file with comments | « webkit/glue/media/buffered_resource_loader_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "webkit/glue/media/simple_data_source.h" 5 #include "webkit/glue/media/simple_data_source.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/process_util.h" 8 #include "base/process_util.h"
9 #include "media/base/filter_host.h" 9 #include "media/base/filter_host.h"
10 #include "net/base/data_url.h" 10 #include "net/base/data_url.h"
11 #include "net/base/load_flags.h" 11 #include "net/base/load_flags.h"
12 #include "net/http/http_request_headers.h"
13 #include "net/url_request/url_request_status.h" 12 #include "net/url_request/url_request_status.h"
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h"
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKitClient.h" 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKitClient.h"
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h"
17 #include "webkit/glue/media/web_data_source_factory.h" 15 #include "webkit/glue/media/web_data_source_factory.h"
18 #include "webkit/glue/webkit_glue.h" 16 #include "webkit/glue/webkit_glue.h"
19 17
20 using WebKit::WebString;
21
22 namespace webkit_glue { 18 namespace webkit_glue {
23 19
24 static const char kDataScheme[] = "data"; 20 static const char kDataScheme[] = "data";
25 21
26 static WebDataSource* NewSimpleDataSource(MessageLoop* render_loop, 22 static WebDataSource* NewSimpleDataSource(MessageLoop* render_loop,
27 WebKit::WebFrame* frame) { 23 WebKit::WebFrame* frame) {
28 return new SimpleDataSource(render_loop, frame); 24 return new SimpleDataSource(render_loop, frame);
29 } 25 }
30 26
31 // static 27 // static
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 // Don't care about the mime-type just proceed if decoding was successful. 293 // Don't care about the mime-type just proceed if decoding was successful.
298 size_ = data_.length(); 294 size_ = data_.length();
299 DoneInitialization_Locked(success); 295 DoneInitialization_Locked(success);
300 } else { 296 } else {
301 // Prepare the request. 297 // Prepare the request.
302 WebKit::WebURLRequest request(url_); 298 WebKit::WebURLRequest request(url_);
303 request.setTargetType(WebKit::WebURLRequest::TargetIsMedia); 299 request.setTargetType(WebKit::WebURLRequest::TargetIsMedia);
304 300
305 frame_->setReferrerForRequest(request, WebKit::WebURL()); 301 frame_->setReferrerForRequest(request, WebKit::WebURL());
306 302
307 // Disable compression, compression for audio/video doesn't make sense...
308 request.setHTTPHeaderField(
309 WebString::fromUTF8(net::HttpRequestHeaders::kAcceptEncoding),
310 WebString::fromUTF8("identity;q=1, *;q=0"));
311
312 // This flag is for unittests as we don't want to reset |url_loader| 303 // This flag is for unittests as we don't want to reset |url_loader|
313 if (!keep_test_loader_) 304 if (!keep_test_loader_)
314 url_loader_.reset(frame_->createAssociatedURLLoader()); 305 url_loader_.reset(frame_->createAssociatedURLLoader());
315 306
316 // Start the resource loading. 307 // Start the resource loading.
317 url_loader_->loadAsynchronously(request, this); 308 url_loader_->loadAsynchronously(request, this);
318 } 309 }
319 } 310 }
320 } 311 }
321 312
(...skipping 30 matching lines...) Expand all
352 void SimpleDataSource::UpdateHostState() { 343 void SimpleDataSource::UpdateHostState() {
353 if (host()) { 344 if (host()) {
354 host()->SetTotalBytes(size_); 345 host()->SetTotalBytes(size_);
355 host()->SetBufferedBytes(size_); 346 host()->SetBufferedBytes(size_);
356 // If scheme is file or data, say we are loaded. 347 // If scheme is file or data, say we are loaded.
357 host()->SetLoaded(url_.SchemeIsFile() || url_.SchemeIs(kDataScheme)); 348 host()->SetLoaded(url_.SchemeIsFile() || url_.SchemeIs(kDataScheme));
358 } 349 }
359 } 350 }
360 351
361 } // namespace webkit_glue 352 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « webkit/glue/media/buffered_resource_loader_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698