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

Unified Diff: chrome/browser/chrome_quota_permission_context.cc

Issue 11644059: Change infobar creation to use a public static Create() method on the infobar delegate classes. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chrome_quota_permission_context.cc
===================================================================
--- chrome/browser/chrome_quota_permission_context.cc (revision 175396)
+++ chrome/browser/chrome_quota_permission_context.cc (working copy)
@@ -38,6 +38,16 @@
public:
typedef QuotaPermissionContext::PermissionCallback PermissionCallback;
+ // Creates a request quota infobar delegate and adds it to |infobar_service|.
+ static void Create(
+ InfoBarService* infobar_service,
+ ChromeQuotaPermissionContext* context,
+ const GURL& origin_url,
+ int64 requested_quota,
+ const std::string& display_languages,
+ const PermissionCallback& callback);
+
+ private:
RequestQuotaInfoBarDelegate(
InfoBarService* infobar_service,
ChromeQuotaPermissionContext* context,
@@ -52,7 +62,6 @@
requested_quota_(requested_quota),
callback_(callback) {}
- private:
virtual ~RequestQuotaInfoBarDelegate() {
if (!callback_.is_null())
context_->DispatchCallbackOnIOThread(
@@ -78,6 +87,20 @@
DISALLOW_COPY_AND_ASSIGN(RequestQuotaInfoBarDelegate);
};
+// static
+void RequestQuotaInfoBarDelegate::Create(
+ InfoBarService* infobar_service,
+ ChromeQuotaPermissionContext* context,
+ const GURL& origin_url,
+ int64 requested_quota,
+ const std::string& display_languages,
+ const QuotaPermissionContext::PermissionCallback& callback) {
+ infobar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>(
+ new RequestQuotaInfoBarDelegate(infobar_service, context, origin_url,
+ requested_quota, display_languages,
+ callback)));
+}
+
string16 RequestQuotaInfoBarDelegate::GetMessageText() const {
return l10n_util::GetStringFUTF16(
(requested_quota_ > kRequestLargeQuotaThreshold ?
@@ -148,10 +171,10 @@
}
Profile* profile =
Profile::FromBrowserContext(web_contents->GetBrowserContext());
- infobar_service->AddInfoBar(new RequestQuotaInfoBarDelegate(
+ RequestQuotaInfoBarDelegate::Create(
infobar_service, this, origin_url, requested_quota,
profile->GetPrefs()->GetString(prefs::kAcceptLanguages),
- callback));
+ callback);
}
void ChromeQuotaPermissionContext::DispatchCallbackOnIOThread(
« no previous file with comments | « chrome/browser/autofill/autofill_metrics_unittest.cc ('k') | chrome/browser/chromeos/login/webui_login_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698