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

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

Issue 1884073002: Add a new metric for how many times permissions prompts are shown. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix browser tests 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 class QuotaPermissionRequest : public PermissionBubbleRequest { 45 class QuotaPermissionRequest : public PermissionBubbleRequest {
46 public: 46 public:
47 QuotaPermissionRequest( 47 QuotaPermissionRequest(
48 ChromeQuotaPermissionContext* context, 48 ChromeQuotaPermissionContext* context,
49 const GURL& origin_url, 49 const GURL& origin_url,
50 int64_t requested_quota, 50 int64_t requested_quota,
51 const content::QuotaPermissionContext::PermissionCallback& callback); 51 const content::QuotaPermissionContext::PermissionCallback& callback);
52 52
53 ~QuotaPermissionRequest() override; 53 ~QuotaPermissionRequest() override;
54 54
55 private:
tsergeant 2016/04/15 00:54:10 Why does everything go from public to private here
benwells 2016/04/18 01:02:06 As discussed offline, this means users of these me
55 // PermissionBubbleRequest: 56 // PermissionBubbleRequest:
56 int GetIconId() const override; 57 int GetIconId() const override;
57 base::string16 GetMessageText() const override; 58 base::string16 GetMessageText() const override;
58 base::string16 GetMessageTextFragment() const override; 59 base::string16 GetMessageTextFragment() const override;
59 GURL GetOrigin() const override; 60 GURL GetOrigin() const override;
60 void PermissionGranted() override; 61 void PermissionGranted() override;
61 void PermissionDenied() override; 62 void PermissionDenied() override;
62 void Cancelled() override; 63 void Cancelled() override;
63 void RequestFinished() override; 64 void RequestFinished() override;
65 PermissionBubbleType GetPermissionBubbleType() const override;
64 66
65 private:
66 scoped_refptr<ChromeQuotaPermissionContext> context_; 67 scoped_refptr<ChromeQuotaPermissionContext> context_;
67 GURL origin_url_; 68 GURL origin_url_;
68 int64_t requested_quota_; 69 int64_t requested_quota_;
69 content::QuotaPermissionContext::PermissionCallback callback_; 70 content::QuotaPermissionContext::PermissionCallback callback_;
70 71
71 DISALLOW_COPY_AND_ASSIGN(QuotaPermissionRequest); 72 DISALLOW_COPY_AND_ASSIGN(QuotaPermissionRequest);
72 }; 73 };
73 74
74 QuotaPermissionRequest::QuotaPermissionRequest( 75 QuotaPermissionRequest::QuotaPermissionRequest(
75 ChromeQuotaPermissionContext* context, 76 ChromeQuotaPermissionContext* context,
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 void QuotaPermissionRequest::RequestFinished() { 125 void QuotaPermissionRequest::RequestFinished() {
125 if (!callback_.is_null()) { 126 if (!callback_.is_null()) {
126 context_->DispatchCallbackOnIOThread( 127 context_->DispatchCallbackOnIOThread(
127 callback_, 128 callback_,
128 content::QuotaPermissionContext::QUOTA_PERMISSION_RESPONSE_CANCELLED); 129 content::QuotaPermissionContext::QUOTA_PERMISSION_RESPONSE_CANCELLED);
129 } 130 }
130 131
131 delete this; 132 delete this;
132 } 133 }
133 134
135 PermissionBubbleType QuotaPermissionRequest::GetPermissionBubbleType() const {
136 return PermissionBubbleType::QUOTA;
137 }
138
134 #if defined(OS_ANDROID) 139 #if defined(OS_ANDROID)
135 // RequestQuotaInfoBarDelegate ------------------------------------------------ 140 // RequestQuotaInfoBarDelegate ------------------------------------------------
136 141
137 class RequestQuotaInfoBarDelegate : public ConfirmInfoBarDelegate { 142 class RequestQuotaInfoBarDelegate : public ConfirmInfoBarDelegate {
138 public: 143 public:
139 // Creates a request quota infobar and delegate and adds the infobar to 144 // Creates a request quota infobar and delegate and adds the infobar to
140 // |infobar_service|. 145 // |infobar_service|.
141 static void Create( 146 static void Create(
142 InfoBarService* infobar_service, 147 InfoBarService* infobar_service,
143 ChromeQuotaPermissionContext* context, 148 ChromeQuotaPermissionContext* context,
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 content::BrowserThread::IO, FROM_HERE, 306 content::BrowserThread::IO, FROM_HERE,
302 base::Bind(&ChromeQuotaPermissionContext::DispatchCallbackOnIOThread, 307 base::Bind(&ChromeQuotaPermissionContext::DispatchCallbackOnIOThread,
303 this, callback, response)); 308 this, callback, response));
304 return; 309 return;
305 } 310 }
306 311
307 callback.Run(response); 312 callback.Run(response);
308 } 313 }
309 314
310 ChromeQuotaPermissionContext::~ChromeQuotaPermissionContext() {} 315 ChromeQuotaPermissionContext::~ChromeQuotaPermissionContext() {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698