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/permission_context_uma_util.h" | 9 #include "chrome/browser/content_settings/permission_context_uma_util.h" |
10 #include "chrome/browser/geolocation/geolocation_infobar_delegate.h" | 10 #include "chrome/browser/geolocation/geolocation_infobar_delegate.h" |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 if (!AlreadyShowingInfoBarForTab(id)) | 174 if (!AlreadyShowingInfoBarForTab(id)) |
175 ShowQueuedInfoBarForTab(id); | 175 ShowQueuedInfoBarForTab(id); |
176 } | 176 } |
177 | 177 |
178 void PermissionQueueController::CancelInfoBarRequest( | 178 void PermissionQueueController::CancelInfoBarRequest( |
179 const PermissionRequestID& id) { | 179 const PermissionRequestID& id) { |
180 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 180 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
181 | 181 |
182 for (PendingInfobarRequests::iterator i(pending_infobar_requests_.begin()); | 182 for (PendingInfobarRequests::iterator i(pending_infobar_requests_.begin()); |
183 i != pending_infobar_requests_.end(); ++i) { | 183 i != pending_infobar_requests_.end(); ++i) { |
184 if (!i->id().Equals(id)) | 184 if (id != i->id()) |
185 continue; | 185 continue; |
186 | 186 |
187 InfoBarService* infobar_service = GetInfoBarService(id); | 187 InfoBarService* infobar_service = GetInfoBarService(id); |
188 if (infobar_service && i->has_infobar()) | 188 if (infobar_service && i->has_infobar()) |
189 infobar_service->RemoveInfoBar(i->infobar()); | 189 infobar_service->RemoveInfoBar(i->infobar()); |
190 else | 190 else |
191 pending_infobar_requests_.erase(i); | 191 pending_infobar_requests_.erase(i); |
192 return; | 192 return; |
193 } | 193 } |
194 } | 194 } |
(...skipping 27 matching lines...) Expand all Loading... |
222 i != pending_infobar_requests_.end(); ++i) { | 222 i != pending_infobar_requests_.end(); ++i) { |
223 if (!i->IsForPair(requesting_frame, embedder)) | 223 if (!i->IsForPair(requesting_frame, embedder)) |
224 continue; | 224 continue; |
225 requests_to_notify.push_back(*i); | 225 requests_to_notify.push_back(*i); |
226 if (!i->has_infobar()) { | 226 if (!i->has_infobar()) { |
227 // We haven't created an infobar yet, just record the pending request | 227 // We haven't created an infobar yet, just record the pending request |
228 // index and remove it later. | 228 // index and remove it later. |
229 pending_requests_to_remove.push_back(i); | 229 pending_requests_to_remove.push_back(i); |
230 continue; | 230 continue; |
231 } | 231 } |
232 if (i->id().Equals(id)) { | 232 if (id == i->id()) { |
233 // The infobar that called us is i->infobar(), and its delegate is | 233 // The infobar that called us is i->infobar(), and its delegate is |
234 // currently in either Accept() or Cancel(). This means that | 234 // currently in either Accept() or Cancel(). This means that |
235 // RemoveInfoBar() will be called later on, and that will trigger a | 235 // RemoveInfoBar() will be called later on, and that will trigger a |
236 // notification we're observing. | 236 // notification we're observing. |
237 continue; | 237 continue; |
238 } | 238 } |
239 | 239 |
240 // This infobar is for the same frame/embedder pair, but in a different | 240 // This infobar is for the same frame/embedder pair, but in a different |
241 // tab. We should remove it now that we've got an answer for it. | 241 // tab. We should remove it now that we've got an answer for it. |
242 infobars_to_remove.push_back(*i); | 242 infobars_to_remove.push_back(*i); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 ContentSettingsPattern::Wildcard() : | 391 ContentSettingsPattern::Wildcard() : |
392 ContentSettingsPattern::FromURLNoWildcard(embedder.GetOrigin()); | 392 ContentSettingsPattern::FromURLNoWildcard(embedder.GetOrigin()); |
393 | 393 |
394 profile_->GetHostContentSettingsMap()->SetContentSetting( | 394 profile_->GetHostContentSettingsMap()->SetContentSetting( |
395 ContentSettingsPattern::FromURLNoWildcard(requesting_frame.GetOrigin()), | 395 ContentSettingsPattern::FromURLNoWildcard(requesting_frame.GetOrigin()), |
396 embedder_pattern, | 396 embedder_pattern, |
397 type_, | 397 type_, |
398 std::string(), | 398 std::string(), |
399 content_setting); | 399 content_setting); |
400 } | 400 } |
OLD | NEW |