| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 false /* persist */, true /* granted */); | 111 false /* persist */, true /* granted */); |
| 112 return; | 112 return; |
| 113 default: | 113 default: |
| 114 break; | 114 break; |
| 115 } | 115 } |
| 116 | 116 |
| 117 PermissionContextUmaUtil::PermissionRequested( | 117 PermissionContextUmaUtil::PermissionRequested( |
| 118 permission_type_, requesting_origin); | 118 permission_type_, requesting_origin); |
| 119 | 119 |
| 120 if (PermissionBubbleManager::Enabled()) { | 120 if (PermissionBubbleManager::Enabled()) { |
| 121 if (pending_bubbles_.get(id.ToString()) != NULL) |
| 122 return; |
| 121 PermissionBubbleManager* bubble_manager = | 123 PermissionBubbleManager* bubble_manager = |
| 122 PermissionBubbleManager::FromWebContents(web_contents); | 124 PermissionBubbleManager::FromWebContents(web_contents); |
| 123 DCHECK(bubble_manager); | 125 DCHECK(bubble_manager); |
| 124 scoped_ptr<PermissionBubbleRequest> request_ptr( | 126 scoped_ptr<PermissionBubbleRequest> request_ptr( |
| 125 new PermissionBubbleRequestImpl( | 127 new PermissionBubbleRequestImpl( |
| 126 requesting_origin, user_gesture, permission_type_, | 128 requesting_origin, user_gesture, permission_type_, |
| 127 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages), | 129 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages), |
| 128 base::Bind(&PermissionContextBase::PermissionDecided, | 130 base::Bind(&PermissionContextBase::PermissionDecided, |
| 129 weak_factory_.GetWeakPtr(), id, requesting_origin, | 131 weak_factory_.GetWeakPtr(), id, requesting_origin, |
| 130 embedding_origin, callback), | 132 embedding_origin, callback), |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 bool allowed) { | 213 bool allowed) { |
| 212 DCHECK_EQ(requesting_origin, requesting_origin.GetOrigin()); | 214 DCHECK_EQ(requesting_origin, requesting_origin.GetOrigin()); |
| 213 DCHECK_EQ(embedding_origin, embedding_origin.GetOrigin()); | 215 DCHECK_EQ(embedding_origin, embedding_origin.GetOrigin()); |
| 214 ContentSetting content_setting = | 216 ContentSetting content_setting = |
| 215 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; | 217 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; |
| 216 profile_->GetHostContentSettingsMap()->SetContentSetting( | 218 profile_->GetHostContentSettingsMap()->SetContentSetting( |
| 217 ContentSettingsPattern::FromURLNoWildcard(requesting_origin), | 219 ContentSettingsPattern::FromURLNoWildcard(requesting_origin), |
| 218 ContentSettingsPattern::FromURLNoWildcard(embedding_origin), | 220 ContentSettingsPattern::FromURLNoWildcard(embedding_origin), |
| 219 permission_type_, std::string(), content_setting); | 221 permission_type_, std::string(), content_setting); |
| 220 } | 222 } |
| OLD | NEW |