OLD | NEW |
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" |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 void PermissionQueueController::OnPermissionSet( | 199 void PermissionQueueController::OnPermissionSet( |
200 const PermissionRequestID& id, | 200 const PermissionRequestID& id, |
201 const GURL& requesting_frame, | 201 const GURL& requesting_frame, |
202 const GURL& embedder, | 202 const GURL& embedder, |
203 bool update_content_setting, | 203 bool update_content_setting, |
204 bool allowed) { | 204 bool allowed) { |
205 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 205 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
206 | 206 |
207 // TODO(miguelg): move the permission persistence to | 207 // TODO(miguelg): move the permission persistence to |
208 // PermissionContextBase once all the types are moved there. | 208 // PermissionContextBase once all the types are moved there. |
| 209 // TODO(stefanocs): Pass the actual |gesture_type| value to PermissionUmaUtil. |
209 if (update_content_setting) { | 210 if (update_content_setting) { |
210 UpdateContentSetting(requesting_frame, embedder, allowed); | 211 UpdateContentSetting(requesting_frame, embedder, allowed); |
211 if (allowed) | 212 if (allowed) { |
212 PermissionUmaUtil::PermissionGranted(permission_type_, requesting_frame, | 213 PermissionUmaUtil::PermissionGranted( |
213 profile_); | 214 permission_type_, PermissionRequestGestureType::UNKNOWN, |
214 else | 215 requesting_frame, profile_); |
215 PermissionUmaUtil::PermissionDenied(permission_type_, requesting_frame, | 216 } else { |
216 profile_); | 217 PermissionUmaUtil::PermissionDenied(permission_type_, |
| 218 PermissionRequestGestureType::UNKNOWN, |
| 219 requesting_frame, profile_); |
| 220 } |
217 } else { | 221 } else { |
218 PermissionUmaUtil::PermissionDismissed(permission_type_, requesting_frame, | 222 PermissionUmaUtil::PermissionDismissed( |
219 profile_); | 223 permission_type_, PermissionRequestGestureType::UNKNOWN, |
| 224 requesting_frame, profile_); |
220 } | 225 } |
221 | 226 |
222 // Cancel this request first, then notify listeners. TODO(pkasting): Why | 227 // Cancel this request first, then notify listeners. TODO(pkasting): Why |
223 // is this order important? | 228 // is this order important? |
224 PendingInfobarRequests requests_to_notify; | 229 PendingInfobarRequests requests_to_notify; |
225 PendingInfobarRequests infobars_to_remove; | 230 PendingInfobarRequests infobars_to_remove; |
226 std::vector<PendingInfobarRequests::iterator> pending_requests_to_remove; | 231 std::vector<PendingInfobarRequests::iterator> pending_requests_to_remove; |
227 for (PendingInfobarRequests::iterator i = pending_infobar_requests_.begin(); | 232 for (PendingInfobarRequests::iterator i = pending_infobar_requests_.begin(); |
228 i != pending_infobar_requests_.end(); ++i) { | 233 i != pending_infobar_requests_.end(); ++i) { |
229 if (!i->IsForPair(requesting_frame, embedder)) | 234 if (!i->IsForPair(requesting_frame, embedder)) |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 } | 394 } |
390 | 395 |
391 ContentSetting content_setting = | 396 ContentSetting content_setting = |
392 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; | 397 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; |
393 | 398 |
394 HostContentSettingsMapFactory::GetForProfile(profile_) | 399 HostContentSettingsMapFactory::GetForProfile(profile_) |
395 ->SetContentSettingDefaultScope( | 400 ->SetContentSettingDefaultScope( |
396 requesting_frame.GetOrigin(), embedder.GetOrigin(), | 401 requesting_frame.GetOrigin(), embedder.GetOrigin(), |
397 content_settings_type_, std::string(), content_setting); | 402 content_settings_type_, std::string(), content_setting); |
398 } | 403 } |
OLD | NEW |