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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
110 NotifyPermissionSet(id, requesting_origin, embedding_origin, callback, | 110 NotifyPermissionSet(id, requesting_origin, embedding_origin, callback, |
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 // The request should only be null if the request_ptr has destructed, which | |
121 // should not normally happen before this invoked. | |
122 // TODO(felt): crbug.com/433877, where a bug causes this to occur. | |
123 DCHECK(pending_bubbles_.get(id.ToString()) != NULL); | |
groby-ooo-7-16
2015/01/28 22:47:00
Please don't do that - style guide explicitly call
felt
2015/01/29 06:06:06
Done. Picked error handling.
| |
124 if (pending_bubbles_.get(id.ToString()) != NULL) | |
125 return; | |
126 | |
120 if (PermissionBubbleManager::Enabled()) { | 127 if (PermissionBubbleManager::Enabled()) { |
121 PermissionBubbleManager* bubble_manager = | 128 PermissionBubbleManager* bubble_manager = |
122 PermissionBubbleManager::FromWebContents(web_contents); | 129 PermissionBubbleManager::FromWebContents(web_contents); |
123 DCHECK(bubble_manager); | 130 DCHECK(bubble_manager); |
124 scoped_ptr<PermissionBubbleRequest> request_ptr( | 131 scoped_ptr<PermissionBubbleRequest> request_ptr( |
125 new PermissionBubbleRequestImpl( | 132 new PermissionBubbleRequestImpl( |
126 requesting_origin, user_gesture, permission_type_, | 133 requesting_origin, user_gesture, permission_type_, |
127 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages), | 134 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages), |
128 base::Bind(&PermissionContextBase::PermissionDecided, | 135 base::Bind(&PermissionContextBase::PermissionDecided, |
129 weak_factory_.GetWeakPtr(), id, requesting_origin, | 136 weak_factory_.GetWeakPtr(), id, requesting_origin, |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
211 bool allowed) { | 218 bool allowed) { |
212 DCHECK_EQ(requesting_origin, requesting_origin.GetOrigin()); | 219 DCHECK_EQ(requesting_origin, requesting_origin.GetOrigin()); |
213 DCHECK_EQ(embedding_origin, embedding_origin.GetOrigin()); | 220 DCHECK_EQ(embedding_origin, embedding_origin.GetOrigin()); |
214 ContentSetting content_setting = | 221 ContentSetting content_setting = |
215 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; | 222 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; |
216 profile_->GetHostContentSettingsMap()->SetContentSetting( | 223 profile_->GetHostContentSettingsMap()->SetContentSetting( |
217 ContentSettingsPattern::FromURLNoWildcard(requesting_origin), | 224 ContentSettingsPattern::FromURLNoWildcard(requesting_origin), |
218 ContentSettingsPattern::FromURLNoWildcard(embedding_origin), | 225 ContentSettingsPattern::FromURLNoWildcard(embedding_origin), |
219 permission_type_, std::string(), content_setting); | 226 permission_type_, std::string(), content_setting); |
220 } | 227 } |
OLD | NEW |