InspectorFrontendClientLocal.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /*
  2. * Copyright (C) 2010 Google Inc. All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions are
  6. * met:
  7. *
  8. * * Redistributions of source code must retain the above copyright
  9. * notice, this list of conditions and the following disclaimer.
  10. * * Redistributions in binary form must reproduce the above
  11. * copyright notice, this list of conditions and the following disclaimer
  12. * in the documentation and/or other materials provided with the
  13. * distribution.
  14. * * Neither the name of Google Inc. nor the names of its
  15. * contributors may be used to endorse or promote products derived from
  16. * this software without specific prior written permission.
  17. *
  18. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  19. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  20. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  21. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  22. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  23. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  24. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  25. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  26. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  27. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  28. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  29. */
  30. #ifndef InspectorFrontendClientLocal_h
  31. #define InspectorFrontendClientLocal_h
  32. #include "InspectorFrontendClient.h"
  33. #include <wtf/Forward.h>
  34. #include <wtf/Noncopyable.h>
  35. #include <wtf/text/WTFString.h>
  36. namespace WebCore {
  37. class Frame;
  38. class InspectorController;
  39. class InspectorBackendDispatchTask;
  40. class InspectorFrontendHost;
  41. class Page;
  42. class InspectorFrontendClientLocal : public InspectorFrontendClient {
  43. WTF_MAKE_NONCOPYABLE(InspectorFrontendClientLocal); WTF_MAKE_FAST_ALLOCATED;
  44. public:
  45. class Settings {
  46. public:
  47. Settings() { }
  48. virtual ~Settings() { }
  49. virtual String getProperty(const String& name);
  50. virtual void setProperty(const String& name, const String& value);
  51. };
  52. InspectorFrontendClientLocal(InspectorController*, Page*, PassOwnPtr<Settings>);
  53. virtual ~InspectorFrontendClientLocal();
  54. virtual void windowObjectCleared();
  55. virtual void frontendLoaded();
  56. virtual void moveWindowBy(float x, float y);
  57. virtual void requestSetDockSide(DockSide);
  58. virtual void changeAttachedWindowHeight(unsigned);
  59. virtual void changeAttachedWindowWidth(unsigned);
  60. virtual void openInNewTab(const String& url);
  61. virtual bool canSave() { return false; }
  62. virtual void save(const String&, const String&, bool) { }
  63. virtual void append(const String&, const String&) { }
  64. virtual void attachWindow(DockSide) = 0;
  65. virtual void detachWindow() = 0;
  66. virtual void sendMessageToBackend(const String& message);
  67. virtual bool supportsFileSystems() { return false; }
  68. virtual void requestFileSystems() { }
  69. virtual void addFileSystem() { }
  70. virtual void removeFileSystem(const String&) { }
  71. virtual bool isUnderTest();
  72. bool canAttachWindow();
  73. void setDockingUnavailable(bool);
  74. static unsigned constrainedAttachedWindowHeight(unsigned preferredHeight, unsigned totalWindowHeight);
  75. static unsigned constrainedAttachedWindowWidth(unsigned preferredWidth, unsigned totalWindowWidth);
  76. // Direct Frontend API
  77. bool isDebuggingEnabled();
  78. void setDebuggingEnabled(bool);
  79. bool isTimelineProfilingEnabled();
  80. void setTimelineProfilingEnabled(bool);
  81. bool isProfilingJavaScript();
  82. void startProfilingJavaScript();
  83. void stopProfilingJavaScript();
  84. void showConsole();
  85. void showMainResourceForFrame(Frame*);
  86. void showResources();
  87. void setAttachedWindow(DockSide);
  88. protected:
  89. virtual void setAttachedWindowHeight(unsigned) = 0;
  90. virtual void setAttachedWindowWidth(unsigned) = 0;
  91. void restoreAttachedWindowHeight();
  92. private:
  93. bool evaluateAsBoolean(const String& expression);
  94. void evaluateOnLoad(const String& expression);
  95. friend class FrontendMenuProvider;
  96. InspectorController* m_inspectorController;
  97. Page* m_frontendPage;
  98. // TODO(yurys): this ref shouldn't be needed.
  99. RefPtr<InspectorFrontendHost> m_frontendHost;
  100. OwnPtr<InspectorFrontendClientLocal::Settings> m_settings;
  101. bool m_frontendLoaded;
  102. DockSide m_dockSide;
  103. Vector<String> m_evaluateOnLoad;
  104. OwnPtr<InspectorBackendDispatchTask> m_dispatchTask;
  105. };
  106. } // namespace WebCore
  107. #endif