void WebEditorClient::registerCommandForUndo(PassRefPtr<EditCommand> command) { IWebUIDelegate* uiDelegate = 0; if (SUCCEEDED(m_webView->uiDelegate(&uiDelegate))) { String actionName = undoNameForEditAction(command->editingAction()); WebEditorUndoCommand* undoCommand = new WebEditorUndoCommand(command, true); if (!undoCommand) return; uiDelegate->registerUndoWithTarget(m_undoTarget, 0, undoCommand); undoCommand->Release(); // the undo manager owns the reference if (!actionName.isEmpty()) uiDelegate->setActionTitle(BString(actionName)); uiDelegate->Release(); } }