OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser/download/download_resource_handler.h" | 5 #include "content/browser/download/download_resource_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 if (status.status() == net::URLRequestStatus::CANCELED && | 373 if (status.status() == net::URLRequestStatus::CANCELED && |
374 status.error() == net::ERR_ABORTED) { | 374 status.error() == net::ERR_ABORTED) { |
375 // CANCELED + ERR_ABORTED == something outside of the network | 375 // CANCELED + ERR_ABORTED == something outside of the network |
376 // stack cancelled the request. There aren't that many things that | 376 // stack cancelled the request. There aren't that many things that |
377 // could do this to a download request (whose lifetime is separated from | 377 // could do this to a download request (whose lifetime is separated from |
378 // the tab from which it came). We map this to USER_CANCELLED as the | 378 // the tab from which it came). We map this to USER_CANCELLED as the |
379 // case we know about (system suspend because of laptop close) corresponds | 379 // case we know about (system suspend because of laptop close) corresponds |
380 // to a user action. | 380 // to a user action. |
381 // TODO(ahendrickson) -- Find a better set of codes to use here, as | 381 // TODO(ahendrickson) -- Find a better set of codes to use here, as |
382 // CANCELED/ERR_ABORTED can occur for reasons other than user cancel. | 382 // CANCELED/ERR_ABORTED can occur for reasons other than user cancel. |
383 if (net::IsCertStatusError(request()->ssl_info().cert_status)) | 383 if (net::IsCertStatusError(request()->ssl_info().cert_status) && |
| 384 !net::IsCertStatusMinorError(request()->ssl_info().cert_status)) { |
384 reason = DOWNLOAD_INTERRUPT_REASON_SERVER_CERT_PROBLEM; | 385 reason = DOWNLOAD_INTERRUPT_REASON_SERVER_CERT_PROBLEM; |
385 else | 386 } else { |
386 reason = DOWNLOAD_INTERRUPT_REASON_USER_CANCELED; | 387 reason = DOWNLOAD_INTERRUPT_REASON_USER_CANCELED; |
| 388 } |
387 } | 389 } |
388 | 390 |
389 if (status.is_success() && | 391 if (status.is_success() && |
390 reason == DOWNLOAD_INTERRUPT_REASON_NONE && | 392 reason == DOWNLOAD_INTERRUPT_REASON_NONE && |
391 request()->response_headers()) { | 393 request()->response_headers()) { |
392 // Handle server's response codes. | 394 // Handle server's response codes. |
393 switch(response_code) { | 395 switch(response_code) { |
394 case -1: // Non-HTTP request. | 396 case -1: // Non-HTTP request. |
395 case net::HTTP_OK: | 397 case net::HTTP_OK: |
396 case net::HTTP_CREATED: | 398 case net::HTTP_CREATED: |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 // tab_info_ must be destroyed on UI thread, since | 534 // tab_info_ must be destroyed on UI thread, since |
533 // InitializeDownloadTabInfoOnUIThread might still be using it. | 535 // InitializeDownloadTabInfoOnUIThread might still be using it. |
534 if (tab_info_) | 536 if (tab_info_) |
535 BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, tab_info_); | 537 BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, tab_info_); |
536 | 538 |
537 UMA_HISTOGRAM_TIMES("SB2.DownloadDuration", | 539 UMA_HISTOGRAM_TIMES("SB2.DownloadDuration", |
538 base::TimeTicks::Now() - download_start_time_); | 540 base::TimeTicks::Now() - download_start_time_); |
539 } | 541 } |
540 | 542 |
541 } // namespace content | 543 } // namespace content |
OLD | NEW |