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 // File method ordering: Methods in this file are in the same order | 5 // File method ordering: Methods in this file are in the same order |
6 // as in download_item_impl.h, with the following exception: The public | 6 // as in download_item_impl.h, with the following exception: The public |
7 // interfaces DelayedDownloadOpened, OnDownloadTargetDetermined, and | 7 // interfaces DelayedDownloadOpened, OnDownloadTargetDetermined, and |
8 // OnDownloadCompleting are placed in chronological order with the other | 8 // OnDownloadCompleting are placed in chronological order with the other |
9 // (private) routines that together define a DownloadItem's state transitions | 9 // (private) routines that together define a DownloadItem's state transitions |
10 // as the download progresses. See "Download progression cascade" later in | 10 // as the download progresses. See "Download progression cascade" later in |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 file_externally_removed_(false), | 153 file_externally_removed_(false), |
154 safety_state_(SAFE), | 154 safety_state_(SAFE), |
155 auto_opened_(false), | 155 auto_opened_(false), |
156 is_persisted_(true), | 156 is_persisted_(true), |
157 is_temporary_(false), | 157 is_temporary_(false), |
158 all_data_saved_(false), | 158 all_data_saved_(false), |
159 opened_(info.opened), | 159 opened_(info.opened), |
160 open_enabled_(true), | 160 open_enabled_(true), |
161 delegate_delayed_complete_(false), | 161 delegate_delayed_complete_(false), |
162 bound_net_log_(bound_net_log), | 162 bound_net_log_(bound_net_log), |
| 163 should_show_in_downloads_ui_(true), |
163 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) { | 164 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) { |
164 delegate_->Attach(); | 165 delegate_->Attach(); |
165 if (state_ == IN_PROGRESS_INTERNAL) | 166 if (state_ == IN_PROGRESS_INTERNAL) |
166 state_ = CANCELLED_INTERNAL; | 167 state_ = CANCELLED_INTERNAL; |
167 if (state_ == COMPLETE_INTERNAL) | 168 if (state_ == COMPLETE_INTERNAL) |
168 all_data_saved_ = true; | 169 all_data_saved_ = true; |
169 Init(false /* not actively downloading */, | 170 Init(false /* not actively downloading */, |
170 download_net_logs::SRC_HISTORY_IMPORT); | 171 download_net_logs::SRC_HISTORY_IMPORT); |
171 } | 172 } |
172 | 173 |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 WebContents* DownloadItemImpl::GetWebContents() const { | 703 WebContents* DownloadItemImpl::GetWebContents() const { |
703 // TODO(rdsmith): Remove null check after removing GetWebContents() from | 704 // TODO(rdsmith): Remove null check after removing GetWebContents() from |
704 // paths that might be used by DownloadItems created from history import. | 705 // paths that might be used by DownloadItems created from history import. |
705 // Currently such items have null request_handle_s, where other items | 706 // Currently such items have null request_handle_s, where other items |
706 // (regular and SavePackage downloads) have actual objects off the pointer. | 707 // (regular and SavePackage downloads) have actual objects off the pointer. |
707 if (request_handle_.get()) | 708 if (request_handle_.get()) |
708 return request_handle_->GetWebContents(); | 709 return request_handle_->GetWebContents(); |
709 return NULL; | 710 return NULL; |
710 } | 711 } |
711 | 712 |
| 713 void DownloadItemImpl::SetShouldShowInDownloadsUI(bool should_show) { |
| 714 should_show_in_downloads_ui_ = should_show; |
| 715 } |
| 716 |
| 717 bool DownloadItemImpl::ShouldShowInDownloadsUI() const { |
| 718 return should_show_in_downloads_ui_; |
| 719 } |
| 720 |
712 void DownloadItemImpl::OnContentCheckCompleted( | 721 void DownloadItemImpl::OnContentCheckCompleted( |
713 content::DownloadDangerType danger_type) { | 722 content::DownloadDangerType danger_type) { |
714 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 723 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
715 DCHECK(AllDataSaved()); | 724 DCHECK(AllDataSaved()); |
716 SetDangerType(danger_type); | 725 SetDangerType(danger_type); |
717 UpdateObservers(); | 726 UpdateObservers(); |
718 } | 727 } |
719 | 728 |
720 void DownloadItemImpl::SetOpenWhenComplete(bool open) { | 729 void DownloadItemImpl::SetOpenWhenComplete(bool open) { |
721 open_when_complete_ = open; | 730 open_when_complete_ = open; |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1281 return "COMPLETE"; | 1290 return "COMPLETE"; |
1282 case CANCELLED_INTERNAL: | 1291 case CANCELLED_INTERNAL: |
1283 return "CANCELLED"; | 1292 return "CANCELLED"; |
1284 case INTERRUPTED_INTERNAL: | 1293 case INTERRUPTED_INTERNAL: |
1285 return "INTERRUPTED"; | 1294 return "INTERRUPTED"; |
1286 default: | 1295 default: |
1287 NOTREACHED() << "Unknown download state " << state; | 1296 NOTREACHED() << "Unknown download state " << state; |
1288 return "unknown"; | 1297 return "unknown"; |
1289 }; | 1298 }; |
1290 } | 1299 } |
OLD | NEW |