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

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: 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 }
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