summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/browser.cc
diff options
context:
space:
mode:
authorasanka@chromium.org <asanka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-08 18:27:29 +0000
committerasanka@chromium.org <asanka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-08 18:27:29 +0000
commit41b0021c13870f41b76884abba7a2656ea661e48 (patch)
tree01b78efbfdb9b19580ebe4ecbbf776fa1d7ace0f /chrome/browser/ui/browser.cc
parentc39df1a7114290fa7c6f2683f69d751a904f49cb (diff)
downloadchromium_src-41b0021c13870f41b76884abba7a2656ea661e48.zip
chromium_src-41b0021c13870f41b76884abba7a2656ea661e48.tar.gz
chromium_src-41b0021c13870f41b76884abba7a2656ea661e48.tar.bz2
Don't pass DownloadItemModel ownership.
DownloadItemModel is a thin wrapper around DownloadItem*. It's easier to instantiate it from a DownloadItem* than try to pass ownership around. Doing so was required when BaseDownloadItemModel existed, and the actual model could be either a DownloadItemModel or a SavePageModel. However this is no longer the case. In addition, DownloadShelfContextMenu should track the lifetime of the corresponding DownloadItem. It is possible for the DownloadItem to be destroyed while the context menu is showing. BUG=116551 Review URL: https://chromiumcodereview.appspot.com/11673004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175558 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/browser.cc')
-rw-r--r--chrome/browser/ui/browser.cc5
1 files changed, 2 insertions, 3 deletions
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index 455d3dc..f112448 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -1439,8 +1439,7 @@ int Browser::GetExtraRenderViewHeight() const {
void Browser::OnStartDownload(WebContents* source,
content::DownloadItem* download) {
- scoped_ptr<DownloadItemModel> download_model(new DownloadItemModel(download));
- if (!download_model->ShouldShowInShelf())
+ if (!DownloadItemModel(download).ShouldShowInShelf())
return;
WebContents* constrained = GetConstrainingWebContents(source);
@@ -1455,7 +1454,7 @@ void Browser::OnStartDownload(WebContents* source,
// GetDownloadShelf creates the download shelf if it was not yet created.
DownloadShelf* shelf = window()->GetDownloadShelf();
- shelf->AddDownload(download_model.release());
+ shelf->AddDownload(download);
// Don't show the animation for "Save file" downloads.
// For non-theme extensions, we don't show the download animation.
// Show animation in same window as the download shelf. Download shelf