@@ -21,7 +21,6 @@ fn prompt_cef_permission(message: String, tx: std::sync::mpsc::Sender<bool>) {
2121 dialog. set_title ( "Permission request" ) ;
2222
2323 let tx = std:: cell:: RefCell :: new ( Some ( tx) ) ;
24- let dialog_ptr = dialog. clone ( ) ;
2524 dialog. connect_response ( move |dlg, response| {
2625 if let Some ( tx) = tx. take ( ) {
2726 let _ = tx. send ( matches ! ( response, ResponseType :: Yes ) ) ;
@@ -100,7 +99,7 @@ fn main() {
10099 return ;
101100 }
102101
103- // Allow call media capture (mic, camera, screen-share) for our webview.
102+ // Allow call media capture (mic, camera, screen-share) and geolocation for our webview.
104103 // Cache granted permissions so we only prompt once per kind.
105104 use std:: collections:: HashSet ;
106105 use std:: sync:: { Mutex , OnceLock } ;
@@ -114,7 +113,7 @@ fn main() {
114113 return responder. deny ( DenyReason :: NoPolicy ) ;
115114 }
116115
117- let media_kinds : Vec < PermissionKind > = request
116+ let permission_kinds : Vec < PermissionKind > = request
118117 . kinds
119118 . iter ( )
120119 . filter ( |kind| {
@@ -125,24 +124,26 @@ fn main() {
125124 | PermissionKind :: CameraPanTiltZoom
126125 | PermissionKind :: ScreenCapture
127126 | PermissionKind :: CapturedSurfaceControl
127+ | PermissionKind :: Geolocation
128128 )
129129 } )
130130 . cloned ( )
131131 . collect ( ) ;
132132
133- if media_kinds . is_empty ( ) {
133+ if permission_kinds . is_empty ( ) {
134134 return responder. deny ( DenyReason :: NoPolicy ) ;
135135 }
136136
137137 // Check cache: if all requested kinds were already granted, allow immediately.
138- let kind_names: Vec < & ' static str > = media_kinds
138+ let kind_names: Vec < & ' static str > = permission_kinds
139139 . iter ( )
140140 . map ( |k| match k {
141141 PermissionKind :: Microphone => "mic" ,
142142 PermissionKind :: Camera | PermissionKind :: CameraPanTiltZoom => "cam" ,
143143 PermissionKind :: ScreenCapture | PermissionKind :: CapturedSurfaceControl => {
144144 "screen"
145145 }
146+ PermissionKind :: Geolocation => "geolocation" ,
146147 _ => "other" ,
147148 } )
148149 . collect ( ) ;
@@ -154,14 +155,15 @@ fn main() {
154155 }
155156 }
156157
157- let msg = match media_kinds . as_slice ( ) {
158+ let msg = match permission_kinds . as_slice ( ) {
158159 [ PermissionKind :: Microphone ] => "Sable wants to access your microphone." ,
159160 [ PermissionKind :: Camera ] => "Sable wants to access your camera." ,
160161 [ PermissionKind :: ScreenCapture ] | [ PermissionKind :: CapturedSurfaceControl ] => {
161162 "Sable wants to share your screen."
162163 }
163- _ if media_kinds. contains ( & PermissionKind :: Microphone )
164- && media_kinds. contains ( & PermissionKind :: Camera ) =>
164+ [ PermissionKind :: Geolocation ] => "Sable wants to access your location." ,
165+ _ if permission_kinds. contains ( & PermissionKind :: Microphone )
166+ && permission_kinds. contains ( & PermissionKind :: Camera ) =>
165167 {
166168 "Sable wants to access your microphone and camera."
167169 }
0 commit comments