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

Side by Side Diff: chrome/browser/permissions/permission_context_base.cc

Issue 2448893002: Check switch flag in CancelPermissionRequest (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/permissions/permission_context_base.h" 5 #include "chrome/browser/permissions/permission_context_base.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 ->SetContentSettingDefaultScope(requesting_origin, embedding_origin, 145 ->SetContentSettingDefaultScope(requesting_origin, embedding_origin,
146 content_settings_type_, std::string(), 146 content_settings_type_, std::string(),
147 CONTENT_SETTING_DEFAULT); 147 CONTENT_SETTING_DEFAULT);
148 } 148 }
149 149
150 void PermissionContextBase::CancelPermissionRequest( 150 void PermissionContextBase::CancelPermissionRequest(
151 content::WebContents* web_contents, 151 content::WebContents* web_contents,
152 const PermissionRequestID& id) { 152 const PermissionRequestID& id) {
153 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 153 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
154 154
155 if (PermissionRequestManager::IsEnabled()) {
156 PermissionRequest* cancelling = pending_requests_.get(id.ToString());
157 if (cancelling != NULL && web_contents != NULL &&
raymes 2016/10/27 04:35:52 nit: nullptr
lshang 2016/10/27 06:45:20 Done.
158 PermissionRequestManager::FromWebContents(web_contents) != NULL) {
159 PermissionRequestManager::FromWebContents(web_contents)
160 ->CancelRequest(cancelling);
161 }
162 } else {
155 #if defined(OS_ANDROID) 163 #if defined(OS_ANDROID)
156 GetQueueController()->CancelInfoBarRequest(id); 164 GetQueueController()->CancelInfoBarRequest(id);
157 #else 165 #else
158 PermissionRequest* cancelling = pending_requests_.get(id.ToString()); 166 NOTREACHED();
159 if (cancelling != NULL && web_contents != NULL && 167 #endif
160 PermissionRequestManager::FromWebContents(web_contents) != NULL) {
161 PermissionRequestManager::FromWebContents(web_contents)
162 ->CancelRequest(cancelling);
163 } 168 }
164 #endif
165 } 169 }
166 170
167 void PermissionContextBase::DecidePermission( 171 void PermissionContextBase::DecidePermission(
168 content::WebContents* web_contents, 172 content::WebContents* web_contents,
169 const PermissionRequestID& id, 173 const PermissionRequestID& id,
170 const GURL& requesting_origin, 174 const GURL& requesting_origin,
171 const GURL& embedding_origin, 175 const GURL& embedding_origin,
172 bool user_gesture, 176 bool user_gesture,
173 const BrowserPermissionCallback& callback) { 177 const BrowserPermissionCallback& callback) {
174 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 178 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 content_setting); 309 content_setting);
306 } 310 }
307 311
308 bool PermissionContextBase::IsPermissionKillSwitchOn() const { 312 bool PermissionContextBase::IsPermissionKillSwitchOn() const {
309 const std::string param = variations::GetVariationParamValue( 313 const std::string param = variations::GetVariationParamValue(
310 kPermissionsKillSwitchFieldStudy, 314 kPermissionsKillSwitchFieldStudy,
311 PermissionUtil::GetPermissionString(permission_type_)); 315 PermissionUtil::GetPermissionString(permission_type_));
312 316
313 return param == kPermissionsKillSwitchBlockedValue; 317 return param == kPermissionsKillSwitchBlockedValue;
314 } 318 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698