| 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/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/logging.h" | 10 #include "base/logging.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 | 171 |
| 172 #if !defined(OS_ANDROID) | 172 #if !defined(OS_ANDROID) |
| 173 PermissionBubbleManager* bubble_manager = | 173 PermissionBubbleManager* bubble_manager = |
| 174 PermissionBubbleManager::FromWebContents(web_contents); | 174 PermissionBubbleManager::FromWebContents(web_contents); |
| 175 // TODO(felt): sometimes |bubble_manager| is null. This check is meant to | 175 // TODO(felt): sometimes |bubble_manager| is null. This check is meant to |
| 176 // prevent crashes. See crbug.com/457091. | 176 // prevent crashes. See crbug.com/457091. |
| 177 if (!bubble_manager) | 177 if (!bubble_manager) |
| 178 return; | 178 return; |
| 179 std::unique_ptr<PermissionBubbleRequest> request_ptr( | 179 std::unique_ptr<PermissionBubbleRequest> request_ptr( |
| 180 new PermissionBubbleRequestImpl( | 180 new PermissionBubbleRequestImpl( |
| 181 requesting_origin, permission_type_, | 181 requesting_origin, permission_type_, user_gesture, |
| 182 base::Bind(&PermissionContextBase::PermissionDecided, | 182 base::Bind(&PermissionContextBase::PermissionDecided, |
| 183 weak_factory_.GetWeakPtr(), id, requesting_origin, | 183 weak_factory_.GetWeakPtr(), id, requesting_origin, |
| 184 embedding_origin, callback), | 184 embedding_origin, callback), |
| 185 base::Bind(&PermissionContextBase::CleanUpBubble, | 185 base::Bind(&PermissionContextBase::CleanUpBubble, |
| 186 weak_factory_.GetWeakPtr(), id))); | 186 weak_factory_.GetWeakPtr(), id))); |
| 187 PermissionBubbleRequest* request = request_ptr.get(); | 187 PermissionBubbleRequest* request = request_ptr.get(); |
| 188 | 188 |
| 189 bool inserted = | 189 bool inserted = |
| 190 pending_bubbles_.add(id.ToString(), std::move(request_ptr)).second; | 190 pending_bubbles_.add(id.ToString(), std::move(request_ptr)).second; |
| 191 DCHECK(inserted) << "Duplicate id " << id.ToString(); | 191 DCHECK(inserted) << "Duplicate id " << id.ToString(); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 content_setting); | 284 content_setting); |
| 285 } | 285 } |
| 286 | 286 |
| 287 bool PermissionContextBase::IsPermissionKillSwitchOn() const { | 287 bool PermissionContextBase::IsPermissionKillSwitchOn() const { |
| 288 const std::string param = variations::GetVariationParamValue( | 288 const std::string param = variations::GetVariationParamValue( |
| 289 kPermissionsKillSwitchFieldStudy, | 289 kPermissionsKillSwitchFieldStudy, |
| 290 PermissionUtil::GetPermissionString(permission_type_)); | 290 PermissionUtil::GetPermissionString(permission_type_)); |
| 291 | 291 |
| 292 return param == kPermissionsKillSwitchBlockedValue; | 292 return param == kPermissionsKillSwitchBlockedValue; |
| 293 } | 293 } |
| OLD | NEW |