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

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

Issue 190063006: Infobar Componentization Proof of Concept (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: minor fixes Created 6 years, 9 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 <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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 private: 153 private:
154 RequestQuotaInfoBarDelegate( 154 RequestQuotaInfoBarDelegate(
155 ChromeQuotaPermissionContext* context, 155 ChromeQuotaPermissionContext* context,
156 const GURL& origin_url, 156 const GURL& origin_url,
157 int64 requested_quota, 157 int64 requested_quota,
158 const std::string& display_languages, 158 const std::string& display_languages,
159 const content::QuotaPermissionContext::PermissionCallback& callback); 159 const content::QuotaPermissionContext::PermissionCallback& callback);
160 virtual ~RequestQuotaInfoBarDelegate(); 160 virtual ~RequestQuotaInfoBarDelegate();
161 161
162 // ConfirmInfoBarDelegate: 162 // ConfirmInfoBarDelegate:
163 virtual bool ShouldExpireInternal( 163 virtual bool ShouldExpireInternal(const NavigationDetails& details) const
164 const content::LoadCommittedDetails& details) const OVERRIDE; 164 OVERRIDE;
165 virtual base::string16 GetMessageText() const OVERRIDE; 165 virtual base::string16 GetMessageText() const OVERRIDE;
166 virtual bool Accept() OVERRIDE; 166 virtual bool Accept() OVERRIDE;
167 virtual bool Cancel() OVERRIDE; 167 virtual bool Cancel() OVERRIDE;
168 168
169 scoped_refptr<ChromeQuotaPermissionContext> context_; 169 scoped_refptr<ChromeQuotaPermissionContext> context_;
170 GURL origin_url_; 170 GURL origin_url_;
171 std::string display_languages_; 171 std::string display_languages_;
172 int64 requested_quota_; 172 int64 requested_quota_;
173 content::QuotaPermissionContext::PermissionCallback callback_; 173 content::QuotaPermissionContext::PermissionCallback callback_;
174 174
(...skipping 29 matching lines...) Expand all
204 204
205 RequestQuotaInfoBarDelegate::~RequestQuotaInfoBarDelegate() { 205 RequestQuotaInfoBarDelegate::~RequestQuotaInfoBarDelegate() {
206 if (!callback_.is_null()) { 206 if (!callback_.is_null()) {
207 context_->DispatchCallbackOnIOThread( 207 context_->DispatchCallbackOnIOThread(
208 callback_, 208 callback_,
209 content::QuotaPermissionContext::QUOTA_PERMISSION_RESPONSE_CANCELLED); 209 content::QuotaPermissionContext::QUOTA_PERMISSION_RESPONSE_CANCELLED);
210 } 210 }
211 } 211 }
212 212
213 bool RequestQuotaInfoBarDelegate::ShouldExpireInternal( 213 bool RequestQuotaInfoBarDelegate::ShouldExpireInternal(
214 const content::LoadCommittedDetails& details) const { 214 const NavigationDetails& details) const {
215 return false; 215 return false;
216 } 216 }
217 217
218 base::string16 RequestQuotaInfoBarDelegate::GetMessageText() const { 218 base::string16 RequestQuotaInfoBarDelegate::GetMessageText() const {
219 // If the site requested larger quota than this threshold, show a different 219 // If the site requested larger quota than this threshold, show a different
220 // message to the user. 220 // message to the user.
221 return l10n_util::GetStringFUTF16( 221 return l10n_util::GetStringFUTF16(
222 (requested_quota_ > kRequestLargeQuotaThreshold ? 222 (requested_quota_ > kRequestLargeQuotaThreshold ?
223 IDS_REQUEST_LARGE_QUOTA_INFOBAR_QUESTION : 223 IDS_REQUEST_LARGE_QUOTA_INFOBAR_QUESTION :
224 IDS_REQUEST_QUOTA_INFOBAR_QUESTION), 224 IDS_REQUEST_QUOTA_INFOBAR_QUESTION),
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 content::BrowserThread::IO, FROM_HERE, 317 content::BrowserThread::IO, FROM_HERE,
318 base::Bind(&ChromeQuotaPermissionContext::DispatchCallbackOnIOThread, 318 base::Bind(&ChromeQuotaPermissionContext::DispatchCallbackOnIOThread,
319 this, callback, response)); 319 this, callback, response));
320 return; 320 return;
321 } 321 }
322 322
323 callback.Run(response); 323 callback.Run(response);
324 } 324 }
325 325
326 ChromeQuotaPermissionContext::~ChromeQuotaPermissionContext() {} 326 ChromeQuotaPermissionContext::~ChromeQuotaPermissionContext() {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698