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

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

Issue 107413006: Dismiss EME infobar when WebMediaPlayer is destroyed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Version2: added group_id to PermissionRequestID class Created 6 years, 11 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_queue_controller.h" 5 #include "chrome/browser/content_settings/permission_queue_controller.h"
6 6
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "chrome/browser/chrome_notification_types.h" 8 #include "chrome/browser/chrome_notification_types.h"
9 #include "chrome/browser/content_settings/host_content_settings_map.h" 9 #include "chrome/browser/content_settings/host_content_settings_map.h"
10 #include "chrome/browser/geolocation/geolocation_infobar_delegate.h" 10 #include "chrome/browser/geolocation/geolocation_infobar_delegate.h"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 if (i->id().Equals(id)) { 169 if (i->id().Equals(id)) {
170 if (i->has_infobar()) 170 if (i->has_infobar())
171 GetInfoBarService(id)->RemoveInfoBar(i->infobar()); 171 GetInfoBarService(id)->RemoveInfoBar(i->infobar());
172 else 172 else
173 pending_infobar_requests_.erase(i); 173 pending_infobar_requests_.erase(i);
174 return; 174 return;
175 } 175 }
176 } 176 }
177 } 177 }
178 178
179 void PermissionQueueController::CancelInfoBarRequests(int group_id) {
180 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
181
182 PendingInfoBarRequests infobars_to_remove;
xhwang 2013/12/30 19:00:59 s/infobars_to_remove/info_bar_requests_to_cancel/
Kibeom Kim (inactive) 2013/12/30 21:52:24 Done.
183 for (PendingInfoBarRequests::iterator i(pending_infobar_requests_.begin());
xhwang 2013/12/30 19:00:59 nit: InfoBar/info_bar or Infobar/infobar. Now the
xhwang 2013/12/30 19:00:59 nit: typically we use PendingInfoBarRequests::iter
Kibeom Kim (inactive) 2013/12/30 21:52:24 Done. (seems InfoBar naming is largely inconsisten
184 i != pending_infobar_requests_.end();) {
185 LOG(ERROR) << "KKIM: "
186 << "CancelInfoBarRequests PermissionRequestID == "
187 << i->id().ToString();
xhwang 2013/12/30 19:00:59 Remove? Or at least not to use LOG(ERROR) and KKIM
Kibeom Kim (inactive) 2013/12/30 21:52:24 Done. :)
188 if (i->id().group_id() == group_id) {
189 if (i->has_infobar()) {
190 infobars_to_remove.push_back(*i);
xhwang 2013/12/30 19:00:59 Can we call GetInfoBarService(i->id())->RemoveInfo
Kibeom Kim (inactive) 2013/12/30 21:52:24 I tried that first, but then, at RemoveInfoBar(..)
xhwang 2013/12/30 21:59:39 worth a comment?
Kibeom Kim (inactive) 2013/12/30 22:10:09 Done.
191 ++i;
xhwang 2013/12/30 19:00:59 do we need to pending_infobar_requests_.erase(i) i
Kibeom Kim (inactive) 2013/12/30 21:52:24 When the infobar is removed, it's pending_infobar_
xhwang 2013/12/30 21:59:39 worth a comment?
Kibeom Kim (inactive) 2013/12/30 22:10:09 Done.
192 } else {
193 i = pending_infobar_requests_.erase(i);
194 }
195 } else {
196 ++i;
197 }
198 }
199
200 for (PendingInfoBarRequests::iterator i = infobars_to_remove.begin();
201 i != infobars_to_remove.end();
202 ++i) {
203 GetInfoBarService(i->id())->RemoveInfoBar(i->infobar());
204 }
205 }
206
179 void PermissionQueueController::OnPermissionSet( 207 void PermissionQueueController::OnPermissionSet(
180 const PermissionRequestID& id, 208 const PermissionRequestID& id,
181 const GURL& requesting_frame, 209 const GURL& requesting_frame,
182 const GURL& embedder, 210 const GURL& embedder,
183 bool update_content_setting, 211 bool update_content_setting,
184 bool allowed) { 212 bool allowed) {
185 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 213 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
186 214
187 if (update_content_setting) 215 if (update_content_setting)
188 UpdateContentSetting(requesting_frame, embedder, allowed); 216 UpdateContentSetting(requesting_frame, embedder, allowed);
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 371
344 ContentSetting content_setting = 372 ContentSetting content_setting =
345 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; 373 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK;
346 profile_->GetHostContentSettingsMap()->SetContentSetting( 374 profile_->GetHostContentSettingsMap()->SetContentSetting(
347 ContentSettingsPattern::FromURLNoWildcard(requesting_frame.GetOrigin()), 375 ContentSettingsPattern::FromURLNoWildcard(requesting_frame.GetOrigin()),
348 ContentSettingsPattern::FromURLNoWildcard(embedder.GetOrigin()), 376 ContentSettingsPattern::FromURLNoWildcard(embedder.GetOrigin()),
349 type_, 377 type_,
350 std::string(), 378 std::string(),
351 content_setting); 379 content_setting);
352 } 380 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698