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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 void MediaInfoLoader::didReceiveResponse( | 119 void MediaInfoLoader::didReceiveResponse( |
120 WebURLLoader* loader, | 120 WebURLLoader* loader, |
121 const WebURLResponse& response) { | 121 const WebURLResponse& response) { |
122 DVLOG(1) << "didReceiveResponse: HTTP/" | 122 DVLOG(1) << "didReceiveResponse: HTTP/" |
123 << (response.httpVersion() == WebURLResponse::HTTP_0_9 ? "0.9" : | 123 << (response.httpVersion() == WebURLResponse::HTTP_0_9 ? "0.9" : |
124 response.httpVersion() == WebURLResponse::HTTP_1_0 ? "1.0" : | 124 response.httpVersion() == WebURLResponse::HTTP_1_0 ? "1.0" : |
125 response.httpVersion() == WebURLResponse::HTTP_1_1 ? "1.1" : | 125 response.httpVersion() == WebURLResponse::HTTP_1_1 ? "1.1" : |
126 "Unknown") | 126 "Unknown") |
127 << " " << response.httpStatusCode(); | 127 << " " << response.httpStatusCode(); |
128 DCHECK(active_loader_.get()); | 128 DCHECK(active_loader_.get()); |
129 if (!url_.SchemeIs("http") && !url_.SchemeIs("https")) { | 129 if (!url_.SchemeIs(url::kHttpScheme) && !url_.SchemeIs(url::kHttpsScheme)) { |
130 DidBecomeReady(kOk); | 130 DidBecomeReady(kOk); |
131 return; | 131 return; |
132 } | 132 } |
133 if (response.httpStatusCode() == kHttpOK || | 133 if (response.httpStatusCode() == kHttpOK || |
134 response.httpStatusCode() == kHttpPartialContentOK) { | 134 response.httpStatusCode() == kHttpPartialContentOK) { |
135 DidBecomeReady(kOk); | 135 DidBecomeReady(kOk); |
136 return; | 136 return; |
137 } | 137 } |
138 loader_failed_ = true; | 138 loader_failed_ = true; |
139 DidBecomeReady(kFailed); | 139 DidBecomeReady(kFailed); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 void MediaInfoLoader::DidBecomeReady(Status status) { | 201 void MediaInfoLoader::DidBecomeReady(Status status) { |
202 UMA_HISTOGRAM_TIMES("Media.InfoLoadDelay", | 202 UMA_HISTOGRAM_TIMES("Media.InfoLoadDelay", |
203 base::TimeTicks::Now() - start_time_); | 203 base::TimeTicks::Now() - start_time_); |
204 active_loader_.reset(); | 204 active_loader_.reset(); |
205 if (!ready_cb_.is_null()) | 205 if (!ready_cb_.is_null()) |
206 base::ResetAndReturn(&ready_cb_).Run(status, url_, first_party_url_, | 206 base::ResetAndReturn(&ready_cb_).Run(status, url_, first_party_url_, |
207 allow_stored_credentials_); | 207 allow_stored_credentials_); |
208 } | 208 } |
209 | 209 |
210 } // namespace content | 210 } // namespace content |
OLD | NEW |