Chromium Code Reviews| 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 |user_gesture| 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) |
|
raymes
2016/07/18 07:31:59
nit add {}
stefanocs
2016/07/18 07:40:26
Done.
| |
| 212 PermissionUmaUtil::PermissionGranted(permission_type_, requesting_frame, | 213 PermissionUmaUtil::PermissionGranted(permission_type_, |
| 213 profile_); | 214 false /* user_gesture */, |
| 215 requesting_frame, profile_); | |
| 214 else | 216 else |
| 215 PermissionUmaUtil::PermissionDenied(permission_type_, requesting_frame, | 217 PermissionUmaUtil::PermissionDenied(permission_type_, |
| 216 profile_); | 218 false /* user_gesture */, |
| 219 requesting_frame, profile_); | |
| 217 } else { | 220 } else { |
| 218 PermissionUmaUtil::PermissionDismissed(permission_type_, requesting_frame, | 221 PermissionUmaUtil::PermissionDismissed( |
| 219 profile_); | 222 permission_type_, false /* user_gesture */, requesting_frame, profile_); |
| 220 } | 223 } |
| 221 | 224 |
| 222 // Cancel this request first, then notify listeners. TODO(pkasting): Why | 225 // Cancel this request first, then notify listeners. TODO(pkasting): Why |
| 223 // is this order important? | 226 // is this order important? |
| 224 PendingInfobarRequests requests_to_notify; | 227 PendingInfobarRequests requests_to_notify; |
| 225 PendingInfobarRequests infobars_to_remove; | 228 PendingInfobarRequests infobars_to_remove; |
| 226 std::vector<PendingInfobarRequests::iterator> pending_requests_to_remove; | 229 std::vector<PendingInfobarRequests::iterator> pending_requests_to_remove; |
| 227 for (PendingInfobarRequests::iterator i = pending_infobar_requests_.begin(); | 230 for (PendingInfobarRequests::iterator i = pending_infobar_requests_.begin(); |
| 228 i != pending_infobar_requests_.end(); ++i) { | 231 i != pending_infobar_requests_.end(); ++i) { |
| 229 if (!i->IsForPair(requesting_frame, embedder)) | 232 if (!i->IsForPair(requesting_frame, embedder)) |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 389 } | 392 } |
| 390 | 393 |
| 391 ContentSetting content_setting = | 394 ContentSetting content_setting = |
| 392 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; | 395 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; |
| 393 | 396 |
| 394 HostContentSettingsMapFactory::GetForProfile(profile_) | 397 HostContentSettingsMapFactory::GetForProfile(profile_) |
| 395 ->SetContentSettingDefaultScope( | 398 ->SetContentSettingDefaultScope( |
| 396 requesting_frame.GetOrigin(), embedder.GetOrigin(), | 399 requesting_frame.GetOrigin(), embedder.GetOrigin(), |
| 397 content_settings_type_, std::string(), content_setting); | 400 content_settings_type_, std::string(), content_setting); |
| 398 } | 401 } |
| OLD | NEW |