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/services/gcm/push_messaging_permission_context.h" | 5 #include "chrome/browser/services/gcm/push_messaging_permission_context.h" |
6 | 6 |
7 #include "chrome/browser/content_settings/permission_context_uma_util.h" | 7 #include "chrome/browser/content_settings/permission_context_uma_util.h" |
8 #include "chrome/browser/notifications/desktop_notification_service.h" | 8 #include "chrome/browser/notifications/desktop_notification_service.h" |
9 #include "chrome/browser/notifications/desktop_notification_service_factory.h" | 9 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 return CONTENT_SETTING_ASK; | 56 return CONTENT_SETTING_ASK; |
57 } | 57 } |
58 DCHECK_EQ(CONTENT_SETTING_ALLOW, notifications_permission); | 58 DCHECK_EQ(CONTENT_SETTING_ALLOW, notifications_permission); |
59 DCHECK_EQ(CONTENT_SETTING_ALLOW, push_content_setting); | 59 DCHECK_EQ(CONTENT_SETTING_ALLOW, push_content_setting); |
60 return CONTENT_SETTING_ALLOW; | 60 return CONTENT_SETTING_ALLOW; |
61 #else | 61 #else |
62 return CONTENT_SETTING_BLOCK; | 62 return CONTENT_SETTING_BLOCK; |
63 #endif | 63 #endif |
64 } | 64 } |
65 | 65 |
| 66 void PushMessagingPermissionContext::CancelPermissionRequest( |
| 67 content::WebContents* web_contents, const PermissionRequestID& id) { |
| 68 // TODO(peter): consider implementing this method. |
| 69 NOTIMPLEMENTED() << "CancelPermission not implemented for push messaging"; |
| 70 } |
| 71 |
66 // Unlike other permissions, push is decided by the following algorithm | 72 // Unlike other permissions, push is decided by the following algorithm |
67 // - You need to request it from a top level domain | 73 // - You need to request it from a top level domain |
68 // - You need to have notification permission granted. | 74 // - You need to have notification permission granted. |
69 // - You need to not have push permission explicitly blocked. | 75 // - You need to not have push permission explicitly blocked. |
70 // - If those two things are true it is granted without prompting. | 76 // - If those two things are true it is granted without prompting. |
71 // This is done to avoid double prompting for notifications and push. | 77 // This is done to avoid double prompting for notifications and push. |
72 void PushMessagingPermissionContext::DecidePermission( | 78 void PushMessagingPermissionContext::DecidePermission( |
73 content::WebContents* web_contents, | 79 content::WebContents* web_contents, |
74 const PermissionRequestID& id, | 80 const PermissionRequestID& id, |
75 const GURL& requesting_origin, | 81 const GURL& requesting_origin, |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 return; | 133 return; |
128 } | 134 } |
129 | 135 |
130 PermissionContextUmaUtil::PermissionGranted(kPushSettingType, | 136 PermissionContextUmaUtil::PermissionGranted(kPushSettingType, |
131 requesting_origin); | 137 requesting_origin); |
132 NotifyPermissionSet(id, requesting_origin, embedding_origin, callback, | 138 NotifyPermissionSet(id, requesting_origin, embedding_origin, callback, |
133 true /* persist */, true /* granted */); | 139 true /* persist */, true /* granted */); |
134 } | 140 } |
135 } // namespace gcm | 141 } // namespace gcm |
136 | 142 |
OLD | NEW |