OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/guest_view/web_view/web_view_permission_helper.h" | 5 #include "extensions/browser/guest_view/web_view/web_view_permission_helper.h" |
6 | 6 |
7 #include "content/public/browser/render_process_host.h" | 7 #include "content/public/browser/render_process_host.h" |
8 #include "content/public/browser/render_view_host.h" | 8 #include "content/public/browser/render_view_host.h" |
9 #include "content/public/browser/user_metrics.h" | 9 #include "content/public/browser/user_metrics.h" |
10 #include "extensions/browser/api/extensions_api_client.h" | 10 #include "extensions/browser/api/extensions_api_client.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
173 | 173 |
174 bool WebViewPermissionHelper::OnMessageReceived(const IPC::Message& message) { | 174 bool WebViewPermissionHelper::OnMessageReceived(const IPC::Message& message) { |
175 return web_view_permission_helper_delegate_->OnMessageReceived(message); | 175 return web_view_permission_helper_delegate_->OnMessageReceived(message); |
176 } | 176 } |
177 #endif // defined(ENABLE_PLUGINS) | 177 #endif // defined(ENABLE_PLUGINS) |
178 | 178 |
179 void WebViewPermissionHelper::RequestMediaAccessPermission( | 179 void WebViewPermissionHelper::RequestMediaAccessPermission( |
180 content::WebContents* source, | 180 content::WebContents* source, |
181 const content::MediaStreamRequest& request, | 181 const content::MediaStreamRequest& request, |
182 const content::MediaResponseCallback& callback) { | 182 const content::MediaResponseCallback& callback) { |
183 base::DictionaryValue request_info; | 183 web_view_permission_helper_delegate_-> RequestMediaAccessPermission( |
Bernhard Bauer
2014/09/19 09:04:24
No space after "->"
Miguel Garcia
2014/09/24 11:04:44
I reverted this file since it did not belong to th
| |
184 request_info.SetString(guestview::kUrl, request.security_origin.spec()); | 184 source, request, callback); |
185 RequestPermission( | |
186 WEB_VIEW_PERMISSION_TYPE_MEDIA, | |
187 request_info, | |
188 base::Bind(&WebViewPermissionHelper::OnMediaPermissionResponse, | |
189 weak_factory_.GetWeakPtr(), | |
190 request, | |
191 callback), | |
192 false /* allowed_by_default */); | |
193 } | |
194 | |
195 bool WebViewPermissionHelper::CheckMediaAccessPermission( | |
196 content::WebContents* source, | |
197 const GURL& security_origin, | |
198 content::MediaStreamType type) { | |
199 return web_view_guest() | |
200 ->embedder_web_contents() | |
201 ->GetDelegate() | |
202 ->CheckMediaAccessPermission( | |
203 web_view_guest()->embedder_web_contents(), security_origin, type); | |
204 } | |
205 | |
206 void WebViewPermissionHelper::OnMediaPermissionResponse( | |
207 const content::MediaStreamRequest& request, | |
208 const content::MediaResponseCallback& callback, | |
209 bool allow, | |
210 const std::string& user_input) { | |
211 if (!allow || !web_view_guest()->attached()) { | |
212 // Deny the request. | |
213 callback.Run(content::MediaStreamDevices(), | |
214 content::MEDIA_DEVICE_INVALID_STATE, | |
215 scoped_ptr<content::MediaStreamUI>()); | |
216 return; | |
217 } | |
218 if (!web_view_guest()->embedder_web_contents()->GetDelegate()) | |
219 return; | |
220 | |
221 web_view_guest() | |
222 ->embedder_web_contents() | |
223 ->GetDelegate() | |
224 ->RequestMediaAccessPermission( | |
225 web_view_guest()->embedder_web_contents(), request, callback); | |
226 } | 185 } |
227 | 186 |
228 void WebViewPermissionHelper::CanDownload( | 187 void WebViewPermissionHelper::CanDownload( |
229 content::RenderViewHost* render_view_host, | 188 content::RenderViewHost* render_view_host, |
230 const GURL& url, | 189 const GURL& url, |
231 const std::string& request_method, | 190 const std::string& request_method, |
232 const base::Callback<void(bool)>& callback) { | 191 const base::Callback<void(bool)>& callback) { |
233 web_view_permission_helper_delegate_->CanDownload( | 192 web_view_permission_helper_delegate_->CanDownload( |
234 render_view_host, url, request_method, callback); | 193 render_view_host, url, request_method, callback); |
235 } | 194 } |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
379 bool allowed_by_default) | 338 bool allowed_by_default) |
380 : callback(callback), | 339 : callback(callback), |
381 permission_type(permission_type), | 340 permission_type(permission_type), |
382 allowed_by_default(allowed_by_default) { | 341 allowed_by_default(allowed_by_default) { |
383 } | 342 } |
384 | 343 |
385 WebViewPermissionHelper::PermissionResponseInfo::~PermissionResponseInfo() { | 344 WebViewPermissionHelper::PermissionResponseInfo::~PermissionResponseInfo() { |
386 } | 345 } |
387 | 346 |
388 } // namespace extensions | 347 } // namespace extensions |
OLD | NEW |