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

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

Issue 799783002: Dismiss permission bubble request if it's a duplicate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add DCHECK Created 5 years, 10 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 }
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