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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 const GURL& embedder, | 198 const GURL& embedder, |
199 bool update_content_setting, | 199 bool update_content_setting, |
200 bool allowed) { | 200 bool allowed) { |
201 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 201 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
202 | 202 |
203 // TODO(miguelg): move the permission persistence to | 203 // TODO(miguelg): move the permission persistence to |
204 // PermissionContextBase once all the types are moved there. | 204 // PermissionContextBase once all the types are moved there. |
205 if (update_content_setting) { | 205 if (update_content_setting) { |
206 UpdateContentSetting(requesting_frame, embedder, allowed); | 206 UpdateContentSetting(requesting_frame, embedder, allowed); |
207 if (allowed) | 207 if (allowed) |
208 PermissionUmaUtil::PermissionGranted(permission_type_, requesting_frame); | 208 PermissionUmaUtil::PermissionGranted(permission_type_, requesting_frame, |
| 209 profile_); |
209 else | 210 else |
210 PermissionUmaUtil::PermissionDenied(permission_type_, requesting_frame); | 211 PermissionUmaUtil::PermissionDenied(permission_type_, requesting_frame, |
| 212 profile_); |
211 } else { | 213 } else { |
212 PermissionUmaUtil::PermissionDismissed(permission_type_, requesting_frame); | 214 PermissionUmaUtil::PermissionDismissed(permission_type_, requesting_frame, |
| 215 profile_); |
213 } | 216 } |
214 | 217 |
215 // Cancel this request first, then notify listeners. TODO(pkasting): Why | 218 // Cancel this request first, then notify listeners. TODO(pkasting): Why |
216 // is this order important? | 219 // is this order important? |
217 PendingInfobarRequests requests_to_notify; | 220 PendingInfobarRequests requests_to_notify; |
218 PendingInfobarRequests infobars_to_remove; | 221 PendingInfobarRequests infobars_to_remove; |
219 std::vector<PendingInfobarRequests::iterator> pending_requests_to_remove; | 222 std::vector<PendingInfobarRequests::iterator> pending_requests_to_remove; |
220 for (PendingInfobarRequests::iterator i = pending_infobar_requests_.begin(); | 223 for (PendingInfobarRequests::iterator i = pending_infobar_requests_.begin(); |
221 i != pending_infobar_requests_.end(); ++i) { | 224 i != pending_infobar_requests_.end(); ++i) { |
222 if (!i->IsForPair(requesting_frame, embedder)) | 225 if (!i->IsForPair(requesting_frame, embedder)) |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 } | 385 } |
383 | 386 |
384 ContentSetting content_setting = | 387 ContentSetting content_setting = |
385 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; | 388 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; |
386 | 389 |
387 HostContentSettingsMapFactory::GetForProfile(profile_) | 390 HostContentSettingsMapFactory::GetForProfile(profile_) |
388 ->SetContentSettingDefaultScope( | 391 ->SetContentSettingDefaultScope( |
389 requesting_frame.GetOrigin(), embedder.GetOrigin(), | 392 requesting_frame.GetOrigin(), embedder.GetOrigin(), |
390 content_settings_type_, std::string(), content_setting); | 393 content_settings_type_, std::string(), content_setting); |
391 } | 394 } |
OLD | NEW |