web_engine_devtools_controller.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // Copyright 2019 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. #ifndef FUCHSIA_WEB_WEBENGINE_BROWSER_WEB_ENGINE_DEVTOOLS_CONTROLLER_H_
  5. #define FUCHSIA_WEB_WEBENGINE_BROWSER_WEB_ENGINE_DEVTOOLS_CONTROLLER_H_
  6. #include "base/callback.h"
  7. #include "content/public/browser/devtools_agent_host.h"
  8. namespace base {
  9. class CommandLine;
  10. }
  11. namespace content {
  12. class WebContents;
  13. }
  14. // Manages the DevTools remote-debugging server.
  15. class WebEngineDevToolsController {
  16. public:
  17. virtual ~WebEngineDevToolsController() = default;
  18. // Returns a controller based on the features requested in |command_line|.
  19. static std::unique_ptr<WebEngineDevToolsController> CreateFromCommandLine(
  20. const base::CommandLine& command_line);
  21. // Called by the Context to signal a new Frame was created. |user_debugging|
  22. // should be set to true when debugging was requested from the user API.
  23. // Returns false if |contents| is not user-debuggable despite |user_debugging|
  24. // being set.
  25. virtual bool OnFrameCreated(content::WebContents* contents,
  26. bool user_debugging) = 0;
  27. // Called by Frames to signal a load has completed.
  28. virtual void OnFrameLoaded(content::WebContents* contents) = 0;
  29. // Called by Frames to signal they are being deleted.
  30. virtual void OnFrameDestroyed(content::WebContents* contents) = 0;
  31. // Called by the WebEngineDevToolsManagerDelegate.
  32. virtual content::DevToolsAgentHost::List RemoteDebuggingTargets() = 0;
  33. // Invokes |callback| as soon as a user-mode DevTools port becomes available.
  34. // |callback| receives zero if user-mode DevTools is permanently unavailable.
  35. virtual void GetDevToolsPort(base::OnceCallback<void(uint16_t)> callback) = 0;
  36. };
  37. #endif // FUCHSIA_WEB_WEBENGINE_BROWSER_WEB_ENGINE_DEVTOOLS_CONTROLLER_H_