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

Side by Side Diff: chrome/browser/geolocation/geolocation_infobar_queue_controller.cc

Issue 11785030: GeolocationConfirmInfoBarDelegate* -> GeolocationInfoBarDelegate*, for consistency with other infob… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/geolocation/geolocation_infobar_queue_controller.h" 5 #include "chrome/browser/geolocation/geolocation_infobar_queue_controller.h"
6 6
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "chrome/browser/content_settings/host_content_settings_map.h" 8 #include "chrome/browser/content_settings/host_content_settings_map.h"
9 #include "chrome/browser/geolocation/geolocation_confirm_infobar_delegate.h" 9 #include "chrome/browser/geolocation/geolocation_infobar_delegate.h"
10 #include "chrome/browser/infobars/infobar.h" 10 #include "chrome/browser/infobars/infobar.h"
11 #include "chrome/browser/infobars/infobar_service.h" 11 #include "chrome/browser/infobars/infobar_service.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/tab_contents/tab_util.h" 13 #include "chrome/browser/tab_contents/tab_util.h"
14 #include "chrome/common/chrome_notification_types.h" 14 #include "chrome/common/chrome_notification_types.h"
15 #include "chrome/common/content_settings.h" 15 #include "chrome/common/content_settings.h"
16 #include "chrome/common/pref_names.h" 16 #include "chrome/common/pref_names.h"
17 #include "content/public/browser/browser_thread.h" 17 #include "content/public/browser/browser_thread.h"
18 #include "content/public/browser/notification_details.h" 18 #include "content/public/browser/notification_details.h"
19 #include "content/public/browser/notification_source.h" 19 #include "content/public/browser/notification_source.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 } 89 }
90 90
91 void GeolocationInfoBarQueueController::PendingInfoBarRequest::RunCallback( 91 void GeolocationInfoBarQueueController::PendingInfoBarRequest::RunCallback(
92 bool allowed) { 92 bool allowed) {
93 callback_.Run(allowed); 93 callback_.Run(allowed);
94 } 94 }
95 95
96 void GeolocationInfoBarQueueController::PendingInfoBarRequest:: 96 void GeolocationInfoBarQueueController::PendingInfoBarRequest::
97 CreateInfoBarDelegate(GeolocationInfoBarQueueController* controller, 97 CreateInfoBarDelegate(GeolocationInfoBarQueueController* controller,
98 const std::string& display_languages) { 98 const std::string& display_languages) {
99 infobar_delegate_ = GeolocationConfirmInfoBarDelegate::Create( 99 infobar_delegate_ = GeolocationInfoBarDelegate::Create(
100 GetInfoBarService(id_), controller, id_, requesting_frame_, 100 GetInfoBarService(id_), controller, id_, requesting_frame_,
101 display_languages); 101 display_languages);
102 102
103 } 103 }
104 104
105 105
106 // GeolocationInfoBarQueueController ------------------------------------------ 106 // GeolocationInfoBarQueueController ------------------------------------------
107 107
108 GeolocationInfoBarQueueController::GeolocationInfoBarQueueController( 108 GeolocationInfoBarQueueController::GeolocationInfoBarQueueController(
109 Profile* profile) 109 Profile* profile)
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 // caused the delegate to be deleted, so it's not safe to dereference the 209 // caused the delegate to be deleted, so it's not safe to dereference the
210 // contents of the delegate. The address of the delegate, however, is OK to 210 // contents of the delegate. The address of the delegate, however, is OK to
211 // use to find the PendingInfoBarRequest to remove because 211 // use to find the PendingInfoBarRequest to remove because
212 // pending_infobar_requests_ will not have received any new entries between 212 // pending_infobar_requests_ will not have received any new entries between
213 // the NotificationService's call to InfoBarContainer::Observe and this 213 // the NotificationService's call to InfoBarContainer::Observe and this
214 // method. 214 // method.
215 InfoBarDelegate* delegate = 215 InfoBarDelegate* delegate =
216 content::Details<InfoBarRemovedDetails>(details)->first; 216 content::Details<InfoBarRemovedDetails>(details)->first;
217 for (PendingInfoBarRequests::iterator i = pending_infobar_requests_.begin(); 217 for (PendingInfoBarRequests::iterator i = pending_infobar_requests_.begin();
218 i != pending_infobar_requests_.end(); ++i) { 218 i != pending_infobar_requests_.end(); ++i) {
219 InfoBarDelegate* confirm_delegate = i->infobar_delegate(); 219 if (i->infobar_delegate() == delegate) {
220 if (confirm_delegate == delegate) {
221 GeolocationPermissionRequestID id(i->id()); 220 GeolocationPermissionRequestID id(i->id());
222 pending_infobar_requests_.erase(i); 221 pending_infobar_requests_.erase(i);
223 ShowQueuedInfoBarForTab(id); 222 ShowQueuedInfoBarForTab(id);
224 return; 223 return;
225 } 224 }
226 } 225 }
227 } 226 }
228 227
229 bool GeolocationInfoBarQueueController::AlreadyShowingInfoBarForTab( 228 bool GeolocationInfoBarQueueController::AlreadyShowingInfoBarForTab(
230 const GeolocationPermissionRequestID& id) const { 229 const GeolocationPermissionRequestID& id) const {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 311
313 ContentSetting content_setting = 312 ContentSetting content_setting =
314 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; 313 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK;
315 profile_->GetHostContentSettingsMap()->SetContentSetting( 314 profile_->GetHostContentSettingsMap()->SetContentSetting(
316 ContentSettingsPattern::FromURLNoWildcard(requesting_frame.GetOrigin()), 315 ContentSettingsPattern::FromURLNoWildcard(requesting_frame.GetOrigin()),
317 ContentSettingsPattern::FromURLNoWildcard(embedder.GetOrigin()), 316 ContentSettingsPattern::FromURLNoWildcard(embedder.GetOrigin()),
318 CONTENT_SETTINGS_TYPE_GEOLOCATION, 317 CONTENT_SETTINGS_TYPE_GEOLOCATION,
319 std::string(), 318 std::string(),
320 content_setting); 319 content_setting);
321 } 320 }
OLDNEW
« no previous file with comments | « chrome/browser/geolocation/geolocation_infobar_queue_controller.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698