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

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

Issue 211273007: Split InfoBarService core code into InfoBarManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase + comments Created 6 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 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"
11 #include "chrome/browser/infobars/infobar.h" 11 #include "chrome/browser/infobars/infobar.h"
12 #include "chrome/browser/infobars/infobar_manager.h"
12 #include "chrome/browser/infobars/infobar_service.h" 13 #include "chrome/browser/infobars/infobar_service.h"
13 #include "chrome/browser/media/midi_permission_infobar_delegate.h" 14 #include "chrome/browser/media/midi_permission_infobar_delegate.h"
14 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/tab_contents/tab_util.h" 16 #include "chrome/browser/tab_contents/tab_util.h"
16 #include "chrome/common/content_settings.h" 17 #include "chrome/common/content_settings.h"
17 #include "chrome/common/pref_names.h" 18 #include "chrome/common/pref_names.h"
18 #include "content/public/browser/browser_thread.h" 19 #include "content/public/browser/browser_thread.h"
19 #include "content/public/browser/notification_details.h" 20 #include "content/public/browser/notification_details.h"
20 #include "content/public/browser/notification_source.h" 21 #include "content/public/browser/notification_source.h"
21 #include "content/public/browser/notification_types.h" 22 #include "content/public/browser/notification_types.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 } 168 }
168 169
169 void PermissionQueueController::CancelInfoBarRequest( 170 void PermissionQueueController::CancelInfoBarRequest(
170 const PermissionRequestID& id) { 171 const PermissionRequestID& id) {
171 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 172 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
172 173
173 for (PendingInfobarRequests::iterator i(pending_infobar_requests_.begin()); 174 for (PendingInfobarRequests::iterator i(pending_infobar_requests_.begin());
174 i != pending_infobar_requests_.end(); ++i) { 175 i != pending_infobar_requests_.end(); ++i) {
175 if (i->id().Equals(id)) { 176 if (i->id().Equals(id)) {
176 if (i->has_infobar()) 177 if (i->has_infobar())
177 GetInfoBarService(id)->RemoveInfoBar(i->infobar()); 178 GetInfoBarService(id)->infobar_manager()->RemoveInfoBar(i->infobar());
178 else 179 else
179 pending_infobar_requests_.erase(i); 180 pending_infobar_requests_.erase(i);
180 return; 181 return;
181 } 182 }
182 } 183 }
183 } 184 }
184 185
185 void PermissionQueueController::CancelInfoBarRequests(int group_id) { 186 void PermissionQueueController::CancelInfoBarRequests(int group_id) {
186 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 187 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
187 188
(...skipping 13 matching lines...) Expand all
201 i = pending_infobar_requests_.erase(i); 202 i = pending_infobar_requests_.erase(i);
202 } 203 }
203 } else { 204 } else {
204 ++i; 205 ++i;
205 } 206 }
206 } 207 }
207 208
208 for (PendingInfobarRequests::iterator i = infobar_requests_to_cancel.begin(); 209 for (PendingInfobarRequests::iterator i = infobar_requests_to_cancel.begin();
209 i != infobar_requests_to_cancel.end(); 210 i != infobar_requests_to_cancel.end();
210 ++i) { 211 ++i) {
211 GetInfoBarService(i->id())->RemoveInfoBar(i->infobar()); 212 GetInfoBarService(i->id())->infobar_manager()->RemoveInfoBar(i->infobar());
212 } 213 }
213 } 214 }
214 215
215 void PermissionQueueController::OnPermissionSet( 216 void PermissionQueueController::OnPermissionSet(
216 const PermissionRequestID& id, 217 const PermissionRequestID& id,
217 const GURL& requesting_frame, 218 const GURL& requesting_frame,
218 const GURL& embedder, 219 const GURL& embedder,
219 bool update_content_setting, 220 bool update_content_setting,
220 bool allowed) { 221 bool allowed) {
221 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 222 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
(...skipping 25 matching lines...) Expand all
247 i = pending_infobar_requests_.erase(i); 248 i = pending_infobar_requests_.erase(i);
248 } 249 }
249 } else { 250 } else {
250 ++i; 251 ++i;
251 } 252 }
252 } 253 }
253 254
254 // Remove all infobars for the same |requesting_frame| and |embedder|. 255 // Remove all infobars for the same |requesting_frame| and |embedder|.
255 for (PendingInfobarRequests::iterator i = infobars_to_remove.begin(); 256 for (PendingInfobarRequests::iterator i = infobars_to_remove.begin();
256 i != infobars_to_remove.end(); ++i) 257 i != infobars_to_remove.end(); ++i)
257 GetInfoBarService(i->id())->RemoveInfoBar(i->infobar()); 258 GetInfoBarService(i->id())->infobar_manager()->RemoveInfoBar(i->infobar());
258 259
259 // Send out the permission notifications. 260 // Send out the permission notifications.
260 for (PendingInfobarRequests::iterator i = requests_to_notify.begin(); 261 for (PendingInfobarRequests::iterator i = requests_to_notify.begin();
261 i != requests_to_notify.end(); ++i) 262 i != requests_to_notify.end(); ++i)
262 i->RunCallback(allowed); 263 i->RunCallback(allowed);
263 } 264 }
264 265
265 void PermissionQueueController::Observe( 266 void PermissionQueueController::Observe(
266 int type, 267 int type,
267 const content::NotificationSource& source, 268 const content::NotificationSource& source,
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 380
380 ContentSetting content_setting = 381 ContentSetting content_setting =
381 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; 382 allowed ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK;
382 profile_->GetHostContentSettingsMap()->SetContentSetting( 383 profile_->GetHostContentSettingsMap()->SetContentSetting(
383 ContentSettingsPattern::FromURLNoWildcard(requesting_frame.GetOrigin()), 384 ContentSettingsPattern::FromURLNoWildcard(requesting_frame.GetOrigin()),
384 ContentSettingsPattern::FromURLNoWildcard(embedder.GetOrigin()), 385 ContentSettingsPattern::FromURLNoWildcard(embedder.GetOrigin()),
385 type_, 386 type_,
386 std::string(), 387 std::string(),
387 content_setting); 388 content_setting);
388 } 389 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698