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

Side by Side Diff: chrome/browser/chrome_quota_permission_context.cc

Issue 10948002: Make quota requests from background pages not crash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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/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/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 tab_util::GetWebContentsByID(render_process_id, render_view_id); 131 tab_util::GetWebContentsByID(render_process_id, render_view_id);
132 if (!web_contents) { 132 if (!web_contents) {
133 // The tab may have gone away or the request may not be from a tab. 133 // The tab may have gone away or the request may not be from a tab.
134 LOG(WARNING) << "Attempt to request quota tabless renderer: " 134 LOG(WARNING) << "Attempt to request quota tabless renderer: "
135 << render_process_id << "," << render_view_id; 135 << render_process_id << "," << render_view_id;
136 DispatchCallbackOnIOThread(callback, QUOTA_PERMISSION_RESPONSE_CANCELLED); 136 DispatchCallbackOnIOThread(callback, QUOTA_PERMISSION_RESPONSE_CANCELLED);
137 return; 137 return;
138 } 138 }
139 139
140 TabContents* tab_contents = TabContents::FromWebContents(web_contents); 140 TabContents* tab_contents = TabContents::FromWebContents(web_contents);
141 InfoBarTabHelper* infobar_helper = tab_contents->infobar_tab_helper(); 141 InfoBarTabHelper* infobar_helper =
142 tab_contents ? tab_contents->infobar_tab_helper() : NULL;
kinuko 2012/09/18 05:03:35 nit: indent
tzik 2012/09/19 12:08:54 Thanks. I fixed it and my .emacs.
142 if (!infobar_helper) { 143 if (!infobar_helper) {
143 // The tab has no infobar helper. 144 // The tab has no infobar helper.
144 LOG(WARNING) << "Attempt to request quota from a background page: " 145 LOG(WARNING) << "Attempt to request quota from a background page: "
145 << render_process_id << "," << render_view_id; 146 << render_process_id << "," << render_view_id;
146 DispatchCallbackOnIOThread(callback, QUOTA_PERMISSION_RESPONSE_CANCELLED); 147 DispatchCallbackOnIOThread(callback, QUOTA_PERMISSION_RESPONSE_CANCELLED);
147 return; 148 return;
148 } 149 }
149 infobar_helper->AddInfoBar(new RequestQuotaInfoBarDelegate( 150 infobar_helper->AddInfoBar(new RequestQuotaInfoBarDelegate(
150 infobar_helper, this, origin_url, requested_quota, 151 infobar_helper, this, origin_url, requested_quota,
151 tab_contents->profile()->GetPrefs()->GetString(prefs::kAcceptLanguages), 152 tab_contents->profile()->GetPrefs()->GetString(prefs::kAcceptLanguages),
(...skipping 10 matching lines...) Expand all
162 BrowserThread::IO, FROM_HERE, 163 BrowserThread::IO, FROM_HERE,
163 base::Bind(&ChromeQuotaPermissionContext::DispatchCallbackOnIOThread, 164 base::Bind(&ChromeQuotaPermissionContext::DispatchCallbackOnIOThread,
164 this, callback, response)); 165 this, callback, response));
165 return; 166 return;
166 } 167 }
167 168
168 callback.Run(response); 169 callback.Run(response);
169 } 170 }
170 171
171 ChromeQuotaPermissionContext::~ChromeQuotaPermissionContext() {} 172 ChromeQuotaPermissionContext::~ChromeQuotaPermissionContext() {}
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698