Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(881)

Side by Side Diff: content/browser/download/download_item_impl.cc

Issue 2653833002: Fix an issue that download may missing MIME type if it failed ealier (Closed)
Patch Set: fix DCHECK Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/download/download_item_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // File method ordering: Methods in this file are in the same order as 5 // File method ordering: Methods in this file are in the same order as
6 // in download_item_impl.h, with the following exception: The public 6 // in download_item_impl.h, with the following exception: The public
7 // interface Start is placed in chronological order with the other 7 // interface Start is placed in chronological order with the other
8 // (private) routines that together define a DownloadItem's state 8 // (private) routines that together define a DownloadItem's state
9 // transitions as the download progresses. See "Download progression 9 // transitions as the download progresses. See "Download progression
10 // cascade" later in this file. 10 // cascade" later in this file.
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 origin_state |= ORIGIN_STATE_ON_RESUMPTION_VALIDATORS_CHANGED; 988 origin_state |= ORIGIN_STATE_ON_RESUMPTION_VALIDATORS_CHANGED;
989 if (content_disposition_ != new_create_info.content_disposition) 989 if (content_disposition_ != new_create_info.content_disposition)
990 origin_state |= ORIGIN_STATE_ON_RESUMPTION_CONTENT_DISPOSITION_CHANGED; 990 origin_state |= ORIGIN_STATE_ON_RESUMPTION_CONTENT_DISPOSITION_CHANGED;
991 RecordOriginStateOnResumption(received_bytes_ != 0, origin_state); 991 RecordOriginStateOnResumption(received_bytes_ != 0, origin_state);
992 992
993 url_chain_.insert( 993 url_chain_.insert(
994 url_chain_.end(), chain_iter, new_create_info.url_chain.end()); 994 url_chain_.end(), chain_iter, new_create_info.url_chain.end());
995 etag_ = new_create_info.etag; 995 etag_ = new_create_info.etag;
996 last_modified_time_ = new_create_info.last_modified; 996 last_modified_time_ = new_create_info.last_modified;
997 content_disposition_ = new_create_info.content_disposition; 997 content_disposition_ = new_create_info.content_disposition;
998 // It is possible that the previous download attempt failed right before the
999 // response is received. Need to reset the MIME type.
1000 mime_type_ = new_create_info.mime_type;
998 1001
999 // Don't update observers. This method is expected to be called just before a 1002 // Don't update observers. This method is expected to be called just before a
1000 // DownloadFile is created and Start() is called. The observers will be 1003 // DownloadFile is created and Start() is called. The observers will be
1001 // notified when the download transitions to the IN_PROGRESS state. 1004 // notified when the download transitions to the IN_PROGRESS state.
1002 } 1005 }
1003 1006
1004 void DownloadItemImpl::NotifyRemoved() { 1007 void DownloadItemImpl::NotifyRemoved() {
1005 for (auto& observer : observers_) 1008 for (auto& observer : observers_)
1006 observer.OnDownloadRemoved(this); 1009 observer.OnDownloadRemoved(this);
1007 } 1010 }
(...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after
2117 case RESUME_MODE_USER_CONTINUE: 2120 case RESUME_MODE_USER_CONTINUE:
2118 return "USER_CONTINUE"; 2121 return "USER_CONTINUE";
2119 case RESUME_MODE_USER_RESTART: 2122 case RESUME_MODE_USER_RESTART:
2120 return "USER_RESTART"; 2123 return "USER_RESTART";
2121 } 2124 }
2122 NOTREACHED() << "Unknown resume mode " << mode; 2125 NOTREACHED() << "Unknown resume mode " << mode;
2123 return "unknown"; 2126 return "unknown";
2124 } 2127 }
2125 2128
2126 } // namespace content 2129 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/download/download_item_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698