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

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

Issue 2850223002: remove reliance on webcontents when requesting storage permission (Closed)
Patch Set: fix mock class Created 3 years, 7 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 | « chrome/browser/android/download/mock_download_controller.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_resource_throttle.h" 5 #include "chrome/browser/download/download_resource_throttle.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 CanDownload(std::move(info)); 44 CanDownload(std::move(info));
45 else 45 else
46 info->continue_callback.Run(false); 46 info->continue_callback.Run(false);
47 } 47 }
48 #endif 48 #endif
49 49
50 void CanDownloadOnUIThread( 50 void CanDownloadOnUIThread(
51 std::unique_ptr<DownloadResourceThrottle::DownloadRequestInfo> info) { 51 std::unique_ptr<DownloadResourceThrottle::DownloadRequestInfo> info) {
52 DCHECK_CURRENTLY_ON(BrowserThread::UI); 52 DCHECK_CURRENTLY_ON(BrowserThread::UI);
53 #if defined(OS_ANDROID) 53 #if defined(OS_ANDROID)
54 content::WebContents* contents = info->web_contents_getter.Run(); 54 DownloadControllerBase::Get()->AcquireFileAccessPermission(
55 if (contents) { 55 info->web_contents_getter, base::Bind(&OnAcquireFileAccessPermissionDone,
56 DownloadControllerBase::Get()->AcquireFileAccessPermission( 56 base::Passed(std::move(info))));
57 contents, base::Bind(&OnAcquireFileAccessPermissionDone,
58 base::Passed(std::move(info))));
59 } else {
60 OnAcquireFileAccessPermissionDone(std::move(info), false);
61 }
62 #else 57 #else
63 CanDownload(std::move(info)); 58 CanDownload(std::move(info));
64 #endif 59 #endif
65 } 60 }
66 61
67 } // namespace 62 } // namespace
68 63
69 DownloadResourceThrottle::DownloadRequestInfo::DownloadRequestInfo( 64 DownloadResourceThrottle::DownloadRequestInfo::DownloadRequestInfo(
70 scoped_refptr<DownloadRequestLimiter> limiter, 65 scoped_refptr<DownloadRequestLimiter> limiter,
71 const content::ResourceRequestInfo::WebContentsGetter& web_contents_getter, 66 const content::ResourceRequestInfo::WebContentsGetter& web_contents_getter,
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 144
150 if (request_deferred_) { 145 if (request_deferred_) {
151 request_deferred_ = false; 146 request_deferred_ = false;
152 if (allow) { 147 if (allow) {
153 Resume(); 148 Resume();
154 } else { 149 } else {
155 Cancel(); 150 Cancel();
156 } 151 }
157 } 152 }
158 } 153 }
OLDNEW
« no previous file with comments | « chrome/browser/android/download/mock_download_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698