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

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

Issue 1903103002: Remove some dead code for permission bubbles. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix rebase error Created 4 years, 8 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 18 matching lines...) Expand all
29 #if defined(OS_ANDROID) 29 #if defined(OS_ANDROID)
30 #include "chrome/browser/infobars/infobar_service.h" 30 #include "chrome/browser/infobars/infobar_service.h"
31 #include "components/infobars/core/confirm_infobar_delegate.h" 31 #include "components/infobars/core/confirm_infobar_delegate.h"
32 #include "components/infobars/core/infobar.h" 32 #include "components/infobars/core/infobar.h"
33 #else 33 #else
34 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" 34 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h"
35 #endif 35 #endif
36 36
37 namespace { 37 namespace {
38 38
39 #if defined(OS_ANDROID)
39 // If the site requested larger quota than this threshold, show a different 40 // If the site requested larger quota than this threshold, show a different
40 // message to the user. 41 // message to the user.
41 const int64_t kRequestLargeQuotaThreshold = 5 * 1024 * 1024; 42 const int64_t kRequestLargeQuotaThreshold = 5 * 1024 * 1024;
43 #endif
42 44
43 // QuotaPermissionRequest --------------------------------------------- 45 // QuotaPermissionRequest ---------------------------------------------
44 46
45 class QuotaPermissionRequest : public PermissionBubbleRequest { 47 class QuotaPermissionRequest : public PermissionBubbleRequest {
46 public: 48 public:
47 QuotaPermissionRequest( 49 QuotaPermissionRequest(
48 ChromeQuotaPermissionContext* context, 50 ChromeQuotaPermissionContext* context,
49 const GURL& origin_url, 51 const GURL& origin_url,
50 int64_t requested_quota, 52 int64_t requested_quota,
51 const content::QuotaPermissionContext::PermissionCallback& callback); 53 const content::QuotaPermissionContext::PermissionCallback& callback);
52 54
53 ~QuotaPermissionRequest() override; 55 ~QuotaPermissionRequest() override;
54 56
55 private: 57 private:
56 // PermissionBubbleRequest: 58 // PermissionBubbleRequest:
57 int GetIconId() const override; 59 int GetIconId() const override;
58 base::string16 GetMessageText() const override;
59 base::string16 GetMessageTextFragment() const override; 60 base::string16 GetMessageTextFragment() const override;
60 GURL GetOrigin() const override; 61 GURL GetOrigin() const override;
61 void PermissionGranted() override; 62 void PermissionGranted() override;
62 void PermissionDenied() override; 63 void PermissionDenied() override;
63 void Cancelled() override; 64 void Cancelled() override;
64 void RequestFinished() override; 65 void RequestFinished() override;
65 PermissionBubbleType GetPermissionBubbleType() const override; 66 PermissionBubbleType GetPermissionBubbleType() const override;
66 67
67 scoped_refptr<ChromeQuotaPermissionContext> context_; 68 scoped_refptr<ChromeQuotaPermissionContext> context_;
68 GURL origin_url_; 69 GURL origin_url_;
(...skipping 13 matching lines...) Expand all
82 requested_quota_(requested_quota), 83 requested_quota_(requested_quota),
83 callback_(callback) {} 84 callback_(callback) {}
84 85
85 QuotaPermissionRequest::~QuotaPermissionRequest() {} 86 QuotaPermissionRequest::~QuotaPermissionRequest() {}
86 87
87 int QuotaPermissionRequest::GetIconId() const { 88 int QuotaPermissionRequest::GetIconId() const {
88 // TODO(gbillock): get the proper image here 89 // TODO(gbillock): get the proper image here
89 return IDR_INFOBAR_WARNING; 90 return IDR_INFOBAR_WARNING;
90 } 91 }
91 92
92 base::string16 QuotaPermissionRequest::GetMessageText() const {
93 return l10n_util::GetStringFUTF16(
94 (requested_quota_ > kRequestLargeQuotaThreshold
95 ? IDS_REQUEST_LARGE_QUOTA_INFOBAR_QUESTION
96 : IDS_REQUEST_QUOTA_INFOBAR_QUESTION),
97 url_formatter::FormatUrlForSecurityDisplay(origin_url_));
98 }
99
100 base::string16 QuotaPermissionRequest::GetMessageTextFragment() const { 93 base::string16 QuotaPermissionRequest::GetMessageTextFragment() const {
101 return l10n_util::GetStringUTF16(IDS_REQUEST_QUOTA_PERMISSION_FRAGMENT); 94 return l10n_util::GetStringUTF16(IDS_REQUEST_QUOTA_PERMISSION_FRAGMENT);
102 } 95 }
103 96
104 GURL QuotaPermissionRequest::GetOrigin() const { 97 GURL QuotaPermissionRequest::GetOrigin() const {
105 return origin_url_; 98 return origin_url_;
106 } 99 }
107 100
108 void QuotaPermissionRequest::PermissionGranted() { 101 void QuotaPermissionRequest::PermissionGranted() {
109 context_->DispatchCallbackOnIOThread( 102 context_->DispatchCallbackOnIOThread(
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 content::BrowserThread::IO, FROM_HERE, 299 content::BrowserThread::IO, FROM_HERE,
307 base::Bind(&ChromeQuotaPermissionContext::DispatchCallbackOnIOThread, 300 base::Bind(&ChromeQuotaPermissionContext::DispatchCallbackOnIOThread,
308 this, callback, response)); 301 this, callback, response));
309 return; 302 return;
310 } 303 }
311 304
312 callback.Run(response); 305 callback.Run(response);
313 } 306 }
314 307
315 ChromeQuotaPermissionContext::~ChromeQuotaPermissionContext() {} 308 ChromeQuotaPermissionContext::~ChromeQuotaPermissionContext() {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698