| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/prefs/pref_service.h" | 10 #include "chrome/browser/prefs/pref_service.h" |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 << render_process_id << "," << render_view_id; | 138 << render_process_id << "," << render_view_id; |
| 139 DispatchCallbackOnIOThread(callback.release(), kResponseCancelled); | 139 DispatchCallbackOnIOThread(callback.release(), kResponseCancelled); |
| 140 return; | 140 return; |
| 141 } | 141 } |
| 142 | 142 |
| 143 TabContentsWrapper* wrapper = | 143 TabContentsWrapper* wrapper = |
| 144 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents); | 144 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents); |
| 145 wrapper->AddInfoBar(new RequestQuotaInfoBarDelegate( | 145 wrapper->AddInfoBar(new RequestQuotaInfoBarDelegate( |
| 146 tab_contents, this, | 146 tab_contents, this, |
| 147 origin_url, requested_quota, | 147 origin_url, requested_quota, |
| 148 tab_contents->profile()->GetPrefs()->GetString(prefs::kAcceptLanguages), | 148 wrapper->profile()->GetPrefs()->GetString(prefs::kAcceptLanguages), |
| 149 callback.release())); | 149 callback.release())); |
| 150 } | 150 } |
| 151 | 151 |
| 152 void ChromeQuotaPermissionContext::DispatchCallbackOnIOThread( | 152 void ChromeQuotaPermissionContext::DispatchCallbackOnIOThread( |
| 153 PermissionCallback* callback_ptr, | 153 PermissionCallback* callback_ptr, |
| 154 Response response) { | 154 Response response) { |
| 155 DCHECK(callback_ptr); | 155 DCHECK(callback_ptr); |
| 156 scoped_ptr<PermissionCallback> callback(callback_ptr); | 156 scoped_ptr<PermissionCallback> callback(callback_ptr); |
| 157 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { | 157 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { |
| 158 BrowserThread::PostTask( | 158 BrowserThread::PostTask( |
| 159 BrowserThread::IO, FROM_HERE, | 159 BrowserThread::IO, FROM_HERE, |
| 160 NewRunnableMethod( | 160 NewRunnableMethod( |
| 161 this, &ChromeQuotaPermissionContext::DispatchCallbackOnIOThread, | 161 this, &ChromeQuotaPermissionContext::DispatchCallbackOnIOThread, |
| 162 callback.release(), response)); | 162 callback.release(), response)); |
| 163 return; | 163 return; |
| 164 } | 164 } |
| 165 callback->Run(response); | 165 callback->Run(response); |
| 166 } | 166 } |
| OLD | NEW |