OLD | NEW |
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/android/media_info_loader.h" | 5 #include "content/renderer/media/android/media_info_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 "third_party/WebKit/public/platform/WebURLError.h" | 10 #include "third_party/WebKit/public/platform/WebURLError.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 | 37 |
38 void MediaInfoLoader::Start(blink::WebFrame* frame) { | 38 void MediaInfoLoader::Start(blink::WebFrame* frame) { |
39 // Make sure we have not started. | 39 // Make sure we have not started. |
40 DCHECK(!ready_cb_.is_null()); | 40 DCHECK(!ready_cb_.is_null()); |
41 CHECK(frame); | 41 CHECK(frame); |
42 | 42 |
43 start_time_ = base::TimeTicks::Now(); | 43 start_time_ = base::TimeTicks::Now(); |
44 | 44 |
45 // Prepare the request. | 45 // Prepare the request. |
46 WebURLRequest request(url_); | 46 WebURLRequest request(url_); |
47 request.setTargetType(WebURLRequest::TargetIsMedia); | 47 // TODO(mkwst): Split this into video/audio. |
| 48 request.setRequestContext(WebURLRequest::RequestContextVideo); |
48 frame->setReferrerForRequest(request, blink::WebURL()); | 49 frame->setReferrerForRequest(request, blink::WebURL()); |
49 | 50 |
50 scoped_ptr<WebURLLoader> loader; | 51 scoped_ptr<WebURLLoader> loader; |
51 if (test_loader_) { | 52 if (test_loader_) { |
52 loader = test_loader_.Pass(); | 53 loader = test_loader_.Pass(); |
53 } else { | 54 } else { |
54 WebURLLoaderOptions options; | 55 WebURLLoaderOptions options; |
55 if (cors_mode_ == blink::WebMediaPlayer::CORSModeUnspecified) { | 56 if (cors_mode_ == blink::WebMediaPlayer::CORSModeUnspecified) { |
56 options.allowCredentials = true; | 57 options.allowCredentials = true; |
57 options.crossOriginRequestPolicy = | 58 options.crossOriginRequestPolicy = |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 | 185 |
185 void MediaInfoLoader::DidBecomeReady(Status status) { | 186 void MediaInfoLoader::DidBecomeReady(Status status) { |
186 UMA_HISTOGRAM_TIMES("Media.InfoLoadDelay", | 187 UMA_HISTOGRAM_TIMES("Media.InfoLoadDelay", |
187 base::TimeTicks::Now() - start_time_); | 188 base::TimeTicks::Now() - start_time_); |
188 active_loader_.reset(); | 189 active_loader_.reset(); |
189 if (!ready_cb_.is_null()) | 190 if (!ready_cb_.is_null()) |
190 base::ResetAndReturn(&ready_cb_).Run(status); | 191 base::ResetAndReturn(&ready_cb_).Run(status); |
191 } | 192 } |
192 | 193 |
193 } // namespace content | 194 } // namespace content |
OLD | NEW |