| OLD | NEW |
| 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 } | 167 } |
| 168 | 168 |
| 169 void PermissionQueueController::CancelInfoBarRequest( | 169 void PermissionQueueController::CancelInfoBarRequest( |
| 170 const PermissionRequestID& id) { | 170 const PermissionRequestID& id) { |
| 171 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 171 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 172 | 172 |
| 173 for (PendingInfobarRequests::iterator i(pending_infobar_requests_.begin()); | 173 for (PendingInfobarRequests::iterator i(pending_infobar_requests_.begin()); |
| 174 i != pending_infobar_requests_.end(); ++i) { | 174 i != pending_infobar_requests_.end(); ++i) { |
| 175 if (i->id().Equals(id)) { | 175 if (i->id().Equals(id)) { |
| 176 if (i->has_infobar()) | 176 if (i->has_infobar()) |
| 177 GetInfoBarService(id)->RemoveInfoBar(i->infobar()); | 177 GetInfoBarService(id)->infobar_manager().RemoveInfoBar(i->infobar()); |
| 178 else | 178 else |
| 179 pending_infobar_requests_.erase(i); | 179 pending_infobar_requests_.erase(i); |
| 180 return; | 180 return; |
| 181 } | 181 } |
| 182 } | 182 } |
| 183 } | 183 } |
| 184 | 184 |
| 185 void PermissionQueueController::CancelInfoBarRequests(int group_id) { | 185 void PermissionQueueController::CancelInfoBarRequests(int group_id) { |
| 186 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 186 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 187 | 187 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 201 i = pending_infobar_requests_.erase(i); | 201 i = pending_infobar_requests_.erase(i); |
| 202 } | 202 } |
| 203 } else { | 203 } else { |
| 204 ++i; | 204 ++i; |
| 205 } | 205 } |
| 206 } | 206 } |
| 207 | 207 |
| 208 for (PendingInfobarRequests::iterator i = infobar_requests_to_cancel.begin(); | 208 for (PendingInfobarRequests::iterator i = infobar_requests_to_cancel.begin(); |
| 209 i != infobar_requests_to_cancel.end(); | 209 i != infobar_requests_to_cancel.end(); |
| 210 ++i) { | 210 ++i) { |
| 211 GetInfoBarService(i->id())->RemoveInfoBar(i->infobar()); | 211 GetInfoBarService(i->id())->infobar_manager().RemoveInfoBar(i->infobar()); |
| 212 } | 212 } |
| 213 } | 213 } |
| 214 | 214 |
| 215 void PermissionQueueController::OnPermissionSet( | 215 void PermissionQueueController::OnPermissionSet( |
| 216 const PermissionRequestID& id, | 216 const PermissionRequestID& id, |
| 217 const GURL& requesting_frame, | 217 const GURL& requesting_frame, |
| 218 const GURL& embedder, | 218 const GURL& embedder, |
| 219 bool update_content_setting, | 219 bool update_content_setting, |
| 220 bool allowed) { | 220 bool allowed) { |
| 221 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 221 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 247 i = pending_infobar_requests_.erase(i); | 247 i = pending_infobar_requests_.erase(i); |
| 248 } | 248 } |
| 249 } else { | 249 } else { |
| 250 ++i; | 250 ++i; |
| 251 } | 251 } |
| 252 } | 252 } |
| 253 | 253 |
| 254 // Remove all infobars for the same |requesting_frame| and |embedder|. | 254 // Remove all infobars for the same |requesting_frame| and |embedder|. |
| 255 for (PendingInfobarRequests::iterator i = infobars_to_remove.begin(); | 255 for (PendingInfobarRequests::iterator i = infobars_to_remove.begin(); |
| 256 i != infobars_to_remove.end(); ++i) | 256 i != infobars_to_remove.end(); ++i) |
| 257 GetInfoBarService(i->id())->RemoveInfoBar(i->infobar()); | 257 GetInfoBarService(i->id())->infobar_manager().RemoveInfoBar(i->infobar()); |
| 258 | 258 |
| 259 // Send out the permission notifications. | 259 // Send out the permission notifications. |
| 260 for (PendingInfobarRequests::iterator i = requests_to_notify.begin(); | 260 for (PendingInfobarRequests::iterator i = requests_to_notify.begin(); |
| 261 i != requests_to_notify.end(); ++i) | 261 i != requests_to_notify.end(); ++i) |
| 262 i->RunCallback(allowed); | 262 i->RunCallback(allowed); |
| 263 } | 263 } |
| 264 | 264 |
| 265 void PermissionQueueController::Observe( | 265 void PermissionQueueController::Observe( |
| 266 int type, | 266 int type, |
| 267 const content::NotificationSource& source, | 267 const content::NotificationSource& source, |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 | 379 |
| 380 ContentSetting content_setting = | 380 ContentSetting content_setting = |
| 381 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; | 381 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; |
| 382 profile_->GetHostContentSettingsMap()->SetContentSetting( | 382 profile_->GetHostContentSettingsMap()->SetContentSetting( |
| 383 ContentSettingsPattern::FromURLNoWildcard(requesting_frame.GetOrigin()), | 383 ContentSettingsPattern::FromURLNoWildcard(requesting_frame.GetOrigin()), |
| 384 ContentSettingsPattern::FromURLNoWildcard(embedder.GetOrigin()), | 384 ContentSettingsPattern::FromURLNoWildcard(embedder.GetOrigin()), |
| 385 type_, | 385 type_, |
| 386 std::string(), | 386 std::string(), |
| 387 content_setting); | 387 content_setting); |
| 388 } | 388 } |
| OLD | NEW |