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( | 93 void MediaInfoLoader::willFollowRedirect(WebURLLoader* loader, |
94 WebURLLoader* loader, | 94 WebURLRequest& newRequest, |
95 WebURLRequest& newRequest, | 95 const WebURLResponse& redirectResponse, |
96 const WebURLResponse& redirectResponse) { | 96 int64_t encodedDataLength) { |
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 } | 138 } |
139 if (response.httpStatusCode() == kHttpOK || | 139 if (response.httpStatusCode() == kHttpOK || |
140 response.httpStatusCode() == kHttpPartialContentOK) { | 140 response.httpStatusCode() == kHttpPartialContentOK) { |
141 DidBecomeReady(kOk); | 141 DidBecomeReady(kOk); |
142 return; | 142 return; |
143 } | 143 } |
144 loader_failed_ = true; | 144 loader_failed_ = true; |
145 DidBecomeReady(kFailed); | 145 DidBecomeReady(kFailed); |
146 } | 146 } |
147 | 147 |
148 void MediaInfoLoader::didReceiveData( | 148 void MediaInfoLoader::didReceiveData(WebURLLoader* loader, |
149 WebURLLoader* loader, | 149 const char* data, |
150 const char* data, | 150 int data_length, |
151 int data_length, | 151 int encoded_data_length, |
152 int encoded_data_length) { | 152 int encoded_body_length) { |
153 // Ignored. | 153 // Ignored. |
154 } | 154 } |
155 | 155 |
156 void MediaInfoLoader::didDownloadData( | 156 void MediaInfoLoader::didDownloadData( |
157 blink::WebURLLoader* loader, | 157 blink::WebURLLoader* loader, |
158 int dataLength, | 158 int dataLength, |
159 int encodedDataLength) { | 159 int encodedDataLength) { |
160 NOTIMPLEMENTED(); | 160 NOTIMPLEMENTED(); |
161 } | 161 } |
162 | 162 |
(...skipping 44 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 |