Changeset 51839 in webkit
- Timestamp:
- Dec 8, 2009 2:19:28 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 22 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r51838 r51839 1 2009-12-06 Pavel Feldman <pfeldman@chromium.org> 2 3 Reviewed by Timothy Hatcher. 4 5 Web Inspector: provide custom context menu in the front-end window. 6 7 https://bugs.webkit.org/show_bug.cgi?id=32200 8 9 * English.lproj/localizedStrings.js: 10 * GNUmakefile.am: 11 * WebCore.gypi: 12 * WebCore.pro: 13 * WebCore.vcproj/WebCore.vcproj: 14 * WebCore.xcodeproj/project.pbxproj: 15 * bindings/js/JSInspectorFrontendHostCustom.cpp: 16 (WebCore::JSInspectorFrontendHost::showContextMenu): 17 * inspector/InspectorFrontend.cpp: 18 (WebCore::InspectorFrontend::contextMenuItemSelected): 19 (WebCore::InspectorFrontend::contextMenuCleared): 20 * inspector/InspectorFrontend.h: 21 * inspector/InspectorFrontendHost.cpp: 22 (WebCore::InspectorFrontendHost::InspectorFrontendHost): 23 (WebCore::InspectorFrontendHost::~InspectorFrontendHost): 24 (WebCore::InspectorFrontendHost::showContextMenu): 25 (WebCore::InspectorFrontendHost::contextMenuItemSelected): 26 (WebCore::InspectorFrontendHost::contextMenuCleared): 27 * inspector/InspectorFrontendHost.h: 28 (WebCore::InspectorFrontendHost::MenuSelectionHandler::create): 29 (WebCore::InspectorFrontendHost::MenuSelectionHandler::~MenuSelectionHandler): 30 (WebCore::InspectorFrontendHost::MenuSelectionHandler::disconnect): 31 (WebCore::InspectorFrontendHost::MenuSelectionHandler::contextMenuItemSelected): 32 (WebCore::InspectorFrontendHost::MenuSelectionHandler::contextMenuCleared): 33 (WebCore::InspectorFrontendHost::MenuSelectionHandler::MenuSelectionHandler): 34 * inspector/InspectorFrontendHost.idl: 35 * inspector/front-end/ContextMenu.js: Added. 36 * inspector/front-end/WebKit.qrc: 37 * inspector/front-end/inspector.html: 38 * inspector/front-end/inspector.js: 39 (WebInspector.loaded): 40 (WebInspector.documentContextMenu): 41 * page/ContextMenuController.cpp: 42 (WebCore::ContextMenuController::ContextMenuController): 43 (WebCore::ContextMenuController::clearContextMenu): 44 (WebCore::ContextMenuController::handleContextMenuEvent): 45 (WebCore::ContextMenuController::showContextMenu): 46 (WebCore::ContextMenuController::createContextMenu): 47 (WebCore::ContextMenuController::contextMenuItemSelected): 48 * page/ContextMenuController.h: 49 * page/ContextMenuSelectionHandler.h: Added. 50 (WebCore::ContextMenuSelectionHandler::ContextMenuSelectionHandler): 51 (WebCore::ContextMenuSelectionHandler::~ContextMenuSelectionHandler): 52 * platform/ContextMenu.cpp: 53 (WebCore::ContextMenu::checkOrEnableIfNeeded): 54 * platform/ContextMenuItem.h: 55 1 56 2009-12-08 Andras Becsi <abecsi@inf.u-szeged.hu> 2 57 -
trunk/WebCore/GNUmakefile.am
r51813 r51839 1319 1319 WebCore/page/ContextMenuController.cpp \ 1320 1320 WebCore/page/ContextMenuController.h \ 1321 WebCore/page/ContextMenuSelectionHandler.h \ 1321 1322 WebCore/page/Coordinates.h \ 1322 1323 WebCore/page/DOMSelection.cpp \ -
trunk/WebCore/WebCore.gypi
r51681 r51839 1755 1755 'page/ContextMenuController.cpp', 1756 1756 'page/ContextMenuController.h', 1757 'page/ContextMenuSelectionHandler.h', 1757 1758 'page/DOMSelection.cpp', 1758 1759 'page/DOMSelection.h', … … 3640 3641 'inspector/front-end/ConsolePanel.js', 3641 3642 'inspector/front-end/ConsoleView.js', 3643 'inspector/front-end/ContextMenu.js', 3642 3644 'inspector/front-end/CookieItemsView.js', 3643 3645 'inspector/front-end/Database.js', -
trunk/WebCore/WebCore.pro
r51838 r51839 1836 1836 page/Console.h \ 1837 1837 page/ContextMenuController.h \ 1838 page/ContextMenuSelectionHandler.h \ 1838 1839 page/Coordinates.h \ 1839 1840 page/DOMSelection.h \ -
trunk/WebCore/WebCore.vcproj/WebCore.vcproj
r51793 r51839 20528 20528 </File> 20529 20529 <File 20530 RelativePath="..\page\ContextMenuSelectionHandler.h" 20531 > 20532 </File> 20533 <File 20530 20534 RelativePath="..\page\Coordinates.h" 20531 20535 > … … 42435 42439 </File> 42436 42440 <File 42441 RelativePath="..\inspector\front-end\ContextMenu.js" 42442 > 42443 </File> 42444 <File 42437 42445 RelativePath="..\inspector\front-end\Database.js" 42438 42446 > -
trunk/WebCore/WebCore.xcodeproj/project.pbxproj
r51793 r51839 1247 1247 7A74ECBB101839A600BF939E /* InspectorBackend.h in Headers */ = {isa = PBXBuildFile; fileRef = 7A74ECB9101839A600BF939E /* InspectorBackend.h */; }; 1248 1248 7A74ECBD101839DA00BF939E /* JSInspectorFrontendHostCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7A74ECBC101839DA00BF939E /* JSInspectorFrontendHostCustom.cpp */; }; 1249 7ADE722610CBBB9B006B3B3A /* ContextMenuSelectionHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 7ADE722510CBBB9B006B3B3A /* ContextMenuSelectionHandler.h */; }; 1249 1250 7AED3E050FBB1EAA00D2B03C /* InspectorFrontend.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7AED3E030FBB1EAA00D2B03C /* InspectorFrontend.cpp */; }; 1250 1251 7AED3E060FBB1EAA00D2B03C /* InspectorFrontend.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AED3E040FBB1EAA00D2B03C /* InspectorFrontend.h */; }; … … 6581 6582 7A74ECB9101839A600BF939E /* InspectorBackend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorBackend.h; sourceTree = "<group>"; }; 6582 6583 7A74ECBC101839DA00BF939E /* JSInspectorFrontendHostCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSInspectorFrontendHostCustom.cpp; sourceTree = "<group>"; }; 6584 7ADE722510CBBB9B006B3B3A /* ContextMenuSelectionHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContextMenuSelectionHandler.h; sourceTree = "<group>"; }; 6583 6585 7AED3E030FBB1EAA00D2B03C /* InspectorFrontend.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorFrontend.cpp; sourceTree = "<group>"; }; 6584 6586 7AED3E040FBB1EAA00D2B03C /* InspectorFrontend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorFrontend.h; sourceTree = "<group>"; }; … … 11227 11229 065AD4F30B0C2EDA005A2B1D /* ContextMenuController.cpp */, 11228 11230 065AD4F40B0C2EDA005A2B1D /* ContextMenuController.h */, 11231 7ADE722510CBBB9B006B3B3A /* ContextMenuSelectionHandler.h */, 11229 11232 FE6FD4850F676E5700092873 /* Coordinates.h */, 11230 11233 FE6FD4860F676E5700092873 /* Coordinates.idl */, … … 18226 18229 F4EAF4AF10C742B1009100D3 /* OpenTypeSanitizer.h in Headers */, 18227 18230 599D1E3310C97D6E00E0EF12 /* jni_utility_private.h in Headers */, 18231 7ADE722610CBBB9B006B3B3A /* ContextMenuSelectionHandler.h in Headers */, 18228 18232 ); 18229 18233 runOnlyForDeploymentPostprocessing = 0; -
trunk/WebCore/bindings/js/JSInspectorFrontendHostCustom.cpp
r51631 r51839 36 36 #if ENABLE(INSPECTOR) 37 37 38 #include "ContextMenuItem.h" 38 39 #include "ExceptionCode.h" 39 40 #include "Frame.h" 40 41 #include "InspectorController.h" 41 42 #include "InspectorFrontendHost.h" 43 #include "JSEvent.h" 42 44 #include "JSNode.h" 43 45 #include "JSRange.h" 46 #include "MouseEvent.h" 44 47 #include "Node.h" 45 48 #include "Page.h" … … 48 51 #include <runtime/JSArray.h> 49 52 #include <runtime/JSLock.h> 53 #include <runtime/JSObject.h> 50 54 #include <wtf/Vector.h> 51 55 … … 90 94 } 91 95 96 JSValue JSInspectorFrontendHost::showContextMenu(ExecState* execState, const ArgList& args) 97 { 98 if (args.size() < 2) 99 return jsUndefined(); 100 101 Event* event = toEvent(args.at(0)); 102 103 JSArray* array = asArray(args.at(1)); 104 Vector<ContextMenuItem> items; 105 106 for (size_t i = 0; i < array->length(); ++i) { 107 JSObject* item = asObject(array->getIndex(i)); 108 JSValue label = item->get(execState, Identifier(execState, "label")); 109 JSValue id = item->get(execState, Identifier(execState, "id")); 110 if (label.isUndefined() || id.isUndefined()) 111 items.append(ContextMenuItem(SeparatorType, ContextMenuItemTagNoAction, String())); 112 else { 113 ContextMenuAction typedId = static_cast<ContextMenuAction>(ContextMenuItemBaseCustomTag + id.toInt32(execState)); 114 items.append(ContextMenuItem(ActionType, typedId, label.toString(execState))); 115 } 116 } 117 118 impl()->showContextMenu(event, items); 119 return jsUndefined(); 120 } 121 92 122 } // namespace WebCore 93 123 -
trunk/WebCore/bindings/v8/custom/V8CustomBinding.h
r51681 r51839 497 497 498 498 DECLARE_CALLBACK(InspectorFrontendHostSearch); 499 DECLARE_CALLBACK(InspectorFrontendHostSetting); 500 DECLARE_CALLBACK(InspectorFrontendHostSetSetting); 499 DECLARE_CALLBACK(InspectorFrontendHostShowContextMenu); 501 500 502 501 DECLARE_CALLBACK(ConsoleProfile); -
trunk/WebCore/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp
r51631 r51839 85 85 } 86 86 87 CALLBACK_FUNC_DECL(InspectorFrontendHostShowContextMenu) 88 { 89 return v8::Undefined(); 90 } 91 87 92 } // namespace WebCore -
trunk/WebCore/inspector/InspectorFrontend.cpp
r51621 r51839 531 531 } 532 532 533 void InspectorFrontend::contextMenuItemSelected(int itemId) 534 { 535 ScriptFunctionCall function(m_scriptState, m_webInspector, "dispatch"); 536 function.appendArgument("contextMenuItemSelected"); 537 function.appendArgument(itemId); 538 function.call(); 539 } 540 541 void InspectorFrontend::contextMenuCleared() 542 { 543 callSimpleFunction("contextMenuCleared"); 544 } 545 533 546 void InspectorFrontend::evaluateForTestInFrontend(int callId, const String& script) 534 547 { -
trunk/WebCore/inspector/InspectorFrontend.h
r51621 r51839 133 133 void addNodesToSearchResult(const String& nodeIds); 134 134 135 void contextMenuItemSelected(int itemId); 136 void contextMenuCleared(); 137 135 138 ScriptState* scriptState() const { return m_scriptState; } 136 139 -
trunk/WebCore/inspector/InspectorFrontendHost.cpp
r51631 r51839 33 33 #if ENABLE(INSPECTOR) 34 34 35 #include "ContextMenu.h" 36 #include "ContextMenuItem.h" 37 #include "ContextMenuController.h" 38 #include "ContextMenuSelectionHandler.h" 35 39 #include "Element.h" 36 40 #include "Frame.h" 37 41 #include "FrameLoader.h" 42 #include "HitTestResult.h" 38 43 #include "HTMLFrameOwnerElement.h" 39 44 #include "InspectorClient.h" 45 #include "InspectorFrontend.h" 40 46 #include "InspectorResource.h" 47 #include "Page.h" 41 48 42 49 #include <wtf/RefPtr.h> … … 50 57 : m_inspectorController(inspectorController) 51 58 , m_client(client) 59 , m_menuSelectionHandler(MenuSelectionHandler::create(this)) 52 60 { 53 61 } … … 55 63 InspectorFrontendHost::~InspectorFrontendHost() 56 64 { 65 m_menuSelectionHandler->disconnect(); 57 66 } 58 67 … … 200 209 } 201 210 211 void InspectorFrontendHost::showContextMenu(Event* event, Vector<ContextMenuItem>& items) 212 { 213 if (!m_inspectorController) 214 return; 215 if (!m_inspectorController->windowVisible()) 216 return; 217 218 ContextMenuController* menuController = m_inspectorController->m_page->contextMenuController(); 219 menuController->showContextMenu(event, items, m_menuSelectionHandler); 220 } 221 222 void InspectorFrontendHost::contextMenuItemSelected(ContextMenuItem* item) 223 { 224 if (m_inspectorController && m_inspectorController->windowVisible()) { 225 int itemNumber = item->action() - ContextMenuItemBaseCustomTag; 226 m_inspectorController->m_frontend->contextMenuItemSelected(itemNumber); 227 } 228 } 229 230 void InspectorFrontendHost::contextMenuCleared() 231 { 232 if (m_inspectorController && m_inspectorController->windowVisible()) 233 m_inspectorController->m_frontend->contextMenuCleared(); 234 } 235 202 236 } // namespace WebCore 203 237 -
trunk/WebCore/inspector/InspectorFrontendHost.h
r51631 r51839 31 31 32 32 #include "Console.h" 33 #include "ContextMenuSelectionHandler.h" 33 34 #include "InspectorController.h" 34 35 #include "PlatformString.h" 35 36 36 37 #include <wtf/RefCounted.h> 38 #include <wtf/Vector.h> 37 39 38 40 namespace WebCore { 39 41 42 class ContextMenuItem; 43 class Event; 40 44 class InspectorClient; 41 45 class Node; … … 52 56 53 57 InspectorController* inspectorController() { return m_inspectorController; } 58 54 59 void disconnectController() { m_inspectorController = 0; } 55 60 … … 74 79 void setSetting(const String& key, const String& value); 75 80 81 // Called from [Custom] implementations. 82 void showContextMenu(Event*, Vector<ContextMenuItem>& items); 83 void contextMenuItemSelected(ContextMenuItem*); 84 void contextMenuCleared(); 85 76 86 private: 87 class MenuSelectionHandler : public ContextMenuSelectionHandler { 88 public: 89 static PassRefPtr<MenuSelectionHandler> create(InspectorFrontendHost* frontendHost) 90 { 91 return adoptRef(new MenuSelectionHandler(frontendHost)); 92 } 93 94 virtual ~MenuSelectionHandler() { } 95 96 void disconnect() { m_frontendHost = 0; } 97 98 virtual void contextMenuItemSelected(ContextMenuItem* item) 99 { 100 if (m_frontendHost) 101 m_frontendHost->contextMenuItemSelected(item); 102 } 103 104 virtual void contextMenuCleared() 105 { 106 if (m_frontendHost) 107 m_frontendHost->contextMenuCleared(); 108 } 109 110 private: 111 MenuSelectionHandler(InspectorFrontendHost* frontendHost) 112 : m_frontendHost(frontendHost) { } 113 InspectorFrontendHost* m_frontendHost; 114 }; 115 77 116 InspectorFrontendHost(InspectorController* inspectorController, InspectorClient* client); 78 117 79 118 InspectorController* m_inspectorController; 80 119 InspectorClient* m_client; 120 RefPtr<MenuSelectionHandler> m_menuSelectionHandler; 81 121 }; 82 122 -
trunk/WebCore/inspector/InspectorFrontendHost.idl
r51631 r51839 56 56 57 57 [Custom] void search(in Node node, in DOMString query); 58 [Custom] void showContextMenu(in MouseEvent event, in DOMObject items); 58 59 }; 59 60 } -
trunk/WebCore/inspector/front-end/ContextMenu.js
r51838 r51839 1 1 /* 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com>4 2 * Copyright (C) 2009 Google Inc. All rights reserved. 5 3 * … … 31 29 */ 32 30 33 module core{34 interface [35 GenerateConstructor36 ] InspectorFrontendHost {37 void loaded();38 void attach();39 void detach();40 void closeWindow();41 void windowUnloading(); 31 WebInspector.ContextMenu = function() { 32 this._items = []; 33 this._handlers = {}; 34 this._appendItem(WebInspector.UIString("Edit as HTML"), this._noop.bind(this)); 35 this._appendItem(WebInspector.UIString("Add attribute"), this._noop.bind(this)); 36 this._appendSeparator(); 37 this._appendItem(WebInspector.UIString("Copy"), this._copy.bind(this)); 38 this._appendItem(WebInspector.UIString("Delete"), this._delete.bind(this)); 39 } 42 40 43 void setAttachedWindowHeight(in unsigned long height); 44 void moveWindowBy(in float x, in float y); 41 WebInspector.ContextMenu.prototype = { 42 show: function(event) 43 { 44 // FIXME: Uncomment when popup menu has meaningful items. 45 // InspectorFrontendHost.showContextMenu(event, this._items); 46 // event.preventDefault(); 47 }, 45 48 46 DOMString localizedStringsURL(); 47 DOMString hiddenPanels(); 48 DOMString platform(); 49 DOMString port(); 49 _appendItem: function(label, handler) 50 { 51 var id = this._items.length; 52 this._items.push({id: id, label: label}); 53 this._handlers[id] = handler; 54 }, 50 55 51 void addResourceSourceToFrame(in long identifier, in Node frame); 52 boolean addSourceToFrame(in DOMString mimeType, in DOMString sourceValue, in Node frame); 56 _appendSeparator: function() 57 { 58 this._items.push({}); 59 }, 53 60 54 DOMString setting(in DOMString key); 55 void setSetting(in DOMString key, in DOMString value); 61 itemSelected: function(id) 62 { 63 if (this._handlers[id]) 64 this._handlers[id].call(this); 65 }, 56 66 57 [Custom] void search(in Node node, in DOMString query); 58 }; 67 _copy: function() 68 { 69 console.log("context menu: copy"); 70 }, 71 72 _delete: function() 73 { 74 console.log("context menu: delete"); 75 }, 76 77 _noop: function() 78 { 79 console.log("context menu: noop"); 80 } 59 81 } 82 83 84 WebInspector.contextMenuItemSelected = function(id) 85 { 86 if (WebInspector.contextMenu) 87 WebInspector.contextMenu.itemSelected(id); 88 } 89 90 WebInspector.contextMenuCleared = function() 91 { 92 console.log("context menu: cleared"); 93 } -
trunk/WebCore/inspector/front-end/WebKit.qrc
r51528 r51839 12 12 <file>ConsolePanel.js</file> 13 13 <file>ConsoleView.js</file> 14 <file>ContextMenu.js</file> 14 15 <file>CookieItemsView.js</file> 15 16 <file>Database.js</file> -
trunk/WebCore/inspector/front-end/inspector.html
r51528 r51839 38 38 <script type="text/javascript" src="InspectorFrontendHostStub.js"></script> 39 39 <script type="text/javascript" src="Object.js"></script> 40 <script type="text/javascript" src="ContextMenu.js"></script> 40 41 <script type="text/javascript" src="KeyboardShortcut.js"></script> 41 42 <script type="text/javascript" src="TextPrompt.js"></script> -
trunk/WebCore/inspector/front-end/inspector.js
r51553 r51839 472 472 document.addEventListener("beforecopy", this.documentCanCopy.bind(this), true); 473 473 document.addEventListener("copy", this.documentCopy.bind(this), true); 474 document.addEventListener("contextmenu", this.contextMenu .bind(this), true);474 document.addEventListener("contextmenu", this.contextMenuEventFired.bind(this), true); 475 475 476 476 var mainPanelsElement = document.getElementById("main-panels"); … … 749 749 } 750 750 751 WebInspector.contextMenu = function(event)751 WebInspector.contextMenuEventFired = function(event) 752 752 { 753 753 if (event.handled || event.target.hasStyleClass("popup-glasspane")) 754 754 event.preventDefault(); 755 756 if (!this.contextMenu) 757 this.contextMenu = new WebInspector.ContextMenu(); 758 this.contextMenu.show(event); 755 759 } 756 760 -
trunk/WebCore/page/ContextMenuController.cpp
r49809 r51839 32 32 #include "ContextMenu.h" 33 33 #include "ContextMenuClient.h" 34 #include "ContextMenuSelectionHandler.h" 34 35 #include "Document.h" 35 36 #include "DocumentFragment.h" … … 67 68 , m_client(client) 68 69 , m_contextMenu(0) 70 , m_selectionHandler(0) 69 71 { 70 72 ASSERT_ARG(page, page); … … 80 82 { 81 83 m_contextMenu.set(0); 84 if (m_selectionHandler) 85 m_selectionHandler->contextMenuCleared(); 86 m_selectionHandler = 0; 82 87 } 83 88 84 89 void ContextMenuController::handleContextMenuEvent(Event* event) 85 90 { 86 ASSERT(event->type() == eventNames().contextmenuEvent); 87 if (!event->isMouseEvent()) 88 return; 91 m_contextMenu.set(createContextMenu(event)); 92 if (!m_contextMenu) 93 return; 94 m_contextMenu->populate(); 95 showContextMenu(event); 96 } 97 98 void ContextMenuController::showContextMenu(Event* event, Vector<ContextMenuItem>& items, PassRefPtr<ContextMenuSelectionHandler> selectionHandler) 99 { 100 m_selectionHandler = selectionHandler; 101 102 m_contextMenu.set(createContextMenu(event)); 103 if (!m_contextMenu) { 104 clearContextMenu(); 105 return; 106 } 107 for (size_t i = 0; i < items.size(); ++i) { 108 ContextMenuItem& item = items[i]; 109 m_contextMenu->appendItem(item); 110 } 111 showContextMenu(event); 112 } 113 114 ContextMenu* ContextMenuController::createContextMenu(Event* event) 115 { 116 if (!event->isMouseEvent()) 117 return 0; 89 118 MouseEvent* mouseEvent = static_cast<MouseEvent*>(event); 90 119 HitTestResult result(mouseEvent->absoluteLocation()); … … 94 123 95 124 if (!result.innerNonSharedNode()) 96 return; 97 98 m_contextMenu.set(new ContextMenu(result)); 99 m_contextMenu->populate(); 125 return 0; 126 return new ContextMenu(result); 127 } 128 129 void ContextMenuController::showContextMenu(Event* event) 130 { 100 131 #if ENABLE(INSPECTOR) 101 132 if (m_page->inspectorController()->enabled()) 102 133 m_contextMenu->addInspectElementItem(); 103 134 #endif 104 105 135 PlatformMenuDescription customMenu = m_client->getCustomMenuFromDefaultItems(m_contextMenu.get()); 106 136 m_contextMenu->setPlatformDescription(customMenu); 107 108 137 event->setDefaultHandled(); 109 138 } … … 124 153 if (item->action() >= ContextMenuItemBaseApplicationTag) { 125 154 m_client->contextMenuItemSelected(item, m_contextMenu.get()); 155 return; 156 } 157 158 if (item->action() >= ContextMenuItemBaseCustomTag) { 159 ASSERT(m_selectionHandler); 160 m_selectionHandler->contextMenuItemSelected(item); 126 161 return; 127 162 } -
trunk/WebCore/page/ContextMenuController.h
r45891 r51839 29 29 #include <wtf/Noncopyable.h> 30 30 #include <wtf/OwnPtr.h> 31 #include <wtf/PassRefPtr.h> 32 #include <wtf/RefPtr.h> 33 #include <wtf/Vector.h> 31 34 32 35 namespace WebCore { … … 35 38 class ContextMenuClient; 36 39 class ContextMenuItem; 40 class ContextMenuSelectionHandler; 37 41 class Event; 38 42 class Page; … … 49 53 50 54 void handleContextMenuEvent(Event*); 55 void showContextMenu(Event*, Vector<ContextMenuItem>&, PassRefPtr<ContextMenuSelectionHandler>); 56 51 57 void contextMenuItemSelected(ContextMenuItem*); 52 58 53 59 private: 60 ContextMenu* createContextMenu(Event*); 61 void showContextMenu(Event*); 62 54 63 Page* m_page; 55 64 ContextMenuClient* m_client; 56 65 OwnPtr<ContextMenu> m_contextMenu; 66 RefPtr<ContextMenuSelectionHandler> m_selectionHandler; 57 67 }; 58 68 -
trunk/WebCore/page/ContextMenuSelectionHandler.h
r51838 r51839 1 1 /* 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com>4 2 * Copyright (C) 2009 Google Inc. All rights reserved. 5 3 * … … 31 29 */ 32 30 33 module core { 34 interface [ 35 GenerateConstructor 36 ] InspectorFrontendHost { 37 void loaded(); 38 void attach(); 39 void detach(); 40 void closeWindow(); 41 void windowUnloading(); 31 #ifndef ContextMenuSelectionHandler_h 32 #define ContextMenuSelectionHandler_h 42 33 43 void setAttachedWindowHeight(in unsigned long height); 44 void moveWindowBy(in float x, in float y); 34 #include <wtf/RefCounted.h> 45 35 46 DOMString localizedStringsURL(); 47 DOMString hiddenPanels(); 48 DOMString platform(); 49 DOMString port(); 36 namespace WebCore { 50 37 51 void addResourceSourceToFrame(in long identifier, in Node frame); 52 boolean addSourceToFrame(in DOMString mimeType, in DOMString sourceValue, in Node frame); 38 class ContextMenuItem; 53 39 54 DOMString setting(in DOMString key); 55 void setSetting(in DOMString key, in DOMString value); 40 class ContextMenuSelectionHandler : public RefCounted<ContextMenuSelectionHandler> { 41 public: 42 ContextMenuSelectionHandler() { } 43 virtual ~ContextMenuSelectionHandler() { }; 56 44 57 [Custom] void search(in Node node, in DOMString query); 45 virtual void contextMenuItemSelected(ContextMenuItem*) = 0; 46 virtual void contextMenuCleared() = 0; 58 47 }; 48 59 49 } 50 51 #endif // ContextMenuSelectionHandler_h -
trunk/WebCore/platform/ContextMenu.cpp
r49067 r51839 41 41 #include "Frame.h" 42 42 #include "FrameLoader.h" 43 #include "InspectorController.h" 43 44 #include "KURL.h" 44 45 #include "LocalizedStrings.h" … … 780 781 case ContextMenuItemTagInspectElement: 781 782 #endif 783 case ContextMenuItemBaseCustomTag: 782 784 case ContextMenuItemBaseApplicationTag: 783 785 break; -
trunk/WebCore/platform/ContextMenuItem.h
r51149 r51839 144 144 ContextMenuItemTagChangeBack, 145 145 #endif 146 ContextMenuItemBaseCustomTag = 5000, 146 147 ContextMenuItemBaseApplicationTag = 10000 147 148 };
Note: See TracChangeset
for help on using the changeset viewer.