Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(366)

Side by Side Diff: chrome/browser/services/gcm/push_messaging_permission_context.cc

Issue 896173002: Clean-up refactoring of chrome_content_browser_client to use GetPermissionContext consistently. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix linker Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 NOTIMPLEMENTED() << "CancelPermission not implemented for push messaging";
Peter Beverloo 2015/02/04 14:56:53 Does Push need to implement CancelPermissionReques
timvolodine 2015/02/04 16:15:37 This was actually meant as a refactoring, and I ad
69 }
70
66 // Unlike other permissions, push is decided by the following algorithm 71 // Unlike other permissions, push is decided by the following algorithm
67 // - You need to request it from a top level domain 72 // - You need to request it from a top level domain
68 // - You need to have notification permission granted. 73 // - You need to have notification permission granted.
69 // - You need to not have push permission explicitly blocked. 74 // - You need to not have push permission explicitly blocked.
70 // - If those two things are true it is granted without prompting. 75 // - If those two things are true it is granted without prompting.
71 // This is done to avoid double prompting for notifications and push. 76 // This is done to avoid double prompting for notifications and push.
72 void PushMessagingPermissionContext::DecidePermission( 77 void PushMessagingPermissionContext::DecidePermission(
73 content::WebContents* web_contents, 78 content::WebContents* web_contents,
74 const PermissionRequestID& id, 79 const PermissionRequestID& id,
75 const GURL& requesting_origin, 80 const GURL& requesting_origin,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 return; 132 return;
128 } 133 }
129 134
130 PermissionContextUmaUtil::PermissionGranted(kPushSettingType, 135 PermissionContextUmaUtil::PermissionGranted(kPushSettingType,
131 requesting_origin); 136 requesting_origin);
132 NotifyPermissionSet(id, requesting_origin, embedding_origin, callback, 137 NotifyPermissionSet(id, requesting_origin, embedding_origin, callback,
133 true /* persist */, true /* granted */); 138 true /* persist */, true /* granted */);
134 } 139 }
135 } // namespace gcm 140 } // namespace gcm
136 141
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698