Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(608)

Side by Side Diff: chrome/browser/content_settings/permission_context_base.cc

Issue 1023213002: It is possible to sometimes have a null PermissionBubbleManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove dcheck Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 } 118 }
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 // TODO(mlamouri): sometimes |bubble_manager| is null. This check is meant
129 // to prevent crashes. See bug 457091.
130 if (!bubble_manager)
131 return;
129 scoped_ptr<PermissionBubbleRequest> request_ptr( 132 scoped_ptr<PermissionBubbleRequest> request_ptr(
130 new PermissionBubbleRequestImpl( 133 new PermissionBubbleRequestImpl(
131 requesting_origin, user_gesture, permission_type_, 134 requesting_origin, user_gesture, permission_type_,
132 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages), 135 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages),
133 base::Bind(&PermissionContextBase::PermissionDecided, 136 base::Bind(&PermissionContextBase::PermissionDecided,
134 weak_factory_.GetWeakPtr(), id, requesting_origin, 137 weak_factory_.GetWeakPtr(), id, requesting_origin,
135 embedding_origin, callback), 138 embedding_origin, callback),
136 base::Bind(&PermissionContextBase::CleanUpBubble, 139 base::Bind(&PermissionContextBase::CleanUpBubble,
137 weak_factory_.GetWeakPtr(), id))); 140 weak_factory_.GetWeakPtr(), id)));
138 PermissionBubbleRequest* request = request_ptr.get(); 141 PermissionBubbleRequest* request = request_ptr.get();
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 DCHECK_EQ(requesting_origin, requesting_origin.GetOrigin()); 234 DCHECK_EQ(requesting_origin, requesting_origin.GetOrigin());
232 DCHECK_EQ(embedding_origin, embedding_origin.GetOrigin()); 235 DCHECK_EQ(embedding_origin, embedding_origin.GetOrigin());
233 DCHECK(content_setting == CONTENT_SETTING_ALLOW || 236 DCHECK(content_setting == CONTENT_SETTING_ALLOW ||
234 content_setting == CONTENT_SETTING_BLOCK); 237 content_setting == CONTENT_SETTING_BLOCK);
235 238
236 profile_->GetHostContentSettingsMap()->SetContentSetting( 239 profile_->GetHostContentSettingsMap()->SetContentSetting(
237 ContentSettingsPattern::FromURLNoWildcard(requesting_origin), 240 ContentSettingsPattern::FromURLNoWildcard(requesting_origin),
238 ContentSettingsPattern::FromURLNoWildcard(embedding_origin), 241 ContentSettingsPattern::FromURLNoWildcard(embedding_origin),
239 permission_type_, std::string(), content_setting); 242 permission_type_, std::string(), content_setting);
240 } 243 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698