diff options
Diffstat (limited to 'Source/WebKit2/UIProcess/WebInspectorProxy.h')
-rw-r--r-- | Source/WebKit2/UIProcess/WebInspectorProxy.h | 176 |
1 files changed, 96 insertions, 80 deletions
diff --git a/Source/WebKit2/UIProcess/WebInspectorProxy.h b/Source/WebKit2/UIProcess/WebInspectorProxy.h index 0457c471f..1c8ef463c 100644 --- a/Source/WebKit2/UIProcess/WebInspectorProxy.h +++ b/Source/WebKit2/UIProcess/WebInspectorProxy.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Apple Inc. All rights reserved. + * Copyright (C) 2010, 2014, 2016 Apple Inc. All rights reserved. * Portions Copyright (c) 2011 Motorola Mobility, Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -24,56 +24,56 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebInspectorProxy_h -#define WebInspectorProxy_h - -#if ENABLE(INSPECTOR) +#pragma once #include "APIObject.h" +#include "Attachment.h" #include "MessageReceiver.h" +#include "WebInspectorUtilities.h" #include <wtf/Forward.h> -#include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> #include <wtf/text/WTFString.h> #if PLATFORM(MAC) #include "WKGeometry.h" +#include <WebCore/IntRect.h> #include <wtf/HashMap.h> #include <wtf/RetainPtr.h> +#include <wtf/RunLoop.h> -OBJC_CLASS NSButton; OBJC_CLASS NSURL; +OBJC_CLASS NSView; OBJC_CLASS NSWindow; OBJC_CLASS WKWebInspectorProxyObjCAdapter; -OBJC_CLASS WKWebInspectorWKView; +OBJC_CLASS WKWebInspectorWKWebView; +OBJC_CLASS WKWebViewConfiguration; #endif #if PLATFORM(GTK) #include "WebInspectorClientGtk.h" #endif -#if PLATFORM(EFL) -#include <Ecore_Evas.h> -#include <Evas.h> -#endif +namespace WebCore { +class URL; +} namespace WebKit { class WebFrameProxy; -class WebPageGroup; class WebPageProxy; -struct WebPageCreationParameters; +class WebPreferences; -enum AttachmentSide { - AttachmentSideBottom, - AttachmentSideRight +enum class AttachmentSide { + Bottom, + Right, + Left, }; class WebInspectorProxy : public API::ObjectImpl<API::Object::Type::Inspector>, public IPC::MessageReceiver { public: - static PassRefPtr<WebInspectorProxy> create(WebPageProxy* page) + static Ref<WebInspectorProxy> create(WebPageProxy* inspectedPage) { - return adoptRef(new WebInspectorProxy(page)); + return adoptRef(*new WebInspectorProxy(inspectedPage)); } ~WebInspectorProxy(); @@ -81,9 +81,9 @@ public: void invalidate(); // Public APIs - WebPageProxy* page() const { return m_page; } + WebPageProxy* inspectedPage() const { return m_inspectedPage; } - bool isConnected() const { return m_createdInspectorPage; } + bool isConnected() const { return !!m_inspectorPage; } bool isVisible() const { return m_isVisible; } bool isFront(); @@ -92,16 +92,25 @@ public: void show(); void hide(); void close(); - -#if PLATFORM(MAC) + void closeForCrash(); + +#if PLATFORM(MAC) && WK_API_ENABLED + static RetainPtr<WKWebViewConfiguration> createFrontendConfiguration(WebPageProxy*, bool underTest); + static RetainPtr<NSWindow> createFrontendWindow(NSRect savedWindowFrame); + void createInspectorWindow(); void updateInspectorWindowTitle() const; void inspectedViewFrameDidChange(CGFloat = 0); void windowFrameDidChange(); + void windowFullScreenDidChange(); NSWindow* inspectorWindow() const { return m_inspectorWindow.get(); } void setInspectorWindowFrame(WKRect&); WKRect inspectorWindowFrame(); + + void closeTimerFired(); + + void attachmentViewDidChange(NSView *oldView, NSView *newView); #endif #if PLATFORM(GTK) @@ -111,32 +120,33 @@ public: void showConsole(); void showResources(); + void showTimelines(); void showMainResourceForFrame(WebFrameProxy*); + AttachmentSide attachmentSide() const { return m_attachmentSide; } bool isAttached() const { return m_isAttached; } void attachRight(); + void attachLeft(); void attachBottom(); - void attach(AttachmentSide = AttachmentSideBottom); + void attach(AttachmentSide = AttachmentSide::Bottom); void detach(); void setAttachedWindowHeight(unsigned); void setAttachedWindowWidth(unsigned); - void setToolbarHeight(unsigned height) { platformSetToolbarHeight(height); } - bool isDebuggingJavaScript() const { return m_isDebuggingJavaScript; } - void toggleJavaScriptDebugging(); - - bool isProfilingJavaScript() const { return m_isProfilingJavaScript; } - void toggleJavaScriptProfiling(); + void startWindowDrag(); bool isProfilingPage() const { return m_isProfilingPage; } void togglePageProfiling(); - static bool isInspectorPage(WebPageProxy&); + bool isElementSelectionActive() const { return m_elementSelectionActive; } + void toggleElementSelection(); - // Implemented the platform WebInspectorProxy file - String inspectorPageURL() const; - String inspectorBaseURL() const; + // Provided by platform WebInspectorProxy implementations. + static String inspectorPageURL(); + static String inspectorTestPageURL(); + static String inspectorBaseURL(); + static bool isMainOrTestInspectorPage(const WebCore::URL&); #if ENABLE(INSPECTOR_SERVER) void enableRemoteInspection(); @@ -146,17 +156,27 @@ public: int remoteInspectionPageID() const { return m_remoteInspectionPageId; } #endif + static const unsigned minimumWindowWidth; + static const unsigned minimumWindowHeight; + + static const unsigned initialWindowWidth; + static const unsigned initialWindowHeight; + private: explicit WebInspectorProxy(WebPageProxy*); + void eagerlyCreateInspectorPage(); + // IPC::MessageReceiver - virtual void didReceiveMessage(IPC::Connection*, IPC::MessageDecoder&) override; - virtual void didReceiveSyncMessage(IPC::Connection*, IPC::MessageDecoder&, std::unique_ptr<IPC::MessageEncoder>&) override; + void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override; WebPageProxy* platformCreateInspectorPage(); void platformOpen(); void platformDidClose(); + void platformDidCloseForCrash(); + void platformInvalidate(); void platformBringToFront(); + void platformBringInspectedPageToFront(); void platformHide(); bool platformIsFront(); void platformAttachAvailabilityChanged(bool); @@ -167,16 +187,24 @@ private: void platformDetach(); void platformSetAttachedWindowHeight(unsigned); void platformSetAttachedWindowWidth(unsigned); - void platformSetToolbarHeight(unsigned); + void platformStartWindowDrag(); void platformSave(const String& filename, const String& content, bool base64Encoded, bool forceSaveAs); void platformAppend(const String& filename, const String& content); +#if PLATFORM(MAC) && WK_API_ENABLED + bool platformCanAttach(bool webProcessCanAttach); +#else + bool platformCanAttach(bool webProcessCanAttach) { return webProcessCanAttach; } +#endif + // Called by WebInspectorProxy messages - void createInspectorPage(uint64_t& inspectorPageID, WebPageCreationParameters&); + void createInspectorPage(IPC::Attachment, bool canAttach, bool underTest); + void frontendLoaded(); void didClose(); void bringToFront(); void attachAvailabilityChanged(bool); void inspectedURLChanged(const String&); + void elementSelectionChanged(bool); void save(const String& filename, const String& content, bool base64Encoded, bool forceSaveAs); void append(const String& filename, const String& content); @@ -185,68 +213,56 @@ private: void sendMessageToRemoteFrontend(const String& message); #endif - bool canAttach(); + bool canAttach() const { return m_canAttach; } bool shouldOpenAttached(); + bool isUnderTest() const { return m_underTest; } + void open(); - WebPageGroup* inspectorPageGroup() const; + unsigned inspectionLevel() const; + + WebPreferences& inspectorPagePreferences() const; -#if PLATFORM(GTK) || PLATFORM(EFL) +#if PLATFORM(GTK) void createInspectorWindow(); + void updateInspectorWindowTitle() const; #endif - static const unsigned minimumWindowWidth; - static const unsigned minimumWindowHeight; - - static const unsigned initialWindowWidth; - static const unsigned initialWindowHeight; - - // Keep this in sync with the value in InspectorFrontendClientLocal. - static const unsigned minimumAttachedWidth; - static const unsigned minimumAttachedHeight; + WebPageProxy* m_inspectedPage { nullptr }; + WebPageProxy* m_inspectorPage { nullptr }; - WebPageProxy* m_page; + bool m_underTest { false }; + bool m_isVisible { false }; + bool m_isAttached { false }; + bool m_canAttach { false }; + bool m_isProfilingPage { false }; + bool m_showMessageSent { false }; + bool m_ignoreFirstBringToFront { false }; + bool m_elementSelectionActive { false }; + bool m_ignoreElementSelectionChange { false }; - bool m_isVisible; - bool m_isAttached; - bool m_isDebuggingJavaScript; - bool m_isProfilingJavaScript; - bool m_isProfilingPage; - bool m_showMessageSent; - bool m_createdInspectorPage; - bool m_ignoreFirstBringToFront; + IPC::Attachment m_connectionIdentifier; - // The debugger stops all the pages in the same PageGroup. Having - // all the inspectors in the same group will make it impossible to debug - // the inspector code, so we use the level to make different page groups. - unsigned m_level; + AttachmentSide m_attachmentSide {AttachmentSide::Bottom}; - AttachmentSide m_attachmentSide; - -#if PLATFORM(MAC) - RetainPtr<WKWebInspectorWKView> m_inspectorView; +#if PLATFORM(MAC) && WK_API_ENABLED + RetainPtr<WKWebInspectorWKWebView> m_inspectorView; RetainPtr<NSWindow> m_inspectorWindow; - RetainPtr<NSButton> m_dockBottomButton; - RetainPtr<NSButton> m_dockRightButton; RetainPtr<WKWebInspectorProxyObjCAdapter> m_inspectorProxyObjCAdapter; - String m_urlString; HashMap<String, RetainPtr<NSURL>> m_suggestedToActualURLMap; + RunLoop::Timer<WebInspectorProxy> m_closeTimer; + String m_urlString; #elif PLATFORM(GTK) WebInspectorClientGtk m_client; - GtkWidget* m_inspectorView; - GtkWidget* m_inspectorWindow; -#elif PLATFORM(EFL) - Evas_Object* m_inspectorView; - Ecore_Evas* m_inspectorWindow; + GtkWidget* m_inspectorView { nullptr }; + GtkWidget* m_inspectorWindow { nullptr }; + GtkWidget* m_headerBar { nullptr }; + String m_inspectedURLString; #endif #if ENABLE(INSPECTOR_SERVER) - int m_remoteInspectionPageId; + int m_remoteInspectionPageId { 0 }; #endif }; } // namespace WebKit - -#endif // ENABLE(INSPECTOR) - -#endif // WebInspectorProxy_h |