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

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

Issue 1143343005: chrome/browser: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 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 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. 5 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first.
6 6
7 #include "chrome/browser/download/download_shelf.h" 7 #include "chrome/browser/download/download_shelf.h"
8 8
9 #include <cmath> 9 #include <cmath>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/message_loop/message_loop.h" 13 #include "base/location.h"
14 #include "base/single_thread_task_runner.h"
14 #include "base/strings/string_number_conversions.h" 15 #include "base/strings/string_number_conversions.h"
16 #include "base/thread_task_runner_handle.h"
15 #include "chrome/browser/download/download_item_model.h" 17 #include "chrome/browser/download/download_item_model.h"
16 #include "chrome/browser/download/download_service.h" 18 #include "chrome/browser/download/download_service.h"
17 #include "chrome/browser/download/download_service_factory.h" 19 #include "chrome/browser/download/download_service_factory.h"
18 #include "chrome/browser/download/download_started_animation.h" 20 #include "chrome/browser/download/download_started_animation.h"
19 #include "chrome/browser/platform_util.h" 21 #include "chrome/browser/platform_util.h"
20 #include "chrome/browser/profiles/profile.h" 22 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/browser/ui/browser.h" 23 #include "chrome/browser/ui/browser.h"
22 #include "chrome/browser/ui/tabs/tab_strip_model.h" 24 #include "chrome/browser/ui/tabs/tab_strip_model.h"
23 #include "chrome/grit/locale_settings.h" 25 #include "chrome/grit/locale_settings.h"
24 #include "content/public/browser/browser_context.h" 26 #include "content/public/browser/browser_context.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 PaintDownloadComplete(canvas, rtl_mirror, origin_x, origin_y, 176 PaintDownloadComplete(canvas, rtl_mirror, origin_x, origin_y,
175 1.0 - animation_progress); 177 1.0 - animation_progress);
176 } 178 }
177 179
178 void DownloadShelf::AddDownload(DownloadItem* download) { 180 void DownloadShelf::AddDownload(DownloadItem* download) {
179 DCHECK(download); 181 DCHECK(download);
180 if (DownloadItemModel(download).ShouldRemoveFromShelfWhenComplete()) { 182 if (DownloadItemModel(download).ShouldRemoveFromShelfWhenComplete()) {
181 // If we are going to remove the download from the shelf upon completion, 183 // If we are going to remove the download from the shelf upon completion,
182 // wait a few seconds to see if it completes quickly. If it's a small 184 // wait a few seconds to see if it completes quickly. If it's a small
183 // download, then the user won't have time to interact with it. 185 // download, then the user won't have time to interact with it.
184 base::MessageLoop::current()->PostDelayedTask( 186 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
185 FROM_HERE, 187 FROM_HERE,
186 base::Bind(&DownloadShelf::ShowDownloadById, 188 base::Bind(&DownloadShelf::ShowDownloadById,
187 weak_ptr_factory_.GetWeakPtr(), 189 weak_ptr_factory_.GetWeakPtr(), download->GetId()),
188 download->GetId()),
189 GetTransientDownloadShowDelay()); 190 GetTransientDownloadShowDelay());
190 } else { 191 } else {
191 ShowDownload(download); 192 ShowDownload(download);
192 } 193 }
193 } 194 }
194 195
195 void DownloadShelf::Show() { 196 void DownloadShelf::Show() {
196 if (is_hidden_) { 197 if (is_hidden_) {
197 should_show_on_unhide_ = true; 198 should_show_on_unhide_ = true;
198 return; 199 return;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 content::DownloadManager* download_manager = GetDownloadManager(); 274 content::DownloadManager* download_manager = GetDownloadManager();
274 if (!download_manager) 275 if (!download_manager)
275 return; 276 return;
276 277
277 DownloadItem* download = download_manager->GetDownload(download_id); 278 DownloadItem* download = download_manager->GetDownload(download_id);
278 if (!download) 279 if (!download)
279 return; 280 return;
280 281
281 ShowDownload(download); 282 ShowDownload(download);
282 } 283 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698