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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
119 | 119 |
120 PermissionContextUmaUtil::PermissionRequested( | 120 PermissionContextUmaUtil::PermissionRequested( |
121 permission_type_, requesting_origin); | 121 permission_type_, requesting_origin); |
122 | 122 |
123 if (PermissionBubbleManager::Enabled()) { | 123 if (PermissionBubbleManager::Enabled()) { |
124 if (pending_bubbles_.get(id.ToString()) != NULL) | 124 if (pending_bubbles_.get(id.ToString()) != NULL) |
125 return; | 125 return; |
126 PermissionBubbleManager* bubble_manager = | 126 PermissionBubbleManager* bubble_manager = |
127 PermissionBubbleManager::FromWebContents(web_contents); | 127 PermissionBubbleManager::FromWebContents(web_contents); |
128 DCHECK(bubble_manager); | 128 DCHECK(bubble_manager); |
129 if (!bubble_manager) | |
felt
2015/03/20 14:44:17
i think style is to have either a DCHECK or an if,
mlamouri (slow - plz ping)
2015/03/20 14:51:49
The if is really there just to prevent the crash.
felt
2015/03/20 15:00:42
http://www.chromium.org/developers/coding-style#TO
| |
130 return; | |
129 scoped_ptr<PermissionBubbleRequest> request_ptr( | 131 scoped_ptr<PermissionBubbleRequest> request_ptr( |
130 new PermissionBubbleRequestImpl( | 132 new PermissionBubbleRequestImpl( |
131 requesting_origin, user_gesture, permission_type_, | 133 requesting_origin, user_gesture, permission_type_, |
132 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages), | 134 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages), |
133 base::Bind(&PermissionContextBase::PermissionDecided, | 135 base::Bind(&PermissionContextBase::PermissionDecided, |
134 weak_factory_.GetWeakPtr(), id, requesting_origin, | 136 weak_factory_.GetWeakPtr(), id, requesting_origin, |
135 embedding_origin, callback), | 137 embedding_origin, callback), |
136 base::Bind(&PermissionContextBase::CleanUpBubble, | 138 base::Bind(&PermissionContextBase::CleanUpBubble, |
137 weak_factory_.GetWeakPtr(), id))); | 139 weak_factory_.GetWeakPtr(), id))); |
138 PermissionBubbleRequest* request = request_ptr.get(); | 140 PermissionBubbleRequest* request = request_ptr.get(); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
231 DCHECK_EQ(requesting_origin, requesting_origin.GetOrigin()); | 233 DCHECK_EQ(requesting_origin, requesting_origin.GetOrigin()); |
232 DCHECK_EQ(embedding_origin, embedding_origin.GetOrigin()); | 234 DCHECK_EQ(embedding_origin, embedding_origin.GetOrigin()); |
233 DCHECK(content_setting == CONTENT_SETTING_ALLOW || | 235 DCHECK(content_setting == CONTENT_SETTING_ALLOW || |
234 content_setting == CONTENT_SETTING_BLOCK); | 236 content_setting == CONTENT_SETTING_BLOCK); |
235 | 237 |
236 profile_->GetHostContentSettingsMap()->SetContentSetting( | 238 profile_->GetHostContentSettingsMap()->SetContentSetting( |
237 ContentSettingsPattern::FromURLNoWildcard(requesting_origin), | 239 ContentSettingsPattern::FromURLNoWildcard(requesting_origin), |
238 ContentSettingsPattern::FromURLNoWildcard(embedding_origin), | 240 ContentSettingsPattern::FromURLNoWildcard(embedding_origin), |
239 permission_type_, std::string(), content_setting); | 241 permission_type_, std::string(), content_setting); |
240 } | 242 } |
OLD | NEW |