Chromium Code Reviews| 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 205 size_t success = pending_bubbles_.erase(id.ToString()); | 214 size_t success = pending_bubbles_.erase(id.ToString()); |
| 206 DCHECK(success == 1) << "Missing request " << id.ToString(); | 215 DCHECK(success == 1) << "Missing request " << id.ToString(); |
| 207 } | 216 } |
| 208 | 217 |
| 209 void PermissionContextBase::UpdateContentSetting(const GURL& requesting_origin, | 218 void PermissionContextBase::UpdateContentSetting(const GURL& requesting_origin, |
| 210 const GURL& embedding_origin, | 219 const GURL& embedding_origin, |
| 211 bool allowed) { | 220 bool allowed) { |
| 212 DCHECK_EQ(requesting_origin, requesting_origin.GetOrigin()); | 221 DCHECK_EQ(requesting_origin, requesting_origin.GetOrigin()); |
| 213 DCHECK_EQ(embedding_origin, embedding_origin.GetOrigin()); | 222 DCHECK_EQ(embedding_origin, embedding_origin.GetOrigin()); |
| 214 ContentSetting content_setting = | 223 ContentSetting content_setting = |
| 215 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; | 224 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; |
|
mlamouri (slow - plz ping)
2015/01/26 10:38:17
nit: I don't think you meant to do that change, yo
timvolodine
2015/01/30 14:07:46
Done.
| |
| 216 profile_->GetHostContentSettingsMap()->SetContentSetting( | 225 profile_->GetHostContentSettingsMap()->SetContentSetting( |
| 217 ContentSettingsPattern::FromURLNoWildcard(requesting_origin), | 226 ContentSettingsPattern::FromURLNoWildcard(requesting_origin), |
| 218 ContentSettingsPattern::FromURLNoWildcard(embedding_origin), | 227 ContentSettingsPattern::FromURLNoWildcard(embedding_origin), |
| 219 permission_type_, std::string(), content_setting); | 228 permission_type_, std::string(), content_setting); |
| 220 } | 229 } |
| OLD | NEW |