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

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

Issue 2443463003: Remove PermissionInfoBarDelegate from desktop builds. (Closed)
Patch Set: Add comment explaining lifetime Created 4 years, 1 month 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
« no previous file with comments | « chrome/browser/permissions/permission_infobar_delegate.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/permissions/permission_queue_controller.h" 5 #include "chrome/browser/permissions/permission_queue_controller.h"
6 6
7 #include "chrome/browser/chrome_notification_types.h" 7 #include "chrome/browser/chrome_notification_types.h"
8 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 8 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
9 #include "chrome/browser/geolocation/geolocation_infobar_delegate_android.h"
10 #include "chrome/browser/infobars/infobar_service.h" 9 #include "chrome/browser/infobars/infobar_service.h"
11 #include "chrome/browser/media/midi_permission_infobar_delegate_android.h"
12 #include "chrome/browser/media/protected_media_identifier_infobar_delegate_andro id.h"
13 #include "chrome/browser/notifications/notification_permission_infobar_delegate. h"
14 #include "chrome/browser/permissions/permission_infobar_delegate.h" 10 #include "chrome/browser/permissions/permission_infobar_delegate.h"
15 #include "chrome/browser/permissions/permission_request.h" 11 #include "chrome/browser/permissions/permission_request.h"
16 #include "chrome/browser/permissions/permission_request_id.h" 12 #include "chrome/browser/permissions/permission_request_id.h"
17 #include "chrome/browser/permissions/permission_uma_util.h" 13 #include "chrome/browser/permissions/permission_uma_util.h"
18 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/browser/tab_contents/tab_util.h" 15 #include "chrome/browser/tab_contents/tab_util.h"
20 #include "components/content_settings/core/browser/host_content_settings_map.h" 16 #include "components/content_settings/core/browser/host_content_settings_map.h"
21 #include "components/content_settings/core/common/content_settings.h" 17 #include "components/content_settings/core/common/content_settings.h"
22 #include "components/infobars/core/infobar.h" 18 #include "components/infobars/core/infobar.h"
23 #include "content/public/browser/browser_thread.h" 19 #include "content/public/browser/browser_thread.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 112
117 void PermissionQueueController::PendingInfobarRequest::CreateInfoBar( 113 void PermissionQueueController::PendingInfobarRequest::CreateInfoBar(
118 PermissionQueueController* controller) { 114 PermissionQueueController* controller) {
119 // Controller can be Unretained because the lifetime of the infobar 115 // Controller can be Unretained because the lifetime of the infobar
120 // is tied to that of the queue controller. Before QueueController 116 // is tied to that of the queue controller. Before QueueController
121 // is destroyed, all requests will be cancelled and so all delegates 117 // is destroyed, all requests will be cancelled and so all delegates
122 // will be destroyed. 118 // will be destroyed.
123 PermissionInfoBarDelegate::PermissionSetCallback callback = base::Bind( 119 PermissionInfoBarDelegate::PermissionSetCallback callback = base::Bind(
124 &PermissionQueueController::OnPermissionSet, base::Unretained(controller), 120 &PermissionQueueController::OnPermissionSet, base::Unretained(controller),
125 id_, requesting_frame_, embedder_, user_gesture_); 121 id_, requesting_frame_, embedder_, user_gesture_);
126 switch (type_) { 122
127 case content::PermissionType::GEOLOCATION: 123 infobar_ = PermissionInfoBarDelegate::Create(type_, GetInfoBarService(id_),
128 infobar_ = GeolocationInfoBarDelegateAndroid::Create( 124 requesting_frame_, user_gesture_,
129 GetInfoBarService(id_), requesting_frame_, user_gesture_, profile_, 125 profile_, callback);
130 callback);
131 break;
132 #if defined(ENABLE_NOTIFICATIONS)
133 case content::PermissionType::NOTIFICATIONS:
134 case content::PermissionType::PUSH_MESSAGING:
135 infobar_ = NotificationPermissionInfoBarDelegate::Create(
136 GetInfoBarService(id_), requesting_frame_, user_gesture_, profile_,
137 callback);
138 break;
139 #endif // ENABLE_NOTIFICATIONS
140 case content::PermissionType::MIDI_SYSEX:
141 infobar_ = MidiPermissionInfoBarDelegateAndroid::Create(
142 GetInfoBarService(id_), requesting_frame_, user_gesture_, profile_,
143 callback);
144 break;
145 case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER:
146 infobar_ = ProtectedMediaIdentifierInfoBarDelegateAndroid::Create(
147 GetInfoBarService(id_), requesting_frame_, user_gesture_, profile_,
148 callback);
149 break;
150 default:
151 NOTREACHED();
152 break;
153 }
154 } 126 }
155 127
156 PermissionQueueController::PermissionQueueController( 128 PermissionQueueController::PermissionQueueController(
157 Profile* profile, 129 Profile* profile,
158 content::PermissionType permission_type, 130 content::PermissionType permission_type,
159 ContentSettingsType content_settings_type) 131 ContentSettingsType content_settings_type)
160 : profile_(profile), 132 : profile_(profile),
161 permission_type_(permission_type), 133 permission_type_(permission_type),
162 content_settings_type_(content_settings_type), 134 content_settings_type_(content_settings_type),
163 in_shutdown_(false) {} 135 in_shutdown_(false) {}
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 } 385 }
414 386
415 ContentSetting content_setting = 387 ContentSetting content_setting =
416 (decision == GRANTED) ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; 388 (decision == GRANTED) ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK;
417 389
418 HostContentSettingsMapFactory::GetForProfile(profile_) 390 HostContentSettingsMapFactory::GetForProfile(profile_)
419 ->SetContentSettingDefaultScope( 391 ->SetContentSettingDefaultScope(
420 requesting_frame.GetOrigin(), embedder.GetOrigin(), 392 requesting_frame.GetOrigin(), embedder.GetOrigin(),
421 content_settings_type_, std::string(), content_setting); 393 content_settings_type_, std::string(), content_setting);
422 } 394 }
OLDNEW
« no previous file with comments | « chrome/browser/permissions/permission_infobar_delegate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698