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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bits.h" | 9 #include "base/bits.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 loader.reset(frame->createAssociatedURLLoader(options)); | 83 loader.reset(frame->createAssociatedURLLoader(options)); |
84 } | 84 } |
85 | 85 |
86 // Start the resource loading. | 86 // Start the resource loading. |
87 loader->loadAsynchronously(request, this); | 87 loader->loadAsynchronously(request, this); |
88 active_loader_.reset(new media::ActiveLoader(std::move(loader))); | 88 active_loader_.reset(new media::ActiveLoader(std::move(loader))); |
89 } | 89 } |
90 | 90 |
91 ///////////////////////////////////////////////////////////////////////////// | 91 ///////////////////////////////////////////////////////////////////////////// |
92 // blink::WebURLLoaderClient implementation. | 92 // blink::WebURLLoaderClient implementation. |
93 void MediaInfoLoader::willFollowRedirect(WebURLLoader* loader, | 93 void MediaInfoLoader::willFollowRedirect( |
94 WebURLRequest& newRequest, | 94 WebURLLoader* loader, |
95 const WebURLResponse& redirectResponse, | 95 WebURLRequest& newRequest, |
96 int64_t encodedDataLength) { | 96 const WebURLResponse& redirectResponse) { |
97 // The load may have been stopped and |ready_cb| is destroyed. | 97 // The load may have been stopped and |ready_cb| is destroyed. |
98 // In this case we shouldn't do anything. | 98 // In this case we shouldn't do anything. |
99 if (ready_cb_.is_null()) { | 99 if (ready_cb_.is_null()) { |
100 // Set the url in the request to an invalid value (empty url). | 100 // Set the url in the request to an invalid value (empty url). |
101 newRequest.setURL(blink::WebURL()); | 101 newRequest.setURL(blink::WebURL()); |
102 return; | 102 return; |
103 } | 103 } |
104 | 104 |
105 // Only allow |single_origin_| if we haven't seen a different origin yet. | 105 // Only allow |single_origin_| if we haven't seen a different origin yet. |
106 if (single_origin_) | 106 if (single_origin_) |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 void MediaInfoLoader::DidBecomeReady(Status status) { | 207 void MediaInfoLoader::DidBecomeReady(Status status) { |
208 UMA_HISTOGRAM_TIMES("Media.InfoLoadDelay", | 208 UMA_HISTOGRAM_TIMES("Media.InfoLoadDelay", |
209 base::TimeTicks::Now() - start_time_); | 209 base::TimeTicks::Now() - start_time_); |
210 active_loader_.reset(); | 210 active_loader_.reset(); |
211 if (!ready_cb_.is_null()) | 211 if (!ready_cb_.is_null()) |
212 base::ResetAndReturn(&ready_cb_).Run(status, url_, first_party_url_, | 212 base::ResetAndReturn(&ready_cb_).Run(status, url_, first_party_url_, |
213 allow_stored_credentials_); | 213 allow_stored_credentials_); |
214 } | 214 } |
215 | 215 |
216 } // namespace content | 216 } // namespace content |
OLD | NEW |