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

Side by Side Diff: chrome/browser/android/download/download_manager_service.cc

Issue 2033753002: Remove use of deprecated MessageLoop methods in chrome/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: manual change Created 4 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
« no previous file with comments | « no previous file | chrome/browser/android/feedback/connectivity_checker.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/android/download/download_manager_service.h" 5 #include "chrome/browser/android/download/download_manager_service.h"
6 6
7 #include "base/android/jni_string.h" 7 #include "base/android/jni_string.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h"
10 #include "base/threading/thread_task_runner_handle.h"
9 #include "base/time/time.h" 11 #include "base/time/time.h"
10 #include "chrome/browser/download/download_service.h" 12 #include "chrome/browser/download/download_service.h"
11 #include "chrome/browser/download/download_service_factory.h" 13 #include "chrome/browser/download/download_service_factory.h"
12 #include "chrome/browser/profiles/profile_manager.h" 14 #include "chrome/browser/profiles/profile_manager.h"
13 #include "chrome/grit/generated_resources.h" 15 #include "chrome/grit/generated_resources.h"
14 #include "content/public/browser/android/download_controller_android.h" 16 #include "content/public/browser/android/download_controller_android.h"
15 #include "content/public/browser/browser_context.h" 17 #include "content/public/browser/browser_context.h"
16 #include "content/public/browser/download_item.h" 18 #include "content/public/browser/download_item.h"
17 #include "jni/DownloadManagerService_jni.h" 19 #include "jni/DownloadManagerService_jni.h"
18 #include "ui/base/l10n/l10n_util.h" 20 #include "ui/base/l10n/l10n_util.h"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 iter->second = action; 183 iter->second = action;
182 break; 184 break;
183 default: 185 default:
184 NOTREACHED(); 186 NOTREACHED();
185 break; 187 break;
186 } 188 }
187 } 189 }
188 190
189 void DownloadManagerService::OnResumptionFailed( 191 void DownloadManagerService::OnResumptionFailed(
190 const std::string& download_guid) { 192 const std::string& download_guid) {
191 base::MessageLoop::current()->PostTask( 193 base::ThreadTaskRunnerHandle::Get()->PostTask(
192 FROM_HERE, base::Bind(&DownloadManagerService::OnResumptionFailedInternal, 194 FROM_HERE, base::Bind(&DownloadManagerService::OnResumptionFailedInternal,
193 base::Unretained(this), download_guid)); 195 base::Unretained(this), download_guid));
194 } 196 }
195 197
196 void DownloadManagerService::OnResumptionFailedInternal( 198 void DownloadManagerService::OnResumptionFailedInternal(
197 const std::string& download_guid) { 199 const std::string& download_guid) {
198 if (!java_ref_.is_null()) { 200 if (!java_ref_.is_null()) {
199 JNIEnv* env = base::android::AttachCurrentThread(); 201 JNIEnv* env = base::android::AttachCurrentThread();
200 Java_DownloadManagerService_onResumptionFailed( 202 Java_DownloadManagerService_onResumptionFailed(
201 env, java_ref_.obj(), 203 env, java_ref_.obj(),
202 ConvertUTF8ToJavaString(env, download_guid).obj()); 204 ConvertUTF8ToJavaString(env, download_guid).obj());
203 } 205 }
204 if (!resume_callback_for_testing_.is_null()) 206 if (!resume_callback_for_testing_.is_null())
205 resume_callback_for_testing_.Run(false); 207 resume_callback_for_testing_.Run(false);
206 } 208 }
207 209
208 content::DownloadManager* DownloadManagerService::GetDownloadManager( 210 content::DownloadManager* DownloadManagerService::GetDownloadManager(
209 bool is_off_the_record) { 211 bool is_off_the_record) {
210 Profile* profile = ProfileManager::GetActiveUserProfile(); 212 Profile* profile = ProfileManager::GetActiveUserProfile();
211 if (is_off_the_record) 213 if (is_off_the_record)
212 profile = profile->GetOffTheRecordProfile(); 214 profile = profile->GetOffTheRecordProfile();
213 return content::BrowserContext::GetDownloadManager(profile); 215 return content::BrowserContext::GetDownloadManager(profile);
214 } 216 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/feedback/connectivity_checker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698