| OLD | NEW |
| 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/chrome_quota_permission_context.h" | 5 #include "chrome/browser/chrome_quota_permission_context.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 if (params.storage_type != storage::kStorageTypePersistent) { | 242 if (params.storage_type != storage::kStorageTypePersistent) { |
| 243 // For now we only support requesting quota with this interface | 243 // For now we only support requesting quota with this interface |
| 244 // for Persistent storage type. | 244 // for Persistent storage type. |
| 245 callback.Run(QUOTA_PERMISSION_RESPONSE_DISALLOW); | 245 callback.Run(QUOTA_PERMISSION_RESPONSE_DISALLOW); |
| 246 return; | 246 return; |
| 247 } | 247 } |
| 248 | 248 |
| 249 if (!content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)) { | 249 if (!content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)) { |
| 250 content::BrowserThread::PostTask( | 250 content::BrowserThread::PostTask( |
| 251 content::BrowserThread::UI, FROM_HERE, | 251 content::BrowserThread::UI, FROM_HERE, |
| 252 base::Bind(&ChromeQuotaPermissionContext::RequestQuotaPermission, this, | 252 base::BindOnce(&ChromeQuotaPermissionContext::RequestQuotaPermission, |
| 253 params, render_process_id, callback)); | 253 this, params, render_process_id, callback)); |
| 254 return; | 254 return; |
| 255 } | 255 } |
| 256 | 256 |
| 257 content::WebContents* web_contents = tab_util::GetWebContentsByFrameID( | 257 content::WebContents* web_contents = tab_util::GetWebContentsByFrameID( |
| 258 render_process_id, params.render_frame_id); | 258 render_process_id, params.render_frame_id); |
| 259 if (!web_contents) { | 259 if (!web_contents) { |
| 260 // The tab may have gone away or the request may not be from a tab. | 260 // The tab may have gone away or the request may not be from a tab. |
| 261 LOG(WARNING) << "Attempt to request quota tabless renderer: " | 261 LOG(WARNING) << "Attempt to request quota tabless renderer: " |
| 262 << render_process_id << "," << params.render_frame_id; | 262 << render_process_id << "," << params.render_frame_id; |
| 263 DispatchCallbackOnIOThread(callback, QUOTA_PERMISSION_RESPONSE_CANCELLED); | 263 DispatchCallbackOnIOThread(callback, QUOTA_PERMISSION_RESPONSE_CANCELLED); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 292 } | 292 } |
| 293 | 293 |
| 294 void ChromeQuotaPermissionContext::DispatchCallbackOnIOThread( | 294 void ChromeQuotaPermissionContext::DispatchCallbackOnIOThread( |
| 295 const PermissionCallback& callback, | 295 const PermissionCallback& callback, |
| 296 QuotaPermissionResponse response) { | 296 QuotaPermissionResponse response) { |
| 297 DCHECK_EQ(false, callback.is_null()); | 297 DCHECK_EQ(false, callback.is_null()); |
| 298 | 298 |
| 299 if (!content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)) { | 299 if (!content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)) { |
| 300 content::BrowserThread::PostTask( | 300 content::BrowserThread::PostTask( |
| 301 content::BrowserThread::IO, FROM_HERE, | 301 content::BrowserThread::IO, FROM_HERE, |
| 302 base::Bind(&ChromeQuotaPermissionContext::DispatchCallbackOnIOThread, | 302 base::BindOnce( |
| 303 this, callback, response)); | 303 &ChromeQuotaPermissionContext::DispatchCallbackOnIOThread, this, |
| 304 callback, response)); |
| 304 return; | 305 return; |
| 305 } | 306 } |
| 306 | 307 |
| 307 callback.Run(response); | 308 callback.Run(response); |
| 308 } | 309 } |
| 309 | 310 |
| 310 ChromeQuotaPermissionContext::~ChromeQuotaPermissionContext() {} | 311 ChromeQuotaPermissionContext::~ChromeQuotaPermissionContext() {} |
| OLD | NEW |