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

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

Issue 1520543004: Add method for identifying different InfoBars (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit again Created 4 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 unified diff | Download patch
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 <stdint.h> 7 #include <stdint.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 private: 165 private:
166 RequestQuotaInfoBarDelegate( 166 RequestQuotaInfoBarDelegate(
167 ChromeQuotaPermissionContext* context, 167 ChromeQuotaPermissionContext* context,
168 const GURL& origin_url, 168 const GURL& origin_url,
169 int64_t requested_quota, 169 int64_t requested_quota,
170 const std::string& display_languages, 170 const std::string& display_languages,
171 const content::QuotaPermissionContext::PermissionCallback& callback); 171 const content::QuotaPermissionContext::PermissionCallback& callback);
172 ~RequestQuotaInfoBarDelegate() override; 172 ~RequestQuotaInfoBarDelegate() override;
173 173
174 // ConfirmInfoBarDelegate: 174 // ConfirmInfoBarDelegate:
175 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override;
175 base::string16 GetMessageText() const override; 176 base::string16 GetMessageText() const override;
176 bool Accept() override; 177 bool Accept() override;
177 bool Cancel() override; 178 bool Cancel() override;
178 179
179 scoped_refptr<ChromeQuotaPermissionContext> context_; 180 scoped_refptr<ChromeQuotaPermissionContext> context_;
180 GURL origin_url_; 181 GURL origin_url_;
181 std::string display_languages_; 182 std::string display_languages_;
182 int64_t requested_quota_; 183 int64_t requested_quota_;
183 content::QuotaPermissionContext::PermissionCallback callback_; 184 content::QuotaPermissionContext::PermissionCallback callback_;
184 185
(...skipping 27 matching lines...) Expand all
212 callback_(callback) {} 213 callback_(callback) {}
213 214
214 RequestQuotaInfoBarDelegate::~RequestQuotaInfoBarDelegate() { 215 RequestQuotaInfoBarDelegate::~RequestQuotaInfoBarDelegate() {
215 if (!callback_.is_null()) { 216 if (!callback_.is_null()) {
216 context_->DispatchCallbackOnIOThread( 217 context_->DispatchCallbackOnIOThread(
217 callback_, 218 callback_,
218 content::QuotaPermissionContext::QUOTA_PERMISSION_RESPONSE_CANCELLED); 219 content::QuotaPermissionContext::QUOTA_PERMISSION_RESPONSE_CANCELLED);
219 } 220 }
220 } 221 }
221 222
223 infobars::InfoBarDelegate::InfoBarIdentifier
224 RequestQuotaInfoBarDelegate::GetIdentifier() const {
225 return REQUEST_QUOTA_INFOBAR_DELEGATE;
226 }
227
222 base::string16 RequestQuotaInfoBarDelegate::GetMessageText() const { 228 base::string16 RequestQuotaInfoBarDelegate::GetMessageText() const {
223 // If the site requested larger quota than this threshold, show a different 229 // If the site requested larger quota than this threshold, show a different
224 // message to the user. 230 // message to the user.
225 return l10n_util::GetStringFUTF16( 231 return l10n_util::GetStringFUTF16(
226 (requested_quota_ > kRequestLargeQuotaThreshold 232 (requested_quota_ > kRequestLargeQuotaThreshold
227 ? IDS_REQUEST_LARGE_QUOTA_INFOBAR_QUESTION 233 ? IDS_REQUEST_LARGE_QUOTA_INFOBAR_QUESTION
228 : IDS_REQUEST_QUOTA_INFOBAR_QUESTION), 234 : IDS_REQUEST_QUOTA_INFOBAR_QUESTION),
229 url_formatter::FormatUrlForSecurityDisplay(origin_url_, 235 url_formatter::FormatUrlForSecurityDisplay(origin_url_,
230 display_languages_)); 236 display_languages_));
231 } 237 }
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 content::BrowserThread::IO, FROM_HERE, 330 content::BrowserThread::IO, FROM_HERE,
325 base::Bind(&ChromeQuotaPermissionContext::DispatchCallbackOnIOThread, 331 base::Bind(&ChromeQuotaPermissionContext::DispatchCallbackOnIOThread,
326 this, callback, response)); 332 this, callback, response));
327 return; 333 return;
328 } 334 }
329 335
330 callback.Run(response); 336 callback.Run(response);
331 } 337 }
332 338
333 ChromeQuotaPermissionContext::~ChromeQuotaPermissionContext() {} 339 ChromeQuotaPermissionContext::~ChromeQuotaPermissionContext() {}
OLDNEW
« no previous file with comments | « chrome/browser/banners/app_banner_infobar_delegate_desktop.cc ('k') | chrome/browser/devtools/devtools_ui_bindings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698