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 <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 Loading... |
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 Loading... |
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 Loading... |
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() {} |
OLD | NEW |