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

Side by Side Diff: chrome/browser/download/download_shelf.cc

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 7 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 | Annotate | Revision Log
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 #include "chrome/browser/download/download_shelf.h" 5 #include "chrome/browser/download/download_shelf.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "chrome/browser/download/download_item_model.h" 10 #include "chrome/browser/download/download_item_model.h"
(...skipping 26 matching lines...) Expand all
37 37
38 DownloadShelf::~DownloadShelf() { 38 DownloadShelf::~DownloadShelf() {
39 } 39 }
40 40
41 void DownloadShelf::AddDownload(DownloadItem* download) { 41 void DownloadShelf::AddDownload(DownloadItem* download) {
42 DCHECK(download); 42 DCHECK(download);
43 if (DownloadItemModel(download).ShouldRemoveFromShelfWhenComplete()) { 43 if (DownloadItemModel(download).ShouldRemoveFromShelfWhenComplete()) {
44 // If we are going to remove the download from the shelf upon completion, 44 // If we are going to remove the download from the shelf upon completion,
45 // wait a few seconds to see if it completes quickly. If it's a small 45 // wait a few seconds to see if it completes quickly. If it's a small
46 // download, then the user won't have time to interact with it. 46 // download, then the user won't have time to interact with it.
47 MessageLoop::current()->PostDelayedTask( 47 base::MessageLoop::current()->PostDelayedTask(
48 FROM_HERE, 48 FROM_HERE,
49 base::Bind(&DownloadShelf::ShowDownloadById, 49 base::Bind(&DownloadShelf::ShowDownloadById,
50 weak_ptr_factory_.GetWeakPtr(), 50 weak_ptr_factory_.GetWeakPtr(),
51 download->GetId()), 51 download->GetId()),
52 GetTransientDownloadShowDelay()); 52 GetTransientDownloadShowDelay());
53 } else { 53 } else {
54 ShowDownload(download); 54 ShowDownload(download);
55 } 55 }
56 } 56 }
57 57
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 content::DownloadManager* download_manager = GetDownloadManager(); 135 content::DownloadManager* download_manager = GetDownloadManager();
136 if (!download_manager) 136 if (!download_manager)
137 return; 137 return;
138 138
139 DownloadItem* download = download_manager->GetDownload(download_id); 139 DownloadItem* download = download_manager->GetDownload(download_id);
140 if (!download) 140 if (!download)
141 return; 141 return;
142 142
143 ShowDownload(download); 143 ShowDownload(download);
144 } 144 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698