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 <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 // The tab may have gone away or the request may not be from a tab. | 276 // The tab may have gone away or the request may not be from a tab. |
277 LOG(WARNING) << "Attempt to request quota tabless renderer: " | 277 LOG(WARNING) << "Attempt to request quota tabless renderer: " |
278 << render_process_id << "," << params.render_view_id; | 278 << render_process_id << "," << params.render_view_id; |
279 DispatchCallbackOnIOThread(callback, QUOTA_PERMISSION_RESPONSE_CANCELLED); | 279 DispatchCallbackOnIOThread(callback, QUOTA_PERMISSION_RESPONSE_CANCELLED); |
280 return; | 280 return; |
281 } | 281 } |
282 | 282 |
283 if (PermissionBubbleManager::Enabled()) { | 283 if (PermissionBubbleManager::Enabled()) { |
284 PermissionBubbleManager* bubble_manager = | 284 PermissionBubbleManager* bubble_manager = |
285 PermissionBubbleManager::FromWebContents(web_contents); | 285 PermissionBubbleManager::FromWebContents(web_contents); |
286 bubble_manager->AddRequest(new QuotaPermissionRequest(this, | 286 if (bubble_manager) { |
287 params.origin_url, params.requested_size, params.user_gesture, | 287 bubble_manager->AddRequest(new QuotaPermissionRequest(this, |
288 Profile::FromBrowserContext(web_contents->GetBrowserContext())-> | 288 params.origin_url, params.requested_size, params.user_gesture, |
289 GetPrefs()->GetString(prefs::kAcceptLanguages), | 289 Profile::FromBrowserContext(web_contents->GetBrowserContext())-> |
290 callback)); | 290 GetPrefs()->GetString(prefs::kAcceptLanguages), |
| 291 callback)); |
| 292 } |
291 return; | 293 return; |
292 } | 294 } |
293 | 295 |
294 InfoBarService* infobar_service = | 296 InfoBarService* infobar_service = |
295 InfoBarService::FromWebContents(web_contents); | 297 InfoBarService::FromWebContents(web_contents); |
296 if (!infobar_service) { | 298 if (!infobar_service) { |
297 // The tab has no infobar service. | 299 // The tab has no infobar service. |
298 LOG(WARNING) << "Attempt to request quota from a background page: " | 300 LOG(WARNING) << "Attempt to request quota from a background page: " |
299 << render_process_id << "," << params.render_view_id; | 301 << render_process_id << "," << params.render_view_id; |
300 DispatchCallbackOnIOThread(callback, QUOTA_PERMISSION_RESPONSE_CANCELLED); | 302 DispatchCallbackOnIOThread(callback, QUOTA_PERMISSION_RESPONSE_CANCELLED); |
(...skipping 16 matching lines...) Expand all Loading... |
317 content::BrowserThread::IO, FROM_HERE, | 319 content::BrowserThread::IO, FROM_HERE, |
318 base::Bind(&ChromeQuotaPermissionContext::DispatchCallbackOnIOThread, | 320 base::Bind(&ChromeQuotaPermissionContext::DispatchCallbackOnIOThread, |
319 this, callback, response)); | 321 this, callback, response)); |
320 return; | 322 return; |
321 } | 323 } |
322 | 324 |
323 callback.Run(response); | 325 callback.Run(response); |
324 } | 326 } |
325 | 327 |
326 ChromeQuotaPermissionContext::~ChromeQuotaPermissionContext() {} | 328 ChromeQuotaPermissionContext::~ChromeQuotaPermissionContext() {} |
OLD | NEW |