1 /* 2 * Copyright (C) 2007 Apple 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 6 * are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of 14 * its contributors may be used to endorse or promote products derived 15 * from this software without specific prior written permission. 16 * 17 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY 18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY 21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29 #ifndef InspectorFrontendHost_h 30 #define InspectorFrontendHost_h 31 32 #include "bindings/v8/ScriptWrappable.h" 33 #include "core/platform/ContextMenu.h" 34 #include "wtf/RefCounted.h" 35 #include "wtf/Vector.h" 36 #include "wtf/text/WTFString.h" 37 38 namespace WebCore { 39 40 class ContextMenuItem; 41 class DOMFileSystem; 42 class Event; 43 class FrontendMenuProvider; 44 class InspectorFrontendClient; 45 class Page; 46 47 class InspectorFrontendHost : public RefCounted<InspectorFrontendHost>, public ScriptWrappable { 48 public: 49 static PassRefPtr<InspectorFrontendHost> create(InspectorFrontendClient* client, Page* frontendPage) 50 { 51 return adoptRef(new InspectorFrontendHost(client, frontendPage)); 52 } 53 54 ~InspectorFrontendHost(); 55 void disconnectClient(); 56 57 void requestSetDockSide(const String&); 58 void closeWindow(); 59 void bringToFront(); 60 void setZoomFactor(float); 61 void inspectedURLChanged(const String&); 62 63 void setAttachedWindowHeight(unsigned); 64 void moveWindowBy(float x, float y) const; 65 void setInjectedScriptForOrigin(const String& origin, const String& script); 66 67 void copyText(const String& text); 68 void openInNewTab(const String& url); 69 void save(const String& url, const String& content, bool forceSaveAs); 70 void append(const String& url, const String& content); 71 void close(const String& url); 72 73 // Called from [Custom] implementations. 74 void showContextMenu(Event*, const Vector<ContextMenuItem>& items); 75 void sendMessageToBackend(const String& message); 76 77 String loadResourceSynchronously(const String& url); 78 String getSelectionBackgroundColor(); 79 String getSelectionForegroundColor(); 80 81 void requestFileSystems(); 82 void addFileSystem(); 83 void removeFileSystem(const String& fileSystemPath); 84 PassRefPtr<DOMFileSystem> isolatedFileSystem(const String& fileSystemName, const String& rootURL); 85 void indexPath(int requestId, const String& fileSystemPath); 86 void stopIndexing(int requestId); 87 void searchInPath(int requestId, const String& fileSystemPath, const String& query); 88 89 bool isUnderTest(); 90 91 // Deprecated but should stay around for a while as old front-ends may use them. 92 bool canInspectWorkers(); 93 bool canSaveAs(); 94 bool canSave(); 95 bool supportsFileSystems(); 96 void loaded(); 97 String hiddenPanels(); 98 String localizedStringsURL(); 99 100 private: 101 friend class FrontendMenuProvider; 102 InspectorFrontendHost(InspectorFrontendClient* client, Page* frontendPage); 103 104 InspectorFrontendClient* m_client; 105 Page* m_frontendPage; 106 FrontendMenuProvider* m_menuProvider; 107 }; 108 109 } // namespace WebCore 110 111 #endif // !defined(InspectorFrontendHost_h) 112