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

Side by Side Diff: chrome/browser/permissions/permission_queue_controller.cc

Issue 2153133002: Add gesture type value from desktop prompt to permission report (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@add-user-gesture-to-reporting-part
Patch Set: nit Created 4 years, 4 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/permissions/permission_queue_controller.h" 5 #include "chrome/browser/permissions/permission_queue_controller.h"
6 6
7 #include "chrome/browser/chrome_notification_types.h" 7 #include "chrome/browser/chrome_notification_types.h"
8 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 8 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
9 #include "chrome/browser/geolocation/geolocation_infobar_delegate_android.h" 9 #include "chrome/browser/geolocation/geolocation_infobar_delegate_android.h"
10 #include "chrome/browser/infobars/infobar_service.h" 10 #include "chrome/browser/infobars/infobar_service.h"
11 #include "chrome/browser/media/midi_permission_infobar_delegate_android.h" 11 #include "chrome/browser/media/midi_permission_infobar_delegate_android.h"
12 #include "chrome/browser/media/protected_media_identifier_infobar_delegate_andro id.h" 12 #include "chrome/browser/media/protected_media_identifier_infobar_delegate_andro id.h"
13 #include "chrome/browser/notifications/notification_permission_infobar_delegate. h" 13 #include "chrome/browser/notifications/notification_permission_infobar_delegate. h"
14 #include "chrome/browser/permissions/permission_request.h"
14 #include "chrome/browser/permissions/permission_request_id.h" 15 #include "chrome/browser/permissions/permission_request_id.h"
15 #include "chrome/browser/permissions/permission_uma_util.h" 16 #include "chrome/browser/permissions/permission_uma_util.h"
16 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/tab_contents/tab_util.h" 18 #include "chrome/browser/tab_contents/tab_util.h"
18 #include "components/content_settings/core/browser/host_content_settings_map.h" 19 #include "components/content_settings/core/browser/host_content_settings_map.h"
19 #include "components/content_settings/core/common/content_settings.h" 20 #include "components/content_settings/core/common/content_settings.h"
20 #include "components/infobars/core/infobar.h" 21 #include "components/infobars/core/infobar.h"
21 #include "content/public/browser/browser_thread.h" 22 #include "content/public/browser/browser_thread.h"
22 #include "content/public/browser/notification_details.h" 23 #include "content/public/browser/notification_details.h"
23 #include "content/public/browser/notification_source.h" 24 #include "content/public/browser/notification_source.h"
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 void PermissionQueueController::OnPermissionSet( 200 void PermissionQueueController::OnPermissionSet(
200 const PermissionRequestID& id, 201 const PermissionRequestID& id,
201 const GURL& requesting_frame, 202 const GURL& requesting_frame,
202 const GURL& embedder, 203 const GURL& embedder,
203 bool update_content_setting, 204 bool update_content_setting,
204 bool allowed) { 205 bool allowed) {
205 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 206 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
206 207
207 // TODO(miguelg): move the permission persistence to 208 // TODO(miguelg): move the permission persistence to
208 // PermissionContextBase once all the types are moved there. 209 // PermissionContextBase once all the types are moved there.
210 // TODO(stefanocs): Pass the actual |gesture_type| value to PermissionUmaUtil.
209 if (update_content_setting) { 211 if (update_content_setting) {
210 UpdateContentSetting(requesting_frame, embedder, allowed); 212 UpdateContentSetting(requesting_frame, embedder, allowed);
211 if (allowed) 213 if (allowed) {
212 PermissionUmaUtil::PermissionGranted(permission_type_, requesting_frame, 214 PermissionUmaUtil::PermissionGranted(
213 profile_); 215 permission_type_, PermissionRequestGestureType::UNKNOWN,
214 else 216 requesting_frame, profile_);
215 PermissionUmaUtil::PermissionDenied(permission_type_, requesting_frame, 217 } else {
216 profile_); 218 PermissionUmaUtil::PermissionDenied(permission_type_,
219 PermissionRequestGestureType::UNKNOWN,
220 requesting_frame, profile_);
221 }
217 } else { 222 } else {
218 PermissionUmaUtil::PermissionDismissed(permission_type_, requesting_frame, 223 PermissionUmaUtil::PermissionDismissed(
219 profile_); 224 permission_type_, PermissionRequestGestureType::UNKNOWN,
225 requesting_frame, profile_);
220 } 226 }
221 227
222 // Cancel this request first, then notify listeners. TODO(pkasting): Why 228 // Cancel this request first, then notify listeners. TODO(pkasting): Why
223 // is this order important? 229 // is this order important?
224 PendingInfobarRequests requests_to_notify; 230 PendingInfobarRequests requests_to_notify;
225 PendingInfobarRequests infobars_to_remove; 231 PendingInfobarRequests infobars_to_remove;
226 std::vector<PendingInfobarRequests::iterator> pending_requests_to_remove; 232 std::vector<PendingInfobarRequests::iterator> pending_requests_to_remove;
227 for (PendingInfobarRequests::iterator i = pending_infobar_requests_.begin(); 233 for (PendingInfobarRequests::iterator i = pending_infobar_requests_.begin();
228 i != pending_infobar_requests_.end(); ++i) { 234 i != pending_infobar_requests_.end(); ++i) {
229 if (!i->IsForPair(requesting_frame, embedder)) 235 if (!i->IsForPair(requesting_frame, embedder))
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 } 395 }
390 396
391 ContentSetting content_setting = 397 ContentSetting content_setting =
392 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; 398 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK;
393 399
394 HostContentSettingsMapFactory::GetForProfile(profile_) 400 HostContentSettingsMapFactory::GetForProfile(profile_)
395 ->SetContentSettingDefaultScope( 401 ->SetContentSettingDefaultScope(
396 requesting_frame.GetOrigin(), embedder.GetOrigin(), 402 requesting_frame.GetOrigin(), embedder.GetOrigin(),
397 content_settings_type_, std::string(), content_setting); 403 content_settings_type_, std::string(), content_setting);
398 } 404 }
OLDNEW
« no previous file with comments | « chrome/browser/permissions/permission_infobar_delegate.cc ('k') | chrome/browser/permissions/permission_request_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698