shell_extension_host_delegate.cc 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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
  3. // found in the LICENSE file.
  4. #include "extensions/shell/browser/shell_extension_host_delegate.h"
  5. #include "base/notreached.h"
  6. #include "content/public/browser/web_contents_delegate.h"
  7. #include "extensions/browser/media_capture_util.h"
  8. #include "extensions/shell/browser/shell_extension_web_contents_observer.h"
  9. namespace extensions {
  10. ShellExtensionHostDelegate::ShellExtensionHostDelegate() = default;
  11. ShellExtensionHostDelegate::~ShellExtensionHostDelegate() = default;
  12. void ShellExtensionHostDelegate::OnExtensionHostCreated(
  13. content::WebContents* web_contents) {
  14. ShellExtensionWebContentsObserver::CreateForWebContents(web_contents);
  15. }
  16. void ShellExtensionHostDelegate::OnMainFrameCreatedForBackgroundPage(
  17. ExtensionHost* host) {}
  18. content::JavaScriptDialogManager*
  19. ShellExtensionHostDelegate::GetJavaScriptDialogManager() {
  20. // TODO(jamescook): Create a JavaScriptDialogManager or reuse the one from
  21. // content_shell.
  22. NOTREACHED();
  23. return NULL;
  24. }
  25. void ShellExtensionHostDelegate::CreateTab(
  26. std::unique_ptr<content::WebContents> web_contents,
  27. const std::string& extension_id,
  28. WindowOpenDisposition disposition,
  29. const gfx::Rect& initial_rect,
  30. bool user_gesture) {
  31. // TODO(jamescook): Should app_shell support opening popup windows?
  32. NOTREACHED();
  33. }
  34. void ShellExtensionHostDelegate::ProcessMediaAccessRequest(
  35. content::WebContents* web_contents,
  36. const content::MediaStreamRequest& request,
  37. content::MediaResponseCallback callback,
  38. const Extension* extension) {
  39. // Allow access to the microphone and/or camera.
  40. media_capture_util::GrantMediaStreamRequest(web_contents, request,
  41. std::move(callback), extension);
  42. }
  43. bool ShellExtensionHostDelegate::CheckMediaAccessPermission(
  44. content::RenderFrameHost* render_frame_host,
  45. const GURL& security_origin,
  46. blink::mojom::MediaStreamType type,
  47. const Extension* extension) {
  48. media_capture_util::VerifyMediaAccessPermission(type, extension);
  49. return true;
  50. }
  51. content::PictureInPictureResult
  52. ShellExtensionHostDelegate::EnterPictureInPicture(
  53. content::WebContents* web_contents) {
  54. NOTREACHED();
  55. return content::PictureInPictureResult::kNotSupported;
  56. }
  57. void ShellExtensionHostDelegate::ExitPictureInPicture() {
  58. NOTREACHED();
  59. }
  60. } // namespace extensions