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