inspectable_web_contents.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #ifndef BRIGHTRAY_BROWSER_INSPECTABLE_WEB_CONTENTS_H_
  2. #define BRIGHTRAY_BROWSER_INSPECTABLE_WEB_CONTENTS_H_
  3. #include <string>
  4. #include "content/public/browser/web_contents.h"
  5. namespace base {
  6. class Value;
  7. }
  8. namespace content {
  9. class DevToolsAgentHost;
  10. }
  11. namespace brightray {
  12. class InspectableWebContentsDelegate;
  13. class InspectableWebContentsView;
  14. class InspectableWebContents {
  15. public:
  16. static InspectableWebContents* Create(
  17. const content::WebContents::CreateParams&);
  18. // The returned InspectableWebContents takes ownership of the passed-in
  19. // WebContents.
  20. static InspectableWebContents* Create(content::WebContents*);
  21. virtual ~InspectableWebContents() {}
  22. virtual InspectableWebContentsView* GetView() const = 0;
  23. virtual content::WebContents* GetWebContents() const = 0;
  24. virtual content::WebContents* GetDevToolsWebContents() const = 0;
  25. // The delegate manages its own life.
  26. virtual void SetDelegate(InspectableWebContentsDelegate* delegate) = 0;
  27. virtual InspectableWebContentsDelegate* GetDelegate() const = 0;
  28. virtual void SetDevToolsWebContents(content::WebContents* devtools) = 0;
  29. virtual void SetDockState(const std::string& state) = 0;
  30. virtual void ShowDevTools() = 0;
  31. virtual void CloseDevTools() = 0;
  32. virtual bool IsDevToolsViewShowing() = 0;
  33. virtual void AttachTo(scoped_refptr<content::DevToolsAgentHost>) = 0;
  34. virtual void Detach() = 0;
  35. virtual void CallClientFunction(const std::string& function_name,
  36. const base::Value* arg1 = nullptr,
  37. const base::Value* arg2 = nullptr,
  38. const base::Value* arg3 = nullptr) = 0;
  39. virtual void InspectElement(int x, int y) = 0;
  40. };
  41. } // namespace brightray
  42. #endif // BRIGHTRAY_BROWSER_INSPECTABLE_WEB_CONTENTS_H_