| 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/content_settings/permission_context_base.h" | 5 #include "chrome/browser/content_settings/permission_context_base.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "chrome/browser/content_settings/permission_bubble_request_impl.h" | 9 #include "chrome/browser/content_settings/permission_bubble_request_impl.h" |
| 10 #include "chrome/browser/content_settings/permission_context_uma_util.h" | 10 #include "chrome/browser/content_settings/permission_context_uma_util.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 callback); | 48 callback); |
| 49 } | 49 } |
| 50 | 50 |
| 51 ContentSetting PermissionContextBase::GetPermissionStatus( | 51 ContentSetting PermissionContextBase::GetPermissionStatus( |
| 52 const GURL& requesting_origin, | 52 const GURL& requesting_origin, |
| 53 const GURL& embedding_origin) const { | 53 const GURL& embedding_origin) const { |
| 54 return profile_->GetHostContentSettingsMap()->GetContentSetting( | 54 return profile_->GetHostContentSettingsMap()->GetContentSetting( |
| 55 requesting_origin, embedding_origin, permission_type_, std::string()); | 55 requesting_origin, embedding_origin, permission_type_, std::string()); |
| 56 } | 56 } |
| 57 | 57 |
| 58 void PermissionContextBase::ResetPermission( |
| 59 const GURL& requesting_origin, |
| 60 const GURL& embedding_origin) { |
| 61 profile_->GetHostContentSettingsMap()->SetContentSetting( |
| 62 ContentSettingsPattern::FromURLNoWildcard(requesting_origin), |
| 63 ContentSettingsPattern::FromURLNoWildcard(embedding_origin), |
| 64 permission_type_, std::string(), CONTENT_SETTING_DEFAULT); |
| 65 } |
| 66 |
| 58 void PermissionContextBase::CancelPermissionRequest( | 67 void PermissionContextBase::CancelPermissionRequest( |
| 59 content::WebContents* web_contents, | 68 content::WebContents* web_contents, |
| 60 const PermissionRequestID& id) { | 69 const PermissionRequestID& id) { |
| 61 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 70 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 62 | 71 |
| 63 if (PermissionBubbleManager::Enabled()) { | 72 if (PermissionBubbleManager::Enabled()) { |
| 64 PermissionBubbleRequest* cancelling = | 73 PermissionBubbleRequest* cancelling = |
| 65 pending_bubbles_.get(id.ToString()); | 74 pending_bubbles_.get(id.ToString()); |
| 66 if (cancelling != NULL && web_contents != NULL && | 75 if (cancelling != NULL && web_contents != NULL && |
| 67 PermissionBubbleManager::FromWebContents(web_contents) != NULL) { | 76 PermissionBubbleManager::FromWebContents(web_contents) != NULL) { |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 bool allowed) { | 222 bool allowed) { |
| 214 DCHECK_EQ(requesting_origin, requesting_origin.GetOrigin()); | 223 DCHECK_EQ(requesting_origin, requesting_origin.GetOrigin()); |
| 215 DCHECK_EQ(embedding_origin, embedding_origin.GetOrigin()); | 224 DCHECK_EQ(embedding_origin, embedding_origin.GetOrigin()); |
| 216 ContentSetting content_setting = | 225 ContentSetting content_setting = |
| 217 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; | 226 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; |
| 218 profile_->GetHostContentSettingsMap()->SetContentSetting( | 227 profile_->GetHostContentSettingsMap()->SetContentSetting( |
| 219 ContentSettingsPattern::FromURLNoWildcard(requesting_origin), | 228 ContentSettingsPattern::FromURLNoWildcard(requesting_origin), |
| 220 ContentSettingsPattern::FromURLNoWildcard(embedding_origin), | 229 ContentSettingsPattern::FromURLNoWildcard(embedding_origin), |
| 221 permission_type_, std::string(), content_setting); | 230 permission_type_, std::string(), content_setting); |
| 222 } | 231 } |
| OLD | NEW |