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

Side by Side Diff: content/renderer/media/buffered_resource_loader.cc

Issue 254763005: Move some content url constants to /url. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and address some style nits. Created 6 years, 7 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/renderer/media/buffered_resource_loader.h" 5 #include "content/renderer/media/buffered_resource_loader.h"
6 6
7 #include "base/bits.h" 7 #include "base/bits.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "content/public/common/url_constants.h" 12 #include "content/public/common/url_constants.h"
13 #include "content/renderer/media/cache_util.h" 13 #include "content/renderer/media/cache_util.h"
14 #include "media/base/media_log.h" 14 #include "media/base/media_log.h"
15 #include "net/base/url_constants.h"
15 #include "net/http/http_byte_range.h" 16 #include "net/http/http_byte_range.h"
16 #include "net/http/http_request_headers.h" 17 #include "net/http/http_request_headers.h"
17 #include "third_party/WebKit/public/platform/WebString.h" 18 #include "third_party/WebKit/public/platform/WebString.h"
18 #include "third_party/WebKit/public/platform/WebURLError.h" 19 #include "third_party/WebKit/public/platform/WebURLError.h"
19 #include "third_party/WebKit/public/platform/WebURLResponse.h" 20 #include "third_party/WebKit/public/platform/WebURLResponse.h"
20 #include "third_party/WebKit/public/web/WebKit.h" 21 #include "third_party/WebKit/public/web/WebKit.h"
21 #include "third_party/WebKit/public/web/WebURLLoaderOptions.h" 22 #include "third_party/WebKit/public/web/WebURLLoaderOptions.h"
22 23
23 using blink::WebFrame; 24 using blink::WebFrame;
24 using blink::WebString; 25 using blink::WebString;
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 } 383 }
383 384
384 // Expected content length can be |kPositionNotSpecified|, in that case 385 // Expected content length can be |kPositionNotSpecified|, in that case
385 // |content_length_| is not specified and this is a streaming response. 386 // |content_length_| is not specified and this is a streaming response.
386 content_length_ = response.expectedContentLength(); 387 content_length_ = response.expectedContentLength();
387 388
388 // We make a strong assumption that when we reach here we have either 389 // We make a strong assumption that when we reach here we have either
389 // received a response from HTTP/HTTPS protocol or the request was 390 // received a response from HTTP/HTTPS protocol or the request was
390 // successful (in particular range request). So we only verify the partial 391 // successful (in particular range request). So we only verify the partial
391 // response for HTTP and HTTPS protocol. 392 // response for HTTP and HTTPS protocol.
392 if (url_.SchemeIs(kHttpScheme) || url_.SchemeIs(kHttpsScheme)) { 393 if (url_.SchemeIs(net::kHttpScheme) || url_.SchemeIs(net::kHttpsScheme)) {
393 bool partial_response = (response.httpStatusCode() == kHttpPartialContent); 394 bool partial_response = (response.httpStatusCode() == kHttpPartialContent);
394 bool ok_response = (response.httpStatusCode() == kHttpOK); 395 bool ok_response = (response.httpStatusCode() == kHttpOK);
395 396
396 if (IsRangeRequest()) { 397 if (IsRangeRequest()) {
397 // Check to see whether the server supports byte ranges. 398 // Check to see whether the server supports byte ranges.
398 std::string accept_ranges = 399 std::string accept_ranges =
399 response.httpHeaderField("Accept-Ranges").utf8(); 400 response.httpHeaderField("Accept-Ranges").utf8();
400 range_supported_ = (accept_ranges.find("bytes") != std::string::npos); 401 range_supported_ = (accept_ranges.find("bytes") != std::string::npos);
401 402
402 // If we have verified the partial response and it is correct, we will 403 // If we have verified the partial response and it is correct, we will
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 778
778 void BufferedResourceLoader::Log() { 779 void BufferedResourceLoader::Log() {
779 media_log_->AddEvent( 780 media_log_->AddEvent(
780 media_log_->CreateBufferedExtentsChangedEvent( 781 media_log_->CreateBufferedExtentsChangedEvent(
781 offset_ - buffer_.backward_bytes(), 782 offset_ - buffer_.backward_bytes(),
782 offset_, 783 offset_,
783 offset_ + buffer_.forward_bytes())); 784 offset_ + buffer_.forward_bytes()));
784 } 785 }
785 786
786 } // namespace content 787 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698