| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 if (test_loader_) { | 51 if (test_loader_) { |
| 52 loader = test_loader_.Pass(); | 52 loader = test_loader_.Pass(); |
| 53 } else { | 53 } else { |
| 54 WebURLLoaderOptions options; | 54 WebURLLoaderOptions options; |
| 55 if (cors_mode_ == blink::WebMediaPlayer::CORSModeUnspecified) { | 55 if (cors_mode_ == blink::WebMediaPlayer::CORSModeUnspecified) { |
| 56 options.allowCredentials = true; | 56 options.allowCredentials = true; |
| 57 options.crossOriginRequestPolicy = | 57 options.crossOriginRequestPolicy = |
| 58 WebURLLoaderOptions::CrossOriginRequestPolicyAllow; | 58 WebURLLoaderOptions::CrossOriginRequestPolicyAllow; |
| 59 } else { | 59 } else { |
| 60 options.exposeAllResponseHeaders = true; | 60 options.exposeAllResponseHeaders = true; |
| 61 // The author header set is empty, no preflight should go ahead. |
| 62 options.preflightPolicy = WebURLLoaderOptions::PreventPreflight; |
| 61 options.crossOriginRequestPolicy = | 63 options.crossOriginRequestPolicy = |
| 62 WebURLLoaderOptions::CrossOriginRequestPolicyUseAccessControl; | 64 WebURLLoaderOptions::CrossOriginRequestPolicyUseAccessControl; |
| 63 if (cors_mode_ == blink::WebMediaPlayer::CORSModeUseCredentials) | 65 if (cors_mode_ == blink::WebMediaPlayer::CORSModeUseCredentials) |
| 64 options.allowCredentials = true; | 66 options.allowCredentials = true; |
| 65 } | 67 } |
| 66 loader.reset(frame->createAssociatedURLLoader(options)); | 68 loader.reset(frame->createAssociatedURLLoader(options)); |
| 67 } | 69 } |
| 68 | 70 |
| 69 // Start the resource loading. | 71 // Start the resource loading. |
| 70 loader->loadAsynchronously(request, this); | 72 loader->loadAsynchronously(request, this); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 | 179 |
| 178 void MediaInfoLoader::DidBecomeReady(Status status) { | 180 void MediaInfoLoader::DidBecomeReady(Status status) { |
| 179 UMA_HISTOGRAM_TIMES("Media.InfoLoadDelay", | 181 UMA_HISTOGRAM_TIMES("Media.InfoLoadDelay", |
| 180 base::TimeTicks::Now() - start_time_); | 182 base::TimeTicks::Now() - start_time_); |
| 181 active_loader_.reset(); | 183 active_loader_.reset(); |
| 182 if (!ready_cb_.is_null()) | 184 if (!ready_cb_.is_null()) |
| 183 base::ResetAndReturn(&ready_cb_).Run(status); | 185 base::ResetAndReturn(&ready_cb_).Run(status); |
| 184 } | 186 } |
| 185 | 187 |
| 186 } // namespace content | 188 } // namespace content |
| OLD | NEW |