Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/push_messaging/push_messaging_permission_context.h" | 5 #include "chrome/browser/push_messaging/push_messaging_permission_context.h" |
| 6 | 6 |
| 7 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 7 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| 8 #include "chrome/browser/permissions/permission_manager.h" | 8 #include "chrome/browser/permissions/permission_manager.h" |
| 9 #include "chrome/browser/permissions/permission_request_id.h" | 9 #include "chrome/browser/permissions/permission_request_id.h" |
| 10 #include "chrome/browser/permissions/permission_uma_util.h" | 10 #include "chrome/browser/permissions/permission_uma_util.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 111 DCHECK_NE(notification_status, blink::mojom::PermissionStatus::ASK); | 111 DCHECK_NE(notification_status, blink::mojom::PermissionStatus::ASK); |
| 112 | 112 |
| 113 ContentSetting push_content_setting = | 113 ContentSetting push_content_setting = |
| 114 HostContentSettingsMapFactory::GetForProfile(profile_) | 114 HostContentSettingsMapFactory::GetForProfile(profile_) |
| 115 ->GetContentSettingAndMaybeUpdateLastUsage( | 115 ->GetContentSettingAndMaybeUpdateLastUsage( |
| 116 requesting_origin, embedding_origin, content_settings_type(), | 116 requesting_origin, embedding_origin, content_settings_type(), |
| 117 std::string()); | 117 std::string()); |
| 118 | 118 |
| 119 if (push_content_setting == CONTENT_SETTING_BLOCK) { | 119 if (push_content_setting == CONTENT_SETTING_BLOCK) { |
| 120 DVLOG(1) << "Push permission was explicitly blocked."; | 120 DVLOG(1) << "Push permission was explicitly blocked."; |
| 121 PermissionUmaUtil::PermissionDenied(permission_type(), requesting_origin, | 121 // TODO(stefanocs): Pass in the actual |user_gesture| once push messaging |
| 122 profile_); | 122 // metrics has been fixed. |
| 123 PermissionUmaUtil::PermissionDenied(permission_type(), | |
|
kcarattini
2016/07/18 07:04:33
Can you specify what you mean by "push messaging m
stefanocs
2016/07/18 07:19:33
Done. I think Raymes is working on this one. Rayme
raymes
2016/07/18 07:31:59
Once this CL is landed it will happen automaticall
stefanocs
2016/07/18 07:40:25
In that case, I will probably just remove the comm
| |
| 124 false /* user_gesture */, | |
| 125 requesting_origin, profile_); | |
| 123 NotifyPermissionSet(id, requesting_origin, embedding_origin, callback, | 126 NotifyPermissionSet(id, requesting_origin, embedding_origin, callback, |
| 124 true /* persist */, CONTENT_SETTING_BLOCK); | 127 true /* persist */, CONTENT_SETTING_BLOCK); |
| 125 return; | 128 return; |
| 126 } | 129 } |
| 127 | 130 |
| 128 if (notification_status == blink::mojom::PermissionStatus::DENIED) { | 131 if (notification_status == blink::mojom::PermissionStatus::DENIED) { |
| 129 DVLOG(1) << "Notification permission has not been granted."; | 132 DVLOG(1) << "Notification permission has not been granted."; |
| 130 NotifyPermissionSet(id, requesting_origin, embedding_origin, callback, | 133 NotifyPermissionSet(id, requesting_origin, embedding_origin, callback, |
| 131 false /* persist */, CONTENT_SETTING_BLOCK); | 134 false /* persist */, CONTENT_SETTING_BLOCK); |
| 132 return; | 135 return; |
| 133 } | 136 } |
| 134 | 137 |
| 135 PermissionUmaUtil::PermissionGranted(permission_type(), requesting_origin, | 138 // TODO(stefanocs): Pass in the actual |user_gesture| once push messaging |
| 136 profile_); | 139 // metrics has been fixed. |
| 140 PermissionUmaUtil::PermissionGranted( | |
| 141 permission_type(), false /* user_gesture */, requesting_origin, profile_); | |
| 137 NotifyPermissionSet(id, requesting_origin, embedding_origin, callback, | 142 NotifyPermissionSet(id, requesting_origin, embedding_origin, callback, |
| 138 true /* persist */, CONTENT_SETTING_ALLOW); | 143 true /* persist */, CONTENT_SETTING_ALLOW); |
| 139 } | 144 } |
| OLD | NEW |