 Chromium Code Reviews
 Chromium Code Reviews Issue 209613002:
  Download shelf autohides on showing in shell, just same as regular open 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 209613002:
  Download shelf autohides on showing in shell, just same as regular open 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| Index: content/browser/download/download_item_impl.cc | 
| diff --git a/content/browser/download/download_item_impl.cc b/content/browser/download/download_item_impl.cc | 
| index 0fbd270da05ce3e4bd8dc147d627c55afa3e127d..3bf4648ce85284fb71bafaa3d98fcb4d705b2254 100644 | 
| --- a/content/browser/download/download_item_impl.cc | 
| +++ b/content/browser/download/download_item_impl.cc | 
| @@ -154,6 +154,7 @@ DownloadItemImpl::DownloadItemImpl(DownloadItemImplDelegate* delegate, | 
| all_data_saved_(state == COMPLETE), | 
| destination_error_(content::DOWNLOAD_INTERRUPT_REASON_NONE), | 
| opened_(opened), | 
| + shownWhenComplete_(false), | 
| 
asanka
2014/05/14 18:40:59
Nit: Use hacker_style_.
 
DukeXar
2014/06/06 15:07:13
Removed
 | 
| delegate_delayed_complete_(false), | 
| bound_net_log_(bound_net_log), | 
| weak_ptr_factory_(this) { | 
| @@ -205,6 +206,7 @@ DownloadItemImpl::DownloadItemImpl( | 
| all_data_saved_(false), | 
| destination_error_(content::DOWNLOAD_INTERRUPT_REASON_NONE), | 
| opened_(false), | 
| + shownWhenComplete_(false), | 
| delegate_delayed_complete_(false), | 
| bound_net_log_(bound_net_log), | 
| weak_ptr_factory_(this) { | 
| @@ -260,6 +262,7 @@ DownloadItemImpl::DownloadItemImpl( | 
| all_data_saved_(false), | 
| destination_error_(content::DOWNLOAD_INTERRUPT_REASON_NONE), | 
| opened_(false), | 
| + shownWhenComplete_(false), | 
| delegate_delayed_complete_(false), | 
| bound_net_log_(bound_net_log), | 
| weak_ptr_factory_(this) { | 
| @@ -470,6 +473,16 @@ void DownloadItemImpl::OpenDownload() { | 
| void DownloadItemImpl::ShowDownloadInShell() { | 
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 
| + if (!CanShowInFolder()) | 
| + return; | 
| + | 
| + // Marking the download as shown if it is complete and user opened it | 
| + // in shell | 
| + if (state_ == COMPLETE_INTERNAL) | 
| + shownWhenComplete_ = true; | 
| + | 
| + delegate_->CheckForFileRemoval(this); | 
| + FOR_EACH_OBSERVER(Observer, observers_, OnDownloadShown(this)); | 
| delegate_->ShowDownloadInShell(this); | 
| } | 
| @@ -760,6 +773,10 @@ bool DownloadItemImpl::GetOpened() const { | 
| return opened_; | 
| } | 
| +bool DownloadItemImpl::GetShownWhenComplete() const { | 
| + return shownWhenComplete_; | 
| +} | 
| + | 
| BrowserContext* DownloadItemImpl::GetBrowserContext() const { | 
| return delegate_->GetBrowserContext(); | 
| } | 
| @@ -795,6 +812,10 @@ void DownloadItemImpl::SetOpened(bool opened) { | 
| opened_ = opened; | 
| } | 
| +void DownloadItemImpl::SetShownWhenComplete(bool shown) { | 
| + shownWhenComplete_ = shown; | 
| +} | 
| + | 
| void DownloadItemImpl::SetDisplayName(const base::FilePath& name) { | 
| display_name_ = name; | 
| } |