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 <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 private: | 156 private: |
157 RequestQuotaInfoBarDelegate( | 157 RequestQuotaInfoBarDelegate( |
158 ChromeQuotaPermissionContext* context, | 158 ChromeQuotaPermissionContext* context, |
159 const GURL& origin_url, | 159 const GURL& origin_url, |
160 int64 requested_quota, | 160 int64 requested_quota, |
161 const std::string& display_languages, | 161 const std::string& display_languages, |
162 const content::QuotaPermissionContext::PermissionCallback& callback); | 162 const content::QuotaPermissionContext::PermissionCallback& callback); |
163 virtual ~RequestQuotaInfoBarDelegate(); | 163 virtual ~RequestQuotaInfoBarDelegate(); |
164 | 164 |
165 // ConfirmInfoBarDelegate: | 165 // ConfirmInfoBarDelegate: |
166 virtual bool ShouldExpireInternal( | |
167 const NavigationDetails& details) const OVERRIDE; | |
168 virtual base::string16 GetMessageText() const OVERRIDE; | 166 virtual base::string16 GetMessageText() const OVERRIDE; |
169 virtual bool Accept() OVERRIDE; | 167 virtual bool Accept() OVERRIDE; |
170 virtual bool Cancel() OVERRIDE; | 168 virtual bool Cancel() OVERRIDE; |
171 | 169 |
172 scoped_refptr<ChromeQuotaPermissionContext> context_; | 170 scoped_refptr<ChromeQuotaPermissionContext> context_; |
173 GURL origin_url_; | 171 GURL origin_url_; |
174 std::string display_languages_; | 172 std::string display_languages_; |
175 int64 requested_quota_; | 173 int64 requested_quota_; |
176 content::QuotaPermissionContext::PermissionCallback callback_; | 174 content::QuotaPermissionContext::PermissionCallback callback_; |
177 | 175 |
(...skipping 28 matching lines...) Expand all Loading... |
206 } | 204 } |
207 | 205 |
208 RequestQuotaInfoBarDelegate::~RequestQuotaInfoBarDelegate() { | 206 RequestQuotaInfoBarDelegate::~RequestQuotaInfoBarDelegate() { |
209 if (!callback_.is_null()) { | 207 if (!callback_.is_null()) { |
210 context_->DispatchCallbackOnIOThread( | 208 context_->DispatchCallbackOnIOThread( |
211 callback_, | 209 callback_, |
212 content::QuotaPermissionContext::QUOTA_PERMISSION_RESPONSE_CANCELLED); | 210 content::QuotaPermissionContext::QUOTA_PERMISSION_RESPONSE_CANCELLED); |
213 } | 211 } |
214 } | 212 } |
215 | 213 |
216 bool RequestQuotaInfoBarDelegate::ShouldExpireInternal( | |
217 const NavigationDetails& details) const { | |
218 return false; | |
219 } | |
220 | |
221 base::string16 RequestQuotaInfoBarDelegate::GetMessageText() const { | 214 base::string16 RequestQuotaInfoBarDelegate::GetMessageText() const { |
222 // If the site requested larger quota than this threshold, show a different | 215 // If the site requested larger quota than this threshold, show a different |
223 // message to the user. | 216 // message to the user. |
224 return l10n_util::GetStringFUTF16( | 217 return l10n_util::GetStringFUTF16( |
225 (requested_quota_ > kRequestLargeQuotaThreshold ? | 218 (requested_quota_ > kRequestLargeQuotaThreshold ? |
226 IDS_REQUEST_LARGE_QUOTA_INFOBAR_QUESTION : | 219 IDS_REQUEST_LARGE_QUOTA_INFOBAR_QUESTION : |
227 IDS_REQUEST_QUOTA_INFOBAR_QUESTION), | 220 IDS_REQUEST_QUOTA_INFOBAR_QUESTION), |
228 net::FormatUrl(origin_url_, display_languages_)); | 221 net::FormatUrl(origin_url_, display_languages_)); |
229 } | 222 } |
230 | 223 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 content::BrowserThread::IO, FROM_HERE, | 312 content::BrowserThread::IO, FROM_HERE, |
320 base::Bind(&ChromeQuotaPermissionContext::DispatchCallbackOnIOThread, | 313 base::Bind(&ChromeQuotaPermissionContext::DispatchCallbackOnIOThread, |
321 this, callback, response)); | 314 this, callback, response)); |
322 return; | 315 return; |
323 } | 316 } |
324 | 317 |
325 callback.Run(response); | 318 callback.Run(response); |
326 } | 319 } |
327 | 320 |
328 ChromeQuotaPermissionContext::~ChromeQuotaPermissionContext() {} | 321 ChromeQuotaPermissionContext::~ChromeQuotaPermissionContext() {} |
OLD | NEW |