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

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

Issue 209613002: Download shelf autohides on showing in shell, just same as regular open Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move the 'user acted' flag into DownloadItemModelData and get rid of SetOpened/SetShown in Download… Created 6 years, 6 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
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 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 delegate_->CheckForFileRemoval(this); 463 delegate_->CheckForFileRemoval(this);
464 RecordOpen(GetEndTime(), !GetOpened()); 464 RecordOpen(GetEndTime(), !GetOpened());
465 opened_ = true; 465 opened_ = true;
466 FOR_EACH_OBSERVER(Observer, observers_, OnDownloadOpened(this)); 466 FOR_EACH_OBSERVER(Observer, observers_, OnDownloadOpened(this));
467 delegate_->OpenDownload(this); 467 delegate_->OpenDownload(this);
468 } 468 }
469 469
470 void DownloadItemImpl::ShowDownloadInShell() { 470 void DownloadItemImpl::ShowDownloadInShell() {
471 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 471 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
472 472
473 if (!CanShowInFolder())
474 return;
475
476 delegate_->CheckForFileRemoval(this);
477 FOR_EACH_OBSERVER(Observer, observers_, OnDownloadShown(this));
473 delegate_->ShowDownloadInShell(this); 478 delegate_->ShowDownloadInShell(this);
474 } 479 }
475 480
476 uint32 DownloadItemImpl::GetId() const { 481 uint32 DownloadItemImpl::GetId() const {
477 return download_id_; 482 return download_id_;
478 } 483 }
479 484
480 DownloadItem::DownloadState DownloadItemImpl::GetState() const { 485 DownloadItem::DownloadState DownloadItemImpl::GetState() const {
481 return InternalToExternalState(state_); 486 return InternalToExternalState(state_);
482 } 487 }
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 } 789 }
785 790
786 void DownloadItemImpl::SetOpenWhenComplete(bool open) { 791 void DownloadItemImpl::SetOpenWhenComplete(bool open) {
787 open_when_complete_ = open; 792 open_when_complete_ = open;
788 } 793 }
789 794
790 void DownloadItemImpl::SetIsTemporary(bool temporary) { 795 void DownloadItemImpl::SetIsTemporary(bool temporary) {
791 is_temporary_ = temporary; 796 is_temporary_ = temporary;
792 } 797 }
793 798
794 void DownloadItemImpl::SetOpened(bool opened) {
795 opened_ = opened;
796 }
797
798 void DownloadItemImpl::SetDisplayName(const base::FilePath& name) { 799 void DownloadItemImpl::SetDisplayName(const base::FilePath& name) {
799 display_name_ = name; 800 display_name_ = name;
800 } 801 }
801 802
802 std::string DownloadItemImpl::DebugString(bool verbose) const { 803 std::string DownloadItemImpl::DebugString(bool verbose) const {
803 std::string description = 804 std::string description =
804 base::StringPrintf("{ id = %d" 805 base::StringPrintf("{ id = %d"
805 " state = %s", 806 " state = %s",
806 download_id_, 807 download_id_,
807 DebugDownloadStateString(state_)); 808 DebugDownloadStateString(state_));
(...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after
1796 case RESUME_MODE_USER_CONTINUE: 1797 case RESUME_MODE_USER_CONTINUE:
1797 return "USER_CONTINUE"; 1798 return "USER_CONTINUE";
1798 case RESUME_MODE_USER_RESTART: 1799 case RESUME_MODE_USER_RESTART:
1799 return "USER_RESTART"; 1800 return "USER_RESTART";
1800 } 1801 }
1801 NOTREACHED() << "Unknown resume mode " << mode; 1802 NOTREACHED() << "Unknown resume mode " << mode;
1802 return "unknown"; 1803 return "unknown";
1803 } 1804 }
1804 1805
1805 } // namespace content 1806 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698