gecko-dev/widget/windows/nsDataObj.cpp
Brian R. Bondy c9d9685f5d Bug 679226 - Fold widget/src into widget. r=roc
--HG--
rename : widget/public/LookAndFeel.h => widget/LookAndFeel.h
rename : widget/public/WidgetTraceEvent.h => widget/WidgetTraceEvent.h
rename : widget/src/android/AndroidBridge.cpp => widget/android/AndroidBridge.cpp
rename : widget/src/android/AndroidBridge.h => widget/android/AndroidBridge.h
rename : widget/src/android/AndroidDirectTexture.cpp => widget/android/AndroidDirectTexture.cpp
rename : widget/src/android/AndroidDirectTexture.h => widget/android/AndroidDirectTexture.h
rename : widget/src/android/AndroidGraphicBuffer.cpp => widget/android/AndroidGraphicBuffer.cpp
rename : widget/src/android/AndroidGraphicBuffer.h => widget/android/AndroidGraphicBuffer.h
rename : widget/src/android/AndroidJNI.cpp => widget/android/AndroidJNI.cpp
rename : widget/src/android/AndroidJavaWrappers.cpp => widget/android/AndroidJavaWrappers.cpp
rename : widget/src/android/AndroidJavaWrappers.h => widget/android/AndroidJavaWrappers.h
rename : widget/src/android/GfxInfo.cpp => widget/android/GfxInfo.cpp
rename : widget/src/android/GfxInfo.h => widget/android/GfxInfo.h
rename : widget/src/android/Makefile.in => widget/android/Makefile.in
rename : widget/src/android/nsAppShell.cpp => widget/android/nsAppShell.cpp
rename : widget/src/android/nsAppShell.h => widget/android/nsAppShell.h
rename : widget/src/android/nsClipboard.cpp => widget/android/nsClipboard.cpp
rename : widget/src/android/nsClipboard.h => widget/android/nsClipboard.h
rename : widget/src/android/nsDeviceContextAndroid.cpp => widget/android/nsDeviceContextAndroid.cpp
rename : widget/src/android/nsDeviceContextAndroid.h => widget/android/nsDeviceContextAndroid.h
rename : widget/src/android/nsFilePicker.cpp => widget/android/nsFilePicker.cpp
rename : widget/src/android/nsFilePicker.h => widget/android/nsFilePicker.h
rename : widget/src/android/nsIAndroidBridge.idl => widget/android/nsIAndroidBridge.idl
rename : widget/src/android/nsIMEPicker.cpp => widget/android/nsIMEPicker.cpp
rename : widget/src/android/nsIMEPicker.h => widget/android/nsIMEPicker.h
rename : widget/src/android/nsIdleServiceAndroid.cpp => widget/android/nsIdleServiceAndroid.cpp
rename : widget/src/android/nsIdleServiceAndroid.h => widget/android/nsIdleServiceAndroid.h
rename : widget/src/android/nsLookAndFeel.cpp => widget/android/nsLookAndFeel.cpp
rename : widget/src/android/nsLookAndFeel.h => widget/android/nsLookAndFeel.h
rename : widget/src/android/nsPrintOptionsAndroid.cpp => widget/android/nsPrintOptionsAndroid.cpp
rename : widget/src/android/nsPrintOptionsAndroid.h => widget/android/nsPrintOptionsAndroid.h
rename : widget/src/android/nsScreenManagerAndroid.cpp => widget/android/nsScreenManagerAndroid.cpp
rename : widget/src/android/nsScreenManagerAndroid.h => widget/android/nsScreenManagerAndroid.h
rename : widget/src/android/nsWidgetFactory.cpp => widget/android/nsWidgetFactory.cpp
rename : widget/src/android/nsWindow.cpp => widget/android/nsWindow.cpp
rename : widget/src/android/nsWindow.h => widget/android/nsWindow.h
rename : widget/src/build/Makefile.in => widget/build/Makefile.in
rename : widget/src/build/nsWinWidgetFactory.cpp => widget/build/nsWinWidgetFactory.cpp
rename : widget/src/build/res/aliasb.cur => widget/build/res/aliasb.cur
rename : widget/src/build/res/cell.cur => widget/build/res/cell.cur
rename : widget/src/build/res/col_resize.cur => widget/build/res/col_resize.cur
rename : widget/src/build/res/copy.cur => widget/build/res/copy.cur
rename : widget/src/build/res/grab.cur => widget/build/res/grab.cur
rename : widget/src/build/res/grabbing.cur => widget/build/res/grabbing.cur
rename : widget/src/build/res/none.cur => widget/build/res/none.cur
rename : widget/src/build/res/row_resize.cur => widget/build/res/row_resize.cur
rename : widget/src/build/res/select.cur => widget/build/res/select.cur
rename : widget/src/build/res/vertical_text.cur => widget/build/res/vertical_text.cur
rename : widget/src/build/res/zoom_in.cur => widget/build/res/zoom_in.cur
rename : widget/src/build/res/zoom_out.cur => widget/build/res/zoom_out.cur
rename : widget/src/build/widget.rc => widget/build/widget.rc
rename : widget/src/cocoa/ComplexTextInputPanel.h => widget/cocoa/ComplexTextInputPanel.h
rename : widget/src/cocoa/ComplexTextInputPanel.mm => widget/cocoa/ComplexTextInputPanel.mm
rename : widget/src/cocoa/CustomCocoaEvents.h => widget/cocoa/CustomCocoaEvents.h
rename : widget/src/cocoa/GfxInfo.h => widget/cocoa/GfxInfo.h
rename : widget/src/cocoa/GfxInfo.mm => widget/cocoa/GfxInfo.mm
rename : widget/src/cocoa/Makefile.in => widget/cocoa/Makefile.in
rename : widget/src/cocoa/TextInputHandler.h => widget/cocoa/TextInputHandler.h
rename : widget/src/cocoa/TextInputHandler.mm => widget/cocoa/TextInputHandler.mm
rename : widget/src/cocoa/WidgetTraceEvent.mm => widget/cocoa/WidgetTraceEvent.mm
rename : widget/src/cocoa/crashtests/373122-1-inner.html => widget/cocoa/crashtests/373122-1-inner.html
rename : widget/src/cocoa/crashtests/373122-1.html => widget/cocoa/crashtests/373122-1.html
rename : widget/src/cocoa/crashtests/397209-1.html => widget/cocoa/crashtests/397209-1.html
rename : widget/src/cocoa/crashtests/403296-1.xhtml => widget/cocoa/crashtests/403296-1.xhtml
rename : widget/src/cocoa/crashtests/419737-1.html => widget/cocoa/crashtests/419737-1.html
rename : widget/src/cocoa/crashtests/435223-1.html => widget/cocoa/crashtests/435223-1.html
rename : widget/src/cocoa/crashtests/444260-1.xul => widget/cocoa/crashtests/444260-1.xul
rename : widget/src/cocoa/crashtests/444864-1.html => widget/cocoa/crashtests/444864-1.html
rename : widget/src/cocoa/crashtests/449111-1.html => widget/cocoa/crashtests/449111-1.html
rename : widget/src/cocoa/crashtests/460349-1.xhtml => widget/cocoa/crashtests/460349-1.xhtml
rename : widget/src/cocoa/crashtests/460387-1.html => widget/cocoa/crashtests/460387-1.html
rename : widget/src/cocoa/crashtests/464589-1.html => widget/cocoa/crashtests/464589-1.html
rename : widget/src/cocoa/crashtests/crashtests.list => widget/cocoa/crashtests/crashtests.list
rename : widget/src/cocoa/cursors/arrowN.tiff => widget/cocoa/cursors/arrowN.tiff
rename : widget/src/cocoa/cursors/arrowS.tiff => widget/cocoa/cursors/arrowS.tiff
rename : widget/src/cocoa/cursors/colResize.tiff => widget/cocoa/cursors/colResize.tiff
rename : widget/src/cocoa/cursors/help.tiff => widget/cocoa/cursors/help.tiff
rename : widget/src/cocoa/cursors/rowResize.tiff => widget/cocoa/cursors/rowResize.tiff
rename : widget/src/cocoa/cursors/sizeNE.tiff => widget/cocoa/cursors/sizeNE.tiff
rename : widget/src/cocoa/cursors/sizeNESW.tiff => widget/cocoa/cursors/sizeNESW.tiff
rename : widget/src/cocoa/cursors/sizeNS.tiff => widget/cocoa/cursors/sizeNS.tiff
rename : widget/src/cocoa/cursors/sizeNW.tiff => widget/cocoa/cursors/sizeNW.tiff
rename : widget/src/cocoa/cursors/sizeNWSE.tiff => widget/cocoa/cursors/sizeNWSE.tiff
rename : widget/src/cocoa/cursors/sizeSE.tiff => widget/cocoa/cursors/sizeSE.tiff
rename : widget/src/cocoa/cursors/sizeSW.tiff => widget/cocoa/cursors/sizeSW.tiff
rename : widget/src/cocoa/cursors/spin1.tiff => widget/cocoa/cursors/spin1.tiff
rename : widget/src/cocoa/cursors/spin2.tiff => widget/cocoa/cursors/spin2.tiff
rename : widget/src/cocoa/cursors/spin3.tiff => widget/cocoa/cursors/spin3.tiff
rename : widget/src/cocoa/cursors/spin4.tiff => widget/cocoa/cursors/spin4.tiff
rename : widget/src/cocoa/cursors/vtIBeam.tiff => widget/cocoa/cursors/vtIBeam.tiff
rename : widget/src/cocoa/cursors/zoomIn.tiff => widget/cocoa/cursors/zoomIn.tiff
rename : widget/src/cocoa/cursors/zoomOut.tiff => widget/cocoa/cursors/zoomOut.tiff
rename : widget/src/cocoa/mozView.h => widget/cocoa/mozView.h
rename : widget/src/cocoa/nsAppShell.h => widget/cocoa/nsAppShell.h
rename : widget/src/cocoa/nsAppShell.mm => widget/cocoa/nsAppShell.mm
rename : widget/src/cocoa/nsBidiKeyboard.h => widget/cocoa/nsBidiKeyboard.h
rename : widget/src/cocoa/nsBidiKeyboard.mm => widget/cocoa/nsBidiKeyboard.mm
rename : widget/src/cocoa/nsChangeObserver.h => widget/cocoa/nsChangeObserver.h
rename : widget/src/cocoa/nsChildView.h => widget/cocoa/nsChildView.h
rename : widget/src/cocoa/nsChildView.mm => widget/cocoa/nsChildView.mm
rename : widget/src/cocoa/nsClipboard.h => widget/cocoa/nsClipboard.h
rename : widget/src/cocoa/nsClipboard.mm => widget/cocoa/nsClipboard.mm
rename : widget/src/cocoa/nsCocoaFeatures.h => widget/cocoa/nsCocoaFeatures.h
rename : widget/src/cocoa/nsCocoaFeatures.mm => widget/cocoa/nsCocoaFeatures.mm
rename : widget/src/cocoa/nsCocoaUtils.h => widget/cocoa/nsCocoaUtils.h
rename : widget/src/cocoa/nsCocoaUtils.mm => widget/cocoa/nsCocoaUtils.mm
rename : widget/src/cocoa/nsCocoaWindow.h => widget/cocoa/nsCocoaWindow.h
rename : widget/src/cocoa/nsCocoaWindow.mm => widget/cocoa/nsCocoaWindow.mm
rename : widget/src/cocoa/nsCursorManager.h => widget/cocoa/nsCursorManager.h
rename : widget/src/cocoa/nsCursorManager.mm => widget/cocoa/nsCursorManager.mm
rename : widget/src/cocoa/nsDeviceContextSpecX.h => widget/cocoa/nsDeviceContextSpecX.h
rename : widget/src/cocoa/nsDeviceContextSpecX.mm => widget/cocoa/nsDeviceContextSpecX.mm
rename : widget/src/cocoa/nsDragService.h => widget/cocoa/nsDragService.h
rename : widget/src/cocoa/nsDragService.mm => widget/cocoa/nsDragService.mm
rename : widget/src/cocoa/nsFilePicker.h => widget/cocoa/nsFilePicker.h
rename : widget/src/cocoa/nsFilePicker.mm => widget/cocoa/nsFilePicker.mm
rename : widget/src/cocoa/nsIdleServiceX.h => widget/cocoa/nsIdleServiceX.h
rename : widget/src/cocoa/nsIdleServiceX.mm => widget/cocoa/nsIdleServiceX.mm
rename : widget/src/cocoa/nsLookAndFeel.h => widget/cocoa/nsLookAndFeel.h
rename : widget/src/cocoa/nsLookAndFeel.mm => widget/cocoa/nsLookAndFeel.mm
rename : widget/src/cocoa/nsMacCursor.h => widget/cocoa/nsMacCursor.h
rename : widget/src/cocoa/nsMacCursor.mm => widget/cocoa/nsMacCursor.mm
rename : widget/src/cocoa/nsMacDockSupport.h => widget/cocoa/nsMacDockSupport.h
rename : widget/src/cocoa/nsMacDockSupport.mm => widget/cocoa/nsMacDockSupport.mm
rename : widget/src/cocoa/nsMenuBarX.h => widget/cocoa/nsMenuBarX.h
rename : widget/src/cocoa/nsMenuBarX.mm => widget/cocoa/nsMenuBarX.mm
rename : widget/src/cocoa/nsMenuBaseX.h => widget/cocoa/nsMenuBaseX.h
rename : widget/src/cocoa/nsMenuGroupOwnerX.h => widget/cocoa/nsMenuGroupOwnerX.h
rename : widget/src/cocoa/nsMenuGroupOwnerX.mm => widget/cocoa/nsMenuGroupOwnerX.mm
rename : widget/src/cocoa/nsMenuItemIconX.h => widget/cocoa/nsMenuItemIconX.h
rename : widget/src/cocoa/nsMenuItemIconX.mm => widget/cocoa/nsMenuItemIconX.mm
rename : widget/src/cocoa/nsMenuItemX.h => widget/cocoa/nsMenuItemX.h
rename : widget/src/cocoa/nsMenuItemX.mm => widget/cocoa/nsMenuItemX.mm
rename : widget/src/cocoa/nsMenuUtilsX.h => widget/cocoa/nsMenuUtilsX.h
rename : widget/src/cocoa/nsMenuUtilsX.mm => widget/cocoa/nsMenuUtilsX.mm
rename : widget/src/cocoa/nsMenuX.h => widget/cocoa/nsMenuX.h
rename : widget/src/cocoa/nsMenuX.mm => widget/cocoa/nsMenuX.mm
rename : widget/src/cocoa/nsNativeThemeCocoa.h => widget/cocoa/nsNativeThemeCocoa.h
rename : widget/src/cocoa/nsNativeThemeCocoa.mm => widget/cocoa/nsNativeThemeCocoa.mm
rename : widget/src/cocoa/nsNativeThemeColors.h => widget/cocoa/nsNativeThemeColors.h
rename : widget/src/cocoa/nsPIWidgetCocoa.idl => widget/cocoa/nsPIWidgetCocoa.idl
rename : widget/src/cocoa/nsPrintDialogX.h => widget/cocoa/nsPrintDialogX.h
rename : widget/src/cocoa/nsPrintDialogX.mm => widget/cocoa/nsPrintDialogX.mm
rename : widget/src/cocoa/nsPrintOptionsX.h => widget/cocoa/nsPrintOptionsX.h
rename : widget/src/cocoa/nsPrintOptionsX.mm => widget/cocoa/nsPrintOptionsX.mm
rename : widget/src/cocoa/nsPrintSettingsX.h => widget/cocoa/nsPrintSettingsX.h
rename : widget/src/cocoa/nsPrintSettingsX.mm => widget/cocoa/nsPrintSettingsX.mm
rename : widget/src/cocoa/nsScreenCocoa.h => widget/cocoa/nsScreenCocoa.h
rename : widget/src/cocoa/nsScreenCocoa.mm => widget/cocoa/nsScreenCocoa.mm
rename : widget/src/cocoa/nsScreenManagerCocoa.h => widget/cocoa/nsScreenManagerCocoa.h
rename : widget/src/cocoa/nsScreenManagerCocoa.mm => widget/cocoa/nsScreenManagerCocoa.mm
rename : widget/src/cocoa/nsSound.h => widget/cocoa/nsSound.h
rename : widget/src/cocoa/nsSound.mm => widget/cocoa/nsSound.mm
rename : widget/src/cocoa/nsStandaloneNativeMenu.h => widget/cocoa/nsStandaloneNativeMenu.h
rename : widget/src/cocoa/nsStandaloneNativeMenu.mm => widget/cocoa/nsStandaloneNativeMenu.mm
rename : widget/src/cocoa/nsToolkit.h => widget/cocoa/nsToolkit.h
rename : widget/src/cocoa/nsToolkit.mm => widget/cocoa/nsToolkit.mm
rename : widget/src/cocoa/nsWidgetFactory.mm => widget/cocoa/nsWidgetFactory.mm
rename : widget/src/cocoa/nsWindowMap.h => widget/cocoa/nsWindowMap.h
rename : widget/src/cocoa/nsWindowMap.mm => widget/cocoa/nsWindowMap.mm
rename : widget/src/cocoa/resources/MainMenu.nib/classes.nib => widget/cocoa/resources/MainMenu.nib/classes.nib
rename : widget/src/cocoa/resources/MainMenu.nib/info.nib => widget/cocoa/resources/MainMenu.nib/info.nib
rename : widget/src/cocoa/resources/MainMenu.nib/keyedobjects.nib => widget/cocoa/resources/MainMenu.nib/keyedobjects.nib
rename : widget/src/crashtests/303901-1.html => widget/crashtests/303901-1.html
rename : widget/src/crashtests/303901-2.html => widget/crashtests/303901-2.html
rename : widget/src/crashtests/380359-1.xhtml => widget/crashtests/380359-1.xhtml
rename : widget/src/crashtests/crashtests.list => widget/crashtests/crashtests.list
rename : widget/src/gonk/Framebuffer.cpp => widget/gonk/Framebuffer.cpp
rename : widget/src/gonk/Framebuffer.h => widget/gonk/Framebuffer.h
rename : widget/src/gonk/Makefile.in => widget/gonk/Makefile.in
rename : widget/src/gonk/nsAppShell.cpp => widget/gonk/nsAppShell.cpp
rename : widget/src/gonk/nsAppShell.h => widget/gonk/nsAppShell.h
rename : widget/src/gonk/nsLookAndFeel.cpp => widget/gonk/nsLookAndFeel.cpp
rename : widget/src/gonk/nsLookAndFeel.h => widget/gonk/nsLookAndFeel.h
rename : widget/src/gonk/nsScreenManagerGonk.cpp => widget/gonk/nsScreenManagerGonk.cpp
rename : widget/src/gonk/nsScreenManagerGonk.h => widget/gonk/nsScreenManagerGonk.h
rename : widget/src/gonk/nsWidgetFactory.cpp => widget/gonk/nsWidgetFactory.cpp
rename : widget/src/gonk/nsWindow.cpp => widget/gonk/nsWindow.cpp
rename : widget/src/gonk/nsWindow.h => widget/gonk/nsWindow.h
rename : widget/src/gtk2/Makefile.in => widget/gtk2/Makefile.in
rename : widget/src/gtk2/WidgetTraceEvent.cpp => widget/gtk2/WidgetTraceEvent.cpp
rename : widget/src/gtk2/crashtests/673390-1.html => widget/gtk2/crashtests/673390-1.html
rename : widget/src/gtk2/crashtests/crashtests.list => widget/gtk2/crashtests/crashtests.list
rename : widget/src/gtk2/gtk2compat.h => widget/gtk2/gtk2compat.h
rename : widget/src/gtk2/gtk2drawing.c => widget/gtk2/gtk2drawing.c
rename : widget/src/gtk2/gtkdrawing.h => widget/gtk2/gtkdrawing.h
rename : widget/src/gtk2/maiRedundantObjectFactory.c => widget/gtk2/maiRedundantObjectFactory.c
rename : widget/src/gtk2/maiRedundantObjectFactory.h => widget/gtk2/maiRedundantObjectFactory.h
rename : widget/src/gtk2/mozcontainer.c => widget/gtk2/mozcontainer.c
rename : widget/src/gtk2/mozcontainer.h => widget/gtk2/mozcontainer.h
rename : widget/src/gtk2/nsAppShell.cpp => widget/gtk2/nsAppShell.cpp
rename : widget/src/gtk2/nsAppShell.h => widget/gtk2/nsAppShell.h
rename : widget/src/gtk2/nsBidiKeyboard.cpp => widget/gtk2/nsBidiKeyboard.cpp
rename : widget/src/gtk2/nsBidiKeyboard.h => widget/gtk2/nsBidiKeyboard.h
rename : widget/src/gtk2/nsCUPSShim.cpp => widget/gtk2/nsCUPSShim.cpp
rename : widget/src/gtk2/nsCUPSShim.h => widget/gtk2/nsCUPSShim.h
rename : widget/src/gtk2/nsClipboard.cpp => widget/gtk2/nsClipboard.cpp
rename : widget/src/gtk2/nsClipboard.h => widget/gtk2/nsClipboard.h
rename : widget/src/gtk2/nsDeviceContextSpecG.cpp => widget/gtk2/nsDeviceContextSpecG.cpp
rename : widget/src/gtk2/nsDeviceContextSpecG.h => widget/gtk2/nsDeviceContextSpecG.h
rename : widget/src/gtk2/nsDragService.cpp => widget/gtk2/nsDragService.cpp
rename : widget/src/gtk2/nsDragService.h => widget/gtk2/nsDragService.h
rename : widget/src/gtk2/nsFilePicker.cpp => widget/gtk2/nsFilePicker.cpp
rename : widget/src/gtk2/nsFilePicker.h => widget/gtk2/nsFilePicker.h
rename : widget/src/gtk2/nsGTKToolkit.h => widget/gtk2/nsGTKToolkit.h
rename : widget/src/gtk2/nsGtkCursors.h => widget/gtk2/nsGtkCursors.h
rename : widget/src/gtk2/nsGtkIMModule.cpp => widget/gtk2/nsGtkIMModule.cpp
rename : widget/src/gtk2/nsGtkIMModule.h => widget/gtk2/nsGtkIMModule.h
rename : widget/src/gtk2/nsGtkKeyUtils.cpp => widget/gtk2/nsGtkKeyUtils.cpp
rename : widget/src/gtk2/nsGtkKeyUtils.h => widget/gtk2/nsGtkKeyUtils.h
rename : widget/src/gtk2/nsIImageToPixbuf.h => widget/gtk2/nsIImageToPixbuf.h
rename : widget/src/gtk2/nsIdleServiceGTK.cpp => widget/gtk2/nsIdleServiceGTK.cpp
rename : widget/src/gtk2/nsIdleServiceGTK.h => widget/gtk2/nsIdleServiceGTK.h
rename : widget/src/gtk2/nsImageToPixbuf.cpp => widget/gtk2/nsImageToPixbuf.cpp
rename : widget/src/gtk2/nsImageToPixbuf.h => widget/gtk2/nsImageToPixbuf.h
rename : widget/src/gtk2/nsLookAndFeel.cpp => widget/gtk2/nsLookAndFeel.cpp
rename : widget/src/gtk2/nsLookAndFeel.h => widget/gtk2/nsLookAndFeel.h
rename : widget/src/gtk2/nsNativeKeyBindings.cpp => widget/gtk2/nsNativeKeyBindings.cpp
rename : widget/src/gtk2/nsNativeKeyBindings.h => widget/gtk2/nsNativeKeyBindings.h
rename : widget/src/gtk2/nsNativeThemeGTK.cpp => widget/gtk2/nsNativeThemeGTK.cpp
rename : widget/src/gtk2/nsNativeThemeGTK.h => widget/gtk2/nsNativeThemeGTK.h
rename : widget/src/gtk2/nsPSPrinters.cpp => widget/gtk2/nsPSPrinters.cpp
rename : widget/src/gtk2/nsPSPrinters.h => widget/gtk2/nsPSPrinters.h
rename : widget/src/gtk2/nsPaperPS.cpp => widget/gtk2/nsPaperPS.cpp
rename : widget/src/gtk2/nsPaperPS.h => widget/gtk2/nsPaperPS.h
rename : widget/src/gtk2/nsPrintDialogGTK.cpp => widget/gtk2/nsPrintDialogGTK.cpp
rename : widget/src/gtk2/nsPrintDialogGTK.h => widget/gtk2/nsPrintDialogGTK.h
rename : widget/src/gtk2/nsPrintOptionsGTK.cpp => widget/gtk2/nsPrintOptionsGTK.cpp
rename : widget/src/gtk2/nsPrintOptionsGTK.h => widget/gtk2/nsPrintOptionsGTK.h
rename : widget/src/gtk2/nsPrintSettingsGTK.cpp => widget/gtk2/nsPrintSettingsGTK.cpp
rename : widget/src/gtk2/nsPrintSettingsGTK.h => widget/gtk2/nsPrintSettingsGTK.h
rename : widget/src/gtk2/nsScreenGtk.cpp => widget/gtk2/nsScreenGtk.cpp
rename : widget/src/gtk2/nsScreenGtk.h => widget/gtk2/nsScreenGtk.h
rename : widget/src/gtk2/nsScreenManagerGtk.cpp => widget/gtk2/nsScreenManagerGtk.cpp
rename : widget/src/gtk2/nsScreenManagerGtk.h => widget/gtk2/nsScreenManagerGtk.h
rename : widget/src/gtk2/nsSound.cpp => widget/gtk2/nsSound.cpp
rename : widget/src/gtk2/nsSound.h => widget/gtk2/nsSound.h
rename : widget/src/gtk2/nsToolkit.cpp => widget/gtk2/nsToolkit.cpp
rename : widget/src/gtk2/nsWidgetFactory.cpp => widget/gtk2/nsWidgetFactory.cpp
rename : widget/src/gtk2/nsWindow.cpp => widget/gtk2/nsWindow.cpp
rename : widget/src/gtk2/nsWindow.h => widget/gtk2/nsWindow.h
rename : widget/src/gtkxtbin/Makefile.in => widget/gtkxtbin/Makefile.in
rename : widget/src/gtkxtbin/gtk2xtbin.c => widget/gtkxtbin/gtk2xtbin.c
rename : widget/src/gtkxtbin/gtk2xtbin.h => widget/gtkxtbin/gtk2xtbin.h
rename : widget/src/gtkxtbin/xembed.h => widget/gtkxtbin/xembed.h
rename : widget/public/nsEvent.h => widget/nsEvent.h
rename : widget/public/nsGUIEvent.h => widget/nsGUIEvent.h
rename : widget/public/nsGUIEventIPC.h => widget/nsGUIEventIPC.h
rename : widget/public/nsIAppShell.idl => widget/nsIAppShell.idl
rename : widget/public/nsIBaseWindow.idl => widget/nsIBaseWindow.idl
rename : widget/public/nsIBidiKeyboard.idl => widget/nsIBidiKeyboard.idl
rename : widget/public/nsIClipboard.idl => widget/nsIClipboard.idl
rename : widget/public/nsIClipboardDragDropHookList.idl => widget/nsIClipboardDragDropHookList.idl
rename : widget/public/nsIClipboardDragDropHooks.idl => widget/nsIClipboardDragDropHooks.idl
rename : widget/public/nsIClipboardHelper.idl => widget/nsIClipboardHelper.idl
rename : widget/public/nsIClipboardOwner.idl => widget/nsIClipboardOwner.idl
rename : widget/public/nsIDeviceContextSpec.h => widget/nsIDeviceContextSpec.h
rename : widget/public/nsIDragService.idl => widget/nsIDragService.idl
rename : widget/public/nsIDragSession.idl => widget/nsIDragSession.idl
rename : widget/public/nsIDragSessionGTK.h => widget/nsIDragSessionGTK.h
rename : widget/public/nsIDragSessionOS2.h => widget/nsIDragSessionOS2.h
rename : widget/public/nsIFilePicker.idl => widget/nsIFilePicker.idl
rename : widget/public/nsIFormatConverter.idl => widget/nsIFormatConverter.idl
rename : widget/public/nsIGfxInfo.idl => widget/nsIGfxInfo.idl
rename : widget/public/nsIGfxInfoDebug.idl => widget/nsIGfxInfoDebug.idl
rename : widget/public/nsIIMEPicker.idl => widget/nsIIMEPicker.idl
rename : widget/public/nsIIdleService.idl => widget/nsIIdleService.idl
rename : widget/public/nsIJumpListBuilder.idl => widget/nsIJumpListBuilder.idl
rename : widget/public/nsIJumpListItem.idl => widget/nsIJumpListItem.idl
rename : widget/public/nsIMacDockSupport.idl => widget/nsIMacDockSupport.idl
rename : widget/public/nsINativeKeyBindings.h => widget/nsINativeKeyBindings.h
rename : widget/public/nsINativeMenuService.h => widget/nsINativeMenuService.h
rename : widget/public/nsIPluginWidget.h => widget/nsIPluginWidget.h
rename : widget/public/nsIPrintDialogService.h => widget/nsIPrintDialogService.h
rename : widget/public/nsIPrintOptions.idl => widget/nsIPrintOptions.idl
rename : widget/public/nsIPrintSession.idl => widget/nsIPrintSession.idl
rename : widget/public/nsIPrintSettings.idl => widget/nsIPrintSettings.idl
rename : widget/public/nsIPrintSettingsService.idl => widget/nsIPrintSettingsService.idl
rename : widget/public/nsIPrintSettingsWin.idl => widget/nsIPrintSettingsWin.idl
rename : widget/public/nsIRollupListener.h => widget/nsIRollupListener.h
rename : widget/public/nsIRwsService.idl => widget/nsIRwsService.idl
rename : widget/public/nsIScreen.idl => widget/nsIScreen.idl
rename : widget/public/nsIScreenManager.idl => widget/nsIScreenManager.idl
rename : widget/public/nsISound.idl => widget/nsISound.idl
rename : widget/public/nsIStandaloneNativeMenu.idl => widget/nsIStandaloneNativeMenu.idl
rename : widget/public/nsITaskbarOverlayIconController.idl => widget/nsITaskbarOverlayIconController.idl
rename : widget/public/nsITaskbarPreview.idl => widget/nsITaskbarPreview.idl
rename : widget/public/nsITaskbarPreviewButton.idl => widget/nsITaskbarPreviewButton.idl
rename : widget/public/nsITaskbarPreviewController.idl => widget/nsITaskbarPreviewController.idl
rename : widget/public/nsITaskbarProgress.idl => widget/nsITaskbarProgress.idl
rename : widget/public/nsITaskbarTabPreview.idl => widget/nsITaskbarTabPreview.idl
rename : widget/public/nsITaskbarWindowPreview.idl => widget/nsITaskbarWindowPreview.idl
rename : widget/public/nsITransferable.idl => widget/nsITransferable.idl
rename : widget/public/nsIWidget.h => widget/nsIWidget.h
rename : widget/public/nsIWinTaskbar.idl => widget/nsIWinTaskbar.idl
rename : widget/public/nsNativeWidget.h => widget/nsNativeWidget.h
rename : widget/public/nsWidgetInitData.h => widget/nsWidgetInitData.h
rename : widget/public/nsWidgetsCID.h => widget/nsWidgetsCID.h
rename : widget/src/os2/Makefile.in => widget/os2/Makefile.in
rename : widget/src/os2/MozSounds.cmd => widget/os2/MozSounds.cmd
rename : widget/src/os2/README.firefox => widget/os2/README.firefox
rename : widget/src/os2/README.seamonkey => widget/os2/README.seamonkey
rename : widget/src/os2/README.thunderbird => widget/os2/README.thunderbird
rename : widget/src/os2/nsAppShell.cpp => widget/os2/nsAppShell.cpp
rename : widget/src/os2/nsAppShell.h => widget/os2/nsAppShell.h
rename : widget/src/os2/nsBidiKeyboard.cpp => widget/os2/nsBidiKeyboard.cpp
rename : widget/src/os2/nsBidiKeyboard.h => widget/os2/nsBidiKeyboard.h
rename : widget/src/os2/nsClipboard.cpp => widget/os2/nsClipboard.cpp
rename : widget/src/os2/nsClipboard.h => widget/os2/nsClipboard.h
rename : widget/src/os2/nsDeviceContextSpecOS2.cpp => widget/os2/nsDeviceContextSpecOS2.cpp
rename : widget/src/os2/nsDeviceContextSpecOS2.h => widget/os2/nsDeviceContextSpecOS2.h
rename : widget/src/os2/nsDragService.cpp => widget/os2/nsDragService.cpp
rename : widget/src/os2/nsDragService.h => widget/os2/nsDragService.h
rename : widget/src/os2/nsFilePicker.cpp => widget/os2/nsFilePicker.cpp
rename : widget/src/os2/nsFilePicker.h => widget/os2/nsFilePicker.h
rename : widget/src/os2/nsGfxDefs.h => widget/os2/nsGfxDefs.h
rename : widget/src/os2/nsIdleServiceOS2.cpp => widget/os2/nsIdleServiceOS2.cpp
rename : widget/src/os2/nsIdleServiceOS2.h => widget/os2/nsIdleServiceOS2.h
rename : widget/src/os2/nsLookAndFeel.cpp => widget/os2/nsLookAndFeel.cpp
rename : widget/src/os2/nsLookAndFeel.h => widget/os2/nsLookAndFeel.h
rename : widget/src/os2/nsOS2Uni.cpp => widget/os2/nsOS2Uni.cpp
rename : widget/src/os2/nsOS2Uni.h => widget/os2/nsOS2Uni.h
rename : widget/src/os2/nsPrintOS2.cpp => widget/os2/nsPrintOS2.cpp
rename : widget/src/os2/nsPrintOS2.h => widget/os2/nsPrintOS2.h
rename : widget/src/os2/nsPrintOptionsOS2.cpp => widget/os2/nsPrintOptionsOS2.cpp
rename : widget/src/os2/nsPrintOptionsOS2.h => widget/os2/nsPrintOptionsOS2.h
rename : widget/src/os2/nsPrintdOS2.h => widget/os2/nsPrintdOS2.h
rename : widget/src/os2/nsRwsService.cpp => widget/os2/nsRwsService.cpp
rename : widget/src/os2/nsRwsService.h => widget/os2/nsRwsService.h
rename : widget/src/os2/nsScreenManagerOS2.cpp => widget/os2/nsScreenManagerOS2.cpp
rename : widget/src/os2/nsScreenManagerOS2.h => widget/os2/nsScreenManagerOS2.h
rename : widget/src/os2/nsScreenOS2.cpp => widget/os2/nsScreenOS2.cpp
rename : widget/src/os2/nsScreenOS2.h => widget/os2/nsScreenOS2.h
rename : widget/src/os2/nsSound.cpp => widget/os2/nsSound.cpp
rename : widget/src/os2/nsSound.h => widget/os2/nsSound.h
rename : widget/src/os2/nsWidgetFactory.cpp => widget/os2/nsWidgetFactory.cpp
rename : widget/src/os2/nsWindow.cpp => widget/os2/nsWindow.cpp
rename : widget/src/os2/nsWindow.h => widget/os2/nsWindow.h
rename : widget/src/os2/os2FrameWindow.cpp => widget/os2/os2FrameWindow.cpp
rename : widget/src/os2/os2FrameWindow.h => widget/os2/os2FrameWindow.h
rename : widget/src/os2/res/aliasb.ptr => widget/os2/res/aliasb.ptr
rename : widget/src/os2/res/arrow_wait.ptr => widget/os2/res/arrow_wait.ptr
rename : widget/src/os2/res/cell.ptr => widget/os2/res/cell.ptr
rename : widget/src/os2/res/col_resize.ptr => widget/os2/res/col_resize.ptr
rename : widget/src/os2/res/copy.ptr => widget/os2/res/copy.ptr
rename : widget/src/os2/res/crosshair.ptr => widget/os2/res/crosshair.ptr
rename : widget/src/os2/res/dndtext.ico => widget/os2/res/dndtext.ico
rename : widget/src/os2/res/dndurl.ico => widget/os2/res/dndurl.ico
rename : widget/src/os2/res/grab.ptr => widget/os2/res/grab.ptr
rename : widget/src/os2/res/grabbing.ptr => widget/os2/res/grabbing.ptr
rename : widget/src/os2/res/help.ptr => widget/os2/res/help.ptr
rename : widget/src/os2/res/none.ptr => widget/os2/res/none.ptr
rename : widget/src/os2/res/row_resize.ptr => widget/os2/res/row_resize.ptr
rename : widget/src/os2/res/select.ptr => widget/os2/res/select.ptr
rename : widget/src/os2/res/vertical_text.ptr => widget/os2/res/vertical_text.ptr
rename : widget/src/os2/res/zoom_in.ptr => widget/os2/res/zoom_in.ptr
rename : widget/src/os2/res/zoom_out.ptr => widget/os2/res/zoom_out.ptr
rename : widget/src/os2/rws.h => widget/os2/rws.h
rename : widget/src/os2/rwserr.h => widget/os2/rwserr.h
rename : widget/src/os2/wdgtos2rc.h => widget/os2/wdgtos2rc.h
rename : widget/src/os2/widget.rc => widget/os2/widget.rc
rename : widget/src/qt/Makefile.in => widget/qt/Makefile.in
rename : widget/src/qt/faststartupqt/Makefile.in => widget/qt/faststartupqt/Makefile.in
rename : widget/src/qt/faststartupqt/mozqwidgetfast.cpp => widget/qt/faststartupqt/mozqwidgetfast.cpp
rename : widget/src/qt/faststartupqt/mozqwidgetfast.h => widget/qt/faststartupqt/mozqwidgetfast.h
rename : widget/src/qt/faststartupqt/nsFastStartupQt.cpp => widget/qt/faststartupqt/nsFastStartupQt.cpp
rename : widget/src/qt/faststartupqt/nsFastStartupQt.h => widget/qt/faststartupqt/nsFastStartupQt.h
rename : widget/src/qt/mozSwipeGesture.cpp => widget/qt/mozSwipeGesture.cpp
rename : widget/src/qt/mozSwipeGesture.h => widget/qt/mozSwipeGesture.h
rename : widget/src/qt/moziqwidget.h => widget/qt/moziqwidget.h
rename : widget/src/qt/mozqorientationsensorfilter.cpp => widget/qt/mozqorientationsensorfilter.cpp
rename : widget/src/qt/mozqorientationsensorfilter.h => widget/qt/mozqorientationsensorfilter.h
rename : widget/src/qt/mozqwidget.cpp => widget/qt/mozqwidget.cpp
rename : widget/src/qt/mozqwidget.h => widget/qt/mozqwidget.h
rename : widget/src/qt/nsAppShell.cpp => widget/qt/nsAppShell.cpp
rename : widget/src/qt/nsAppShell.h => widget/qt/nsAppShell.h
rename : widget/src/qt/nsBidiKeyboard.cpp => widget/qt/nsBidiKeyboard.cpp
rename : widget/src/qt/nsBidiKeyboard.h => widget/qt/nsBidiKeyboard.h
rename : widget/src/qt/nsClipboard.cpp => widget/qt/nsClipboard.cpp
rename : widget/src/qt/nsClipboard.h => widget/qt/nsClipboard.h
rename : widget/src/qt/nsCommonWidget.cpp => widget/qt/nsCommonWidget.cpp
rename : widget/src/qt/nsCommonWidget.h => widget/qt/nsCommonWidget.h
rename : widget/src/qt/nsDeviceContextSpecQt.cpp => widget/qt/nsDeviceContextSpecQt.cpp
rename : widget/src/qt/nsDeviceContextSpecQt.h => widget/qt/nsDeviceContextSpecQt.h
rename : widget/src/qt/nsDragService.cpp => widget/qt/nsDragService.cpp
rename : widget/src/qt/nsDragService.h => widget/qt/nsDragService.h
rename : widget/src/qt/nsFilePicker.cpp => widget/qt/nsFilePicker.cpp
rename : widget/src/qt/nsFilePicker.h => widget/qt/nsFilePicker.h
rename : widget/src/qt/nsIdleServiceQt.cpp => widget/qt/nsIdleServiceQt.cpp
rename : widget/src/qt/nsIdleServiceQt.h => widget/qt/nsIdleServiceQt.h
rename : widget/src/qt/nsLookAndFeel.cpp => widget/qt/nsLookAndFeel.cpp
rename : widget/src/qt/nsLookAndFeel.h => widget/qt/nsLookAndFeel.h
rename : widget/src/qt/nsMFilePicker.cpp => widget/qt/nsMFilePicker.cpp
rename : widget/src/qt/nsMFilePicker.h => widget/qt/nsMFilePicker.h
rename : widget/src/qt/nsNativeThemeQt.cpp => widget/qt/nsNativeThemeQt.cpp
rename : widget/src/qt/nsNativeThemeQt.h => widget/qt/nsNativeThemeQt.h
rename : widget/src/qt/nsPrintDialogQt.cpp => widget/qt/nsPrintDialogQt.cpp
rename : widget/src/qt/nsPrintDialogQt.h => widget/qt/nsPrintDialogQt.h
rename : widget/src/qt/nsPrintOptionsQt.cpp => widget/qt/nsPrintOptionsQt.cpp
rename : widget/src/qt/nsPrintOptionsQt.h => widget/qt/nsPrintOptionsQt.h
rename : widget/src/qt/nsPrintSettingsQt.cpp => widget/qt/nsPrintSettingsQt.cpp
rename : widget/src/qt/nsPrintSettingsQt.h => widget/qt/nsPrintSettingsQt.h
rename : widget/src/qt/nsQtKeyUtils.cpp => widget/qt/nsQtKeyUtils.cpp
rename : widget/src/qt/nsQtKeyUtils.h => widget/qt/nsQtKeyUtils.h
rename : widget/src/qt/nsScreenManagerQt.cpp => widget/qt/nsScreenManagerQt.cpp
rename : widget/src/qt/nsScreenManagerQt.h => widget/qt/nsScreenManagerQt.h
rename : widget/src/qt/nsScreenQt.cpp => widget/qt/nsScreenQt.cpp
rename : widget/src/qt/nsScreenQt.h => widget/qt/nsScreenQt.h
rename : widget/src/qt/nsSound.cpp => widget/qt/nsSound.cpp
rename : widget/src/qt/nsSound.h => widget/qt/nsSound.h
rename : widget/src/qt/nsWidgetFactory.cpp => widget/qt/nsWidgetFactory.cpp
rename : widget/src/qt/nsWindow.cpp => widget/qt/nsWindow.cpp
rename : widget/src/qt/nsWindow.h => widget/qt/nsWindow.h
rename : widget/src/shared/Makefile.in => widget/shared/Makefile.in
rename : widget/src/shared/WidgetUtils.cpp => widget/shared/WidgetUtils.cpp
rename : widget/src/shared/WidgetUtils.h => widget/shared/WidgetUtils.h
rename : widget/src/shared/nsShmImage.cpp => widget/shared/nsShmImage.cpp
rename : widget/src/shared/nsShmImage.h => widget/shared/nsShmImage.h
rename : widget/src/shared/x11/Makefile.in => widget/shared/x11/Makefile.in
rename : widget/src/shared/x11/keysym2ucs.c => widget/shared/x11/keysym2ucs.c
rename : widget/src/shared/x11/keysym2ucs.h => widget/shared/x11/keysym2ucs.h
rename : widget/src/windows/AudioSession.cpp => widget/windows/AudioSession.cpp
rename : widget/src/windows/AudioSession.h => widget/windows/AudioSession.h
rename : widget/src/windows/GfxInfo.cpp => widget/windows/GfxInfo.cpp
rename : widget/src/windows/GfxInfo.h => widget/windows/GfxInfo.h
rename : widget/src/windows/IEnumFE.cpp => widget/windows/IEnumFE.cpp
rename : widget/src/windows/IEnumFE.h => widget/windows/IEnumFE.h
rename : widget/src/windows/JumpListBuilder.cpp => widget/windows/JumpListBuilder.cpp
rename : widget/src/windows/JumpListBuilder.h => widget/windows/JumpListBuilder.h
rename : widget/src/windows/JumpListItem.cpp => widget/windows/JumpListItem.cpp
rename : widget/src/windows/JumpListItem.h => widget/windows/JumpListItem.h
rename : widget/src/windows/KeyboardLayout.cpp => widget/windows/KeyboardLayout.cpp
rename : widget/src/windows/KeyboardLayout.h => widget/windows/KeyboardLayout.h
rename : widget/src/windows/LSPAnnotator.cpp => widget/windows/LSPAnnotator.cpp
rename : widget/src/windows/Makefile.in => widget/windows/Makefile.in
rename : widget/src/windows/TaskbarPreview.cpp => widget/windows/TaskbarPreview.cpp
rename : widget/src/windows/TaskbarPreview.h => widget/windows/TaskbarPreview.h
rename : widget/src/windows/TaskbarPreviewButton.cpp => widget/windows/TaskbarPreviewButton.cpp
rename : widget/src/windows/TaskbarPreviewButton.h => widget/windows/TaskbarPreviewButton.h
rename : widget/src/windows/TaskbarTabPreview.cpp => widget/windows/TaskbarTabPreview.cpp
rename : widget/src/windows/TaskbarTabPreview.h => widget/windows/TaskbarTabPreview.h
rename : widget/src/windows/TaskbarWindowPreview.cpp => widget/windows/TaskbarWindowPreview.cpp
rename : widget/src/windows/TaskbarWindowPreview.h => widget/windows/TaskbarWindowPreview.h
rename : widget/src/windows/WidgetTraceEvent.cpp => widget/windows/WidgetTraceEvent.cpp
rename : widget/src/windows/WinTaskbar.cpp => widget/windows/WinTaskbar.cpp
rename : widget/src/windows/WinTaskbar.h => widget/windows/WinTaskbar.h
rename : widget/src/windows/WindowHook.cpp => widget/windows/WindowHook.cpp
rename : widget/src/windows/WindowHook.h => widget/windows/WindowHook.h
rename : widget/src/windows/nsAppShell.cpp => widget/windows/nsAppShell.cpp
rename : widget/src/windows/nsAppShell.h => widget/windows/nsAppShell.h
rename : widget/src/windows/nsBidiKeyboard.cpp => widget/windows/nsBidiKeyboard.cpp
rename : widget/src/windows/nsBidiKeyboard.h => widget/windows/nsBidiKeyboard.h
rename : widget/src/windows/nsClipboard.cpp => widget/windows/nsClipboard.cpp
rename : widget/src/windows/nsClipboard.h => widget/windows/nsClipboard.h
rename : widget/src/windows/nsDataObj.cpp => widget/windows/nsDataObj.cpp
rename : widget/src/windows/nsDataObj.h => widget/windows/nsDataObj.h
rename : widget/src/windows/nsDataObjCollection.cpp => widget/windows/nsDataObjCollection.cpp
rename : widget/src/windows/nsDataObjCollection.h => widget/windows/nsDataObjCollection.h
rename : widget/src/windows/nsDeviceContextSpecWin.cpp => widget/windows/nsDeviceContextSpecWin.cpp
rename : widget/src/windows/nsDeviceContextSpecWin.h => widget/windows/nsDeviceContextSpecWin.h
rename : widget/src/windows/nsDragService.cpp => widget/windows/nsDragService.cpp
rename : widget/src/windows/nsDragService.h => widget/windows/nsDragService.h
rename : widget/src/windows/nsFilePicker.cpp => widget/windows/nsFilePicker.cpp
rename : widget/src/windows/nsFilePicker.h => widget/windows/nsFilePicker.h
rename : widget/src/windows/nsIMM32Handler.cpp => widget/windows/nsIMM32Handler.cpp
rename : widget/src/windows/nsIMM32Handler.h => widget/windows/nsIMM32Handler.h
rename : widget/src/windows/nsIdleServiceWin.cpp => widget/windows/nsIdleServiceWin.cpp
rename : widget/src/windows/nsIdleServiceWin.h => widget/windows/nsIdleServiceWin.h
rename : widget/src/windows/nsImageClipboard.cpp => widget/windows/nsImageClipboard.cpp
rename : widget/src/windows/nsImageClipboard.h => widget/windows/nsImageClipboard.h
rename : widget/src/windows/nsLookAndFeel.cpp => widget/windows/nsLookAndFeel.cpp
rename : widget/src/windows/nsLookAndFeel.h => widget/windows/nsLookAndFeel.h
rename : widget/src/windows/nsNativeDragSource.cpp => widget/windows/nsNativeDragSource.cpp
rename : widget/src/windows/nsNativeDragSource.h => widget/windows/nsNativeDragSource.h
rename : widget/src/windows/nsNativeDragTarget.cpp => widget/windows/nsNativeDragTarget.cpp
rename : widget/src/windows/nsNativeDragTarget.h => widget/windows/nsNativeDragTarget.h
rename : widget/src/windows/nsNativeThemeWin.cpp => widget/windows/nsNativeThemeWin.cpp
rename : widget/src/windows/nsNativeThemeWin.h => widget/windows/nsNativeThemeWin.h
rename : widget/src/windows/nsPrintOptionsWin.cpp => widget/windows/nsPrintOptionsWin.cpp
rename : widget/src/windows/nsPrintOptionsWin.h => widget/windows/nsPrintOptionsWin.h
rename : widget/src/windows/nsPrintSettingsWin.cpp => widget/windows/nsPrintSettingsWin.cpp
rename : widget/src/windows/nsPrintSettingsWin.h => widget/windows/nsPrintSettingsWin.h
rename : widget/src/windows/nsScreenManagerWin.cpp => widget/windows/nsScreenManagerWin.cpp
rename : widget/src/windows/nsScreenManagerWin.h => widget/windows/nsScreenManagerWin.h
rename : widget/src/windows/nsScreenWin.cpp => widget/windows/nsScreenWin.cpp
rename : widget/src/windows/nsScreenWin.h => widget/windows/nsScreenWin.h
rename : widget/src/windows/nsSound.cpp => widget/windows/nsSound.cpp
rename : widget/src/windows/nsSound.h => widget/windows/nsSound.h
rename : widget/src/windows/nsTextStore.cpp => widget/windows/nsTextStore.cpp
rename : widget/src/windows/nsTextStore.h => widget/windows/nsTextStore.h
rename : widget/src/windows/nsToolkit.cpp => widget/windows/nsToolkit.cpp
rename : widget/src/windows/nsToolkit.h => widget/windows/nsToolkit.h
rename : widget/src/windows/nsUXThemeConstants.h => widget/windows/nsUXThemeConstants.h
rename : widget/src/windows/nsUXThemeData.cpp => widget/windows/nsUXThemeData.cpp
rename : widget/src/windows/nsUXThemeData.h => widget/windows/nsUXThemeData.h
rename : widget/src/windows/nsWinGesture.cpp => widget/windows/nsWinGesture.cpp
rename : widget/src/windows/nsWinGesture.h => widget/windows/nsWinGesture.h
rename : widget/src/windows/nsWindow.cpp => widget/windows/nsWindow.cpp
rename : widget/src/windows/nsWindow.h => widget/windows/nsWindow.h
rename : widget/src/windows/nsWindowDbg.cpp => widget/windows/nsWindowDbg.cpp
rename : widget/src/windows/nsWindowDbg.h => widget/windows/nsWindowDbg.h
rename : widget/src/windows/nsWindowDefs.h => widget/windows/nsWindowDefs.h
rename : widget/src/windows/nsWindowGfx.cpp => widget/windows/nsWindowGfx.cpp
rename : widget/src/windows/nsWindowGfx.h => widget/windows/nsWindowGfx.h
rename : widget/src/windows/nsdefs.h => widget/windows/nsdefs.h
rename : widget/src/windows/resource.h => widget/windows/resource.h
rename : widget/src/windows/tests/Makefile.in => widget/windows/tests/Makefile.in
rename : widget/src/windows/tests/TestWinDND.cpp => widget/windows/tests/TestWinDND.cpp
rename : widget/src/xpwidgets/GfxDriverInfo.cpp => widget/xpwidgets/GfxDriverInfo.cpp
rename : widget/src/xpwidgets/GfxDriverInfo.h => widget/xpwidgets/GfxDriverInfo.h
rename : widget/src/xpwidgets/GfxInfoBase.cpp => widget/xpwidgets/GfxInfoBase.cpp
rename : widget/src/xpwidgets/GfxInfoBase.h => widget/xpwidgets/GfxInfoBase.h
rename : widget/src/xpwidgets/GfxInfoCollector.h => widget/xpwidgets/GfxInfoCollector.h
rename : widget/src/xpwidgets/GfxInfoWebGL.cpp => widget/xpwidgets/GfxInfoWebGL.cpp
rename : widget/src/xpwidgets/GfxInfoWebGL.h => widget/xpwidgets/GfxInfoWebGL.h
rename : widget/src/xpwidgets/GfxInfoX11.cpp => widget/xpwidgets/GfxInfoX11.cpp
rename : widget/src/xpwidgets/GfxInfoX11.h => widget/xpwidgets/GfxInfoX11.h
rename : widget/src/xpwidgets/Makefile.in => widget/xpwidgets/Makefile.in
rename : widget/src/xpwidgets/PuppetWidget.cpp => widget/xpwidgets/PuppetWidget.cpp
rename : widget/src/xpwidgets/PuppetWidget.h => widget/xpwidgets/PuppetWidget.h
rename : widget/src/xpwidgets/nsAppShellSingleton.h => widget/xpwidgets/nsAppShellSingleton.h
rename : widget/src/xpwidgets/nsBaseAppShell.cpp => widget/xpwidgets/nsBaseAppShell.cpp
rename : widget/src/xpwidgets/nsBaseAppShell.h => widget/xpwidgets/nsBaseAppShell.h
rename : widget/src/xpwidgets/nsBaseClipboard.cpp => widget/xpwidgets/nsBaseClipboard.cpp
rename : widget/src/xpwidgets/nsBaseClipboard.h => widget/xpwidgets/nsBaseClipboard.h
rename : widget/src/xpwidgets/nsBaseDragService.cpp => widget/xpwidgets/nsBaseDragService.cpp
rename : widget/src/xpwidgets/nsBaseDragService.h => widget/xpwidgets/nsBaseDragService.h
rename : widget/src/xpwidgets/nsBaseFilePicker.cpp => widget/xpwidgets/nsBaseFilePicker.cpp
rename : widget/src/xpwidgets/nsBaseFilePicker.h => widget/xpwidgets/nsBaseFilePicker.h
rename : widget/src/xpwidgets/nsBaseWidget.cpp => widget/xpwidgets/nsBaseWidget.cpp
rename : widget/src/xpwidgets/nsBaseWidget.h => widget/xpwidgets/nsBaseWidget.h
rename : widget/src/xpwidgets/nsClipboardHelper.cpp => widget/xpwidgets/nsClipboardHelper.cpp
rename : widget/src/xpwidgets/nsClipboardHelper.h => widget/xpwidgets/nsClipboardHelper.h
rename : widget/src/xpwidgets/nsClipboardPrivacyHandler.cpp => widget/xpwidgets/nsClipboardPrivacyHandler.cpp
rename : widget/src/xpwidgets/nsClipboardPrivacyHandler.h => widget/xpwidgets/nsClipboardPrivacyHandler.h
rename : widget/src/xpwidgets/nsFilePickerProxy.cpp => widget/xpwidgets/nsFilePickerProxy.cpp
rename : widget/src/xpwidgets/nsFilePickerProxy.h => widget/xpwidgets/nsFilePickerProxy.h
rename : widget/src/xpwidgets/nsHTMLFormatConverter.cpp => widget/xpwidgets/nsHTMLFormatConverter.cpp
rename : widget/src/xpwidgets/nsHTMLFormatConverter.h => widget/xpwidgets/nsHTMLFormatConverter.h
rename : widget/src/xpwidgets/nsIdleService.cpp => widget/xpwidgets/nsIdleService.cpp
rename : widget/src/xpwidgets/nsIdleService.h => widget/xpwidgets/nsIdleService.h
rename : widget/src/xpwidgets/nsNativeTheme.cpp => widget/xpwidgets/nsNativeTheme.cpp
rename : widget/src/xpwidgets/nsNativeTheme.h => widget/xpwidgets/nsNativeTheme.h
rename : widget/src/xpwidgets/nsPrimitiveHelpers.cpp => widget/xpwidgets/nsPrimitiveHelpers.cpp
rename : widget/src/xpwidgets/nsPrimitiveHelpers.h => widget/xpwidgets/nsPrimitiveHelpers.h
rename : widget/src/xpwidgets/nsPrintOptionsImpl.cpp => widget/xpwidgets/nsPrintOptionsImpl.cpp
rename : widget/src/xpwidgets/nsPrintOptionsImpl.h => widget/xpwidgets/nsPrintOptionsImpl.h
rename : widget/src/xpwidgets/nsPrintSession.cpp => widget/xpwidgets/nsPrintSession.cpp
rename : widget/src/xpwidgets/nsPrintSession.h => widget/xpwidgets/nsPrintSession.h
rename : widget/src/xpwidgets/nsPrintSettingsImpl.cpp => widget/xpwidgets/nsPrintSettingsImpl.cpp
rename : widget/src/xpwidgets/nsPrintSettingsImpl.h => widget/xpwidgets/nsPrintSettingsImpl.h
rename : widget/src/xpwidgets/nsTransferable.cpp => widget/xpwidgets/nsTransferable.cpp
rename : widget/src/xpwidgets/nsTransferable.h => widget/xpwidgets/nsTransferable.h
rename : widget/src/xpwidgets/nsXPLookAndFeel.cpp => widget/xpwidgets/nsXPLookAndFeel.cpp
rename : widget/src/xpwidgets/nsXPLookAndFeel.h => widget/xpwidgets/nsXPLookAndFeel.h
rename : widget/src/xremoteclient/Makefile.in => widget/xremoteclient/Makefile.in
rename : widget/src/xremoteclient/XRemoteClient.cpp => widget/xremoteclient/XRemoteClient.cpp
rename : widget/src/xremoteclient/XRemoteClient.h => widget/xremoteclient/XRemoteClient.h
rename : widget/src/xremoteclient/XRemoteClientFactory.cpp => widget/xremoteclient/XRemoteClientFactory.cpp
rename : widget/src/xremoteclient/mozilla-xremote-client.cpp => widget/xremoteclient/mozilla-xremote-client.cpp
rename : widget/src/xremoteclient/nsRemoteClient.h => widget/xremoteclient/nsRemoteClient.h
2012-01-03 22:09:29 -05:00

2142 lines
66 KiB
C++

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Sean Echevarria <Sean@Beatnik.com>
* Blake Ross <blaker@netscape.com>
* Brodie Thiesfield <brofield@jellycan.com>
* Masayuki Nakano <masayuki@d-toybox.com>
* David Gardiner <david.gardiner@unisa.edu.au>
* Kyle Huey <me@kylehuey.com>
* Jim Mathies <jmathies@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "mozilla/Util.h"
#include <ole2.h>
#include <shlobj.h>
#include "nsDataObj.h"
#include "nsClipboard.h"
#include "nsReadableUtils.h"
#include "nsITransferable.h"
#include "nsISupportsPrimitives.h"
#include "IEnumFE.h"
#include "nsPrimitiveHelpers.h"
#include "nsXPIDLString.h"
#include "nsImageClipboard.h"
#include "nsCRT.h"
#include "nsPrintfCString.h"
#include "nsIStringBundle.h"
#include "nsEscape.h"
#include "nsIURL.h"
#include "nsNetUtil.h"
#include "nsXPCOMStrings.h"
#include "nscore.h"
#include "prtypes.h"
#include "nsDirectoryServiceDefs.h"
#include "nsITimer.h"
#include "nsThreadUtils.h"
// XXX Duped from profile/src/nsProfile.cpp.
#include <stdlib.h>
using namespace mozilla;
#define TABLE_SIZE 36
static const char table[] =
{ 'a','b','c','d','e','f','g','h','i','j',
'k','l','m','n','o','p','q','r','s','t',
'u','v','w','x','y','z','0','1','2','3',
'4','5','6','7','8','9' };
static void
MakeRandomString(char *buf, PRInt32 bufLen)
{
// turn PR_Now() into milliseconds since epoch
// and salt rand with that.
double fpTime;
LL_L2D(fpTime, PR_Now());
srand((uint)(fpTime * 1e-6 + 0.5)); // use 1e-6, granularity of PR_Now() on the mac is seconds
PRInt32 i;
for (i=0;i<bufLen;i++) {
*buf++ = table[rand()%TABLE_SIZE];
}
*buf = 0;
}
NS_IMPL_ISUPPORTS1(nsDataObj::CStream, nsIStreamListener)
//-----------------------------------------------------------------------------
// CStream implementation
nsDataObj::CStream::CStream() :
mChannelRead(false),
mStreamRead(0)
{
}
//-----------------------------------------------------------------------------
nsDataObj::CStream::~CStream()
{
}
//-----------------------------------------------------------------------------
// helper - initializes the stream
nsresult nsDataObj::CStream::Init(nsIURI *pSourceURI)
{
nsresult rv;
rv = NS_NewChannel(getter_AddRefs(mChannel), pSourceURI,
nsnull, nsnull, nsnull,
nsIRequest::LOAD_FROM_CACHE);
NS_ENSURE_SUCCESS(rv, rv);
rv = mChannel->AsyncOpen(this, nsnull);
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
}
//-----------------------------------------------------------------------------
// IUnknown's QueryInterface, nsISupport's AddRef and Release are shared by
// IUnknown and nsIStreamListener.
STDMETHODIMP nsDataObj::CStream::QueryInterface(REFIID refiid, void** ppvResult)
{
*ppvResult = NULL;
if (IID_IUnknown == refiid ||
refiid == IID_IStream)
{
*ppvResult = this;
}
if (NULL != *ppvResult)
{
((LPUNKNOWN)*ppvResult)->AddRef();
return S_OK;
}
return E_NOINTERFACE;
}
// nsIStreamListener implementation
NS_IMETHODIMP nsDataObj::CStream::OnDataAvailable(nsIRequest *aRequest,
nsISupports *aContext,
nsIInputStream *aInputStream,
PRUint32 aOffset, // offset within the stream
PRUint32 aCount) // bytes available on this call
{
// Extend the write buffer for the incoming data.
PRUint8* buffer = mChannelData.AppendElements(aCount);
if (buffer == NULL)
return NS_ERROR_OUT_OF_MEMORY;
NS_ASSERTION((mChannelData.Length() == (aOffset + aCount)),
"stream length mismatch w/write buffer");
// Read() may not return aCount on a single call, so loop until we've
// accumulated all the data OnDataAvailable has promised.
nsresult rv;
PRUint32 odaBytesReadTotal = 0;
do {
PRUint32 bytesReadByCall = 0;
rv = aInputStream->Read((char*)(buffer + odaBytesReadTotal),
aCount, &bytesReadByCall);
odaBytesReadTotal += bytesReadByCall;
} while (aCount < odaBytesReadTotal && NS_SUCCEEDED(rv));
return rv;
}
NS_IMETHODIMP nsDataObj::CStream::OnStartRequest(nsIRequest *aRequest,
nsISupports *aContext)
{
mChannelResult = NS_OK;
return NS_OK;
}
NS_IMETHODIMP nsDataObj::CStream::OnStopRequest(nsIRequest *aRequest,
nsISupports *aContext,
nsresult aStatusCode)
{
mChannelRead = true;
mChannelResult = aStatusCode;
return NS_OK;
}
// Pumps thread messages while waiting for the async listener operation to
// complete. Failing this call will fail the stream incall from Windows
// and cancel the operation.
nsresult nsDataObj::CStream::WaitForCompletion()
{
// We are guaranteed OnStopRequest will get called, so this should be ok.
while (!mChannelRead) {
// Pump messages
NS_ProcessNextEvent(nsnull, true);
}
if (!mChannelData.Length())
mChannelResult = NS_ERROR_FAILURE;
return mChannelResult;
}
//-----------------------------------------------------------------------------
// IStream
STDMETHODIMP nsDataObj::CStream::Clone(IStream** ppStream)
{
return E_NOTIMPL;
}
//-----------------------------------------------------------------------------
STDMETHODIMP nsDataObj::CStream::Commit(DWORD dwFrags)
{
return E_NOTIMPL;
}
//-----------------------------------------------------------------------------
STDMETHODIMP nsDataObj::CStream::CopyTo(IStream* pDestStream,
ULARGE_INTEGER nBytesToCopy,
ULARGE_INTEGER* nBytesRead,
ULARGE_INTEGER* nBytesWritten)
{
return E_NOTIMPL;
}
//-----------------------------------------------------------------------------
STDMETHODIMP nsDataObj::CStream::LockRegion(ULARGE_INTEGER nStart,
ULARGE_INTEGER nBytes,
DWORD dwFlags)
{
return E_NOTIMPL;
}
//-----------------------------------------------------------------------------
STDMETHODIMP nsDataObj::CStream::Read(void* pvBuffer,
ULONG nBytesToRead,
ULONG* nBytesRead)
{
// Wait for the write into our buffer to complete via the stream listener.
// We can't respond to this by saying "call us back later".
if (NS_FAILED(WaitForCompletion()))
return E_FAIL;
// Bytes left for Windows to read out of our buffer
ULONG bytesLeft = mChannelData.Length() - mStreamRead;
// Let Windows know what we will hand back, usually this is the entire buffer
*nBytesRead = NS_MIN(bytesLeft, nBytesToRead);
// Copy the buffer data over
memcpy(pvBuffer, ((char*)mChannelData.Elements() + mStreamRead), *nBytesRead);
// Update our bytes read tracking
mStreamRead += *nBytesRead;
return S_OK;
}
//-----------------------------------------------------------------------------
STDMETHODIMP nsDataObj::CStream::Revert(void)
{
return E_NOTIMPL;
}
//-----------------------------------------------------------------------------
STDMETHODIMP nsDataObj::CStream::Seek(LARGE_INTEGER nMove,
DWORD dwOrigin,
ULARGE_INTEGER* nNewPos)
{
if (nNewPos == NULL)
return STG_E_INVALIDPOINTER;
if (nMove.LowPart == 0 && nMove.HighPart == 0 &&
(dwOrigin == STREAM_SEEK_SET || dwOrigin == STREAM_SEEK_CUR)) {
nNewPos->LowPart = 0;
nNewPos->HighPart = 0;
return S_OK;
}
return E_NOTIMPL;
}
//-----------------------------------------------------------------------------
STDMETHODIMP nsDataObj::CStream::SetSize(ULARGE_INTEGER nNewSize)
{
return E_NOTIMPL;
}
//-----------------------------------------------------------------------------
STDMETHODIMP nsDataObj::CStream::Stat(STATSTG* statstg, DWORD dwFlags)
{
if (statstg == NULL)
return STG_E_INVALIDPOINTER;
if (!mChannel || NS_FAILED(WaitForCompletion()))
return E_FAIL;
memset((void*)statstg, 0, sizeof(STATSTG));
if (dwFlags != STATFLAG_NONAME)
{
nsCOMPtr<nsIURI> sourceURI;
if (NS_FAILED(mChannel->GetURI(getter_AddRefs(sourceURI)))) {
return E_FAIL;
}
nsCAutoString strFileName;
nsCOMPtr<nsIURL> sourceURL = do_QueryInterface(sourceURI);
sourceURL->GetFileName(strFileName);
if (strFileName.IsEmpty())
return E_FAIL;
NS_UnescapeURL(strFileName);
NS_ConvertUTF8toUTF16 wideFileName(strFileName);
PRUint32 nMaxNameLength = (wideFileName.Length()*2) + 2;
void * retBuf = CoTaskMemAlloc(nMaxNameLength); // freed by caller
if (!retBuf)
return STG_E_INSUFFICIENTMEMORY;
ZeroMemory(retBuf, nMaxNameLength);
memcpy(retBuf, wideFileName.get(), wideFileName.Length()*2);
statstg->pwcsName = (LPOLESTR)retBuf;
}
SYSTEMTIME st;
statstg->type = STGTY_STREAM;
GetSystemTime(&st);
SystemTimeToFileTime((const SYSTEMTIME*)&st, (LPFILETIME)&statstg->mtime);
statstg->ctime = statstg->atime = statstg->mtime;
statstg->cbSize.LowPart = (DWORD)mChannelData.Length();
statstg->grfMode = STGM_READ;
statstg->grfLocksSupported = LOCK_ONLYONCE;
statstg->clsid = CLSID_NULL;
return S_OK;
}
//-----------------------------------------------------------------------------
STDMETHODIMP nsDataObj::CStream::UnlockRegion(ULARGE_INTEGER nStart,
ULARGE_INTEGER nBytes,
DWORD dwFlags)
{
return E_NOTIMPL;
}
//-----------------------------------------------------------------------------
STDMETHODIMP nsDataObj::CStream::Write(const void* pvBuffer,
ULONG nBytesToRead,
ULONG* nBytesRead)
{
return E_NOTIMPL;
}
//-----------------------------------------------------------------------------
HRESULT nsDataObj::CreateStream(IStream **outStream)
{
NS_ENSURE_TRUE(outStream, E_INVALIDARG);
nsresult rv = NS_ERROR_FAILURE;
nsAutoString wideFileName;
nsCOMPtr<nsIURI> sourceURI;
rv = GetDownloadDetails(getter_AddRefs(sourceURI),
wideFileName);
NS_ENSURE_SUCCESS(rv, rv);
nsDataObj::CStream *pStream = new nsDataObj::CStream();
NS_ENSURE_TRUE(pStream, E_OUTOFMEMORY);
pStream->AddRef();
rv = pStream->Init(sourceURI);
if (NS_FAILED(rv))
{
pStream->Release();
return E_FAIL;
}
*outStream = pStream;
return S_OK;
}
static GUID CLSID_nsDataObj =
{ 0x1bba7640, 0xdf52, 0x11cf, { 0x82, 0x7b, 0, 0xa0, 0x24, 0x3a, 0xe5, 0x05 } };
/*
* deliberately not using MAX_PATH. This is because on platforms < XP
* a file created with a long filename may be mishandled by the shell
* resulting in it not being able to be deleted or moved.
* See bug 250392 for more details.
*/
#define NS_MAX_FILEDESCRIPTOR 128 + 1
/*
* Class nsDataObj
*/
//-----------------------------------------------------
// construction
//-----------------------------------------------------
nsDataObj::nsDataObj(nsIURI * uri)
: m_cRef(0), mTransferable(nsnull),
mIsAsyncMode(FALSE), mIsInOperation(FALSE)
{
m_enumFE = new CEnumFormatEtc();
m_enumFE->AddRef();
if (uri) {
// A URI was obtained, so pass this through to the DataObject
// so it can create a SourceURL for CF_HTML flavour
uri->GetSpec(mSourceURL);
}
}
//-----------------------------------------------------
// destruction
//-----------------------------------------------------
nsDataObj::~nsDataObj()
{
NS_IF_RELEASE(mTransferable);
mDataFlavors.Clear();
m_enumFE->Release();
// Free arbitrary system formats
for (PRUint32 idx = 0; idx < mDataEntryList.Length(); idx++) {
CoTaskMemFree(mDataEntryList[idx]->fe.ptd);
ReleaseStgMedium(&mDataEntryList[idx]->stgm);
CoTaskMemFree(mDataEntryList[idx]);
}
}
//-----------------------------------------------------
// IUnknown interface methods - see inknown.h for documentation
//-----------------------------------------------------
STDMETHODIMP nsDataObj::QueryInterface(REFIID riid, void** ppv)
{
*ppv=NULL;
if ( (IID_IUnknown == riid) || (IID_IDataObject == riid) ) {
*ppv = this;
AddRef();
return S_OK;
} else if (IID_IAsyncOperation == riid) {
*ppv = static_cast<IAsyncOperation*>(this);
AddRef();
return S_OK;
}
return E_NOINTERFACE;
}
//-----------------------------------------------------
STDMETHODIMP_(ULONG) nsDataObj::AddRef()
{
++m_cRef;
NS_LOG_ADDREF(this, m_cRef, "nsDataObj", sizeof(*this));
return m_cRef;
}
//-----------------------------------------------------
STDMETHODIMP_(ULONG) nsDataObj::Release()
{
--m_cRef;
NS_LOG_RELEASE(this, m_cRef, "nsDataObj");
if (0 != m_cRef)
return m_cRef;
// We have released our last ref on this object and need to delete the
// temp file. External app acting as drop target may still need to open the
// temp file. Addref a timer so it can delay deleting file and destroying
// this object. Delete file anyway and destroy this obj if there's a problem.
if (mCachedTempFile) {
nsresult rv;
mTimer = do_CreateInstance(NS_TIMER_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv)) {
mTimer->InitWithFuncCallback(nsDataObj::RemoveTempFile, this,
500, nsITimer::TYPE_ONE_SHOT);
return AddRef();
}
mCachedTempFile->Remove(false);
mCachedTempFile = NULL;
}
delete this;
return 0;
}
//-----------------------------------------------------
BOOL nsDataObj::FormatsMatch(const FORMATETC& source, const FORMATETC& target) const
{
if ((source.cfFormat == target.cfFormat) &&
(source.dwAspect & target.dwAspect) &&
(source.tymed & target.tymed)) {
return TRUE;
} else {
return FALSE;
}
}
//-----------------------------------------------------
// IDataObject methods
//-----------------------------------------------------
STDMETHODIMP nsDataObj::GetData(LPFORMATETC aFormat, LPSTGMEDIUM pSTM)
{
if (!mTransferable)
return DV_E_FORMATETC;
PRUint32 dfInx = 0;
static CLIPFORMAT fileDescriptorFlavorA = ::RegisterClipboardFormat( CFSTR_FILEDESCRIPTORA );
static CLIPFORMAT fileDescriptorFlavorW = ::RegisterClipboardFormat( CFSTR_FILEDESCRIPTORW );
static CLIPFORMAT uniformResourceLocatorA = ::RegisterClipboardFormat( CFSTR_INETURLA );
static CLIPFORMAT uniformResourceLocatorW = ::RegisterClipboardFormat( CFSTR_INETURLW );
static CLIPFORMAT fileFlavor = ::RegisterClipboardFormat( CFSTR_FILECONTENTS );
static CLIPFORMAT PreferredDropEffect = ::RegisterClipboardFormat( CFSTR_PREFERREDDROPEFFECT );
// Arbitrary system formats are used for image feedback during drag
// and drop. We are responsible for storing these internally during
// drag operations.
LPDATAENTRY pde;
if (LookupArbitraryFormat(aFormat, &pde, FALSE)) {
return CopyMediumData(pSTM, &pde->stgm, aFormat, FALSE)
? S_OK : E_UNEXPECTED;
}
// Firefox internal formats
ULONG count;
FORMATETC fe;
m_enumFE->Reset();
while (NOERROR == m_enumFE->Next(1, &fe, &count)
&& dfInx < mDataFlavors.Length()) {
nsCString& df = mDataFlavors.ElementAt(dfInx);
if (FormatsMatch(fe, *aFormat)) {
pSTM->pUnkForRelease = NULL; // caller is responsible for deleting this data
CLIPFORMAT format = aFormat->cfFormat;
switch(format) {
// Someone is asking for plain or unicode text
case CF_TEXT:
case CF_UNICODETEXT:
return GetText(df, *aFormat, *pSTM);
// Some 3rd party apps that receive drag and drop files from the browser
// window require support for this.
case CF_HDROP:
return GetFile(*aFormat, *pSTM);
// Someone is asking for an image
case CF_DIB:
return GetDib(df, *aFormat, *pSTM);
default:
if ( format == fileDescriptorFlavorA )
return GetFileDescriptor ( *aFormat, *pSTM, false );
if ( format == fileDescriptorFlavorW )
return GetFileDescriptor ( *aFormat, *pSTM, true);
if ( format == uniformResourceLocatorA )
return GetUniformResourceLocator( *aFormat, *pSTM, false);
if ( format == uniformResourceLocatorW )
return GetUniformResourceLocator( *aFormat, *pSTM, true);
if ( format == fileFlavor )
return GetFileContents ( *aFormat, *pSTM );
if ( format == PreferredDropEffect )
return GetPreferredDropEffect( *aFormat, *pSTM );
//PR_LOG(gWindowsLog, PR_LOG_ALWAYS,
// ("***** nsDataObj::GetData - Unknown format %u\n", format));
return GetText(df, *aFormat, *pSTM);
} //switch
} // if
dfInx++;
} // while
return DATA_E_FORMATETC;
}
//-----------------------------------------------------
STDMETHODIMP nsDataObj::GetDataHere(LPFORMATETC pFE, LPSTGMEDIUM pSTM)
{
return E_FAIL;
}
//-----------------------------------------------------
// Other objects querying to see if we support a
// particular format
//-----------------------------------------------------
STDMETHODIMP nsDataObj::QueryGetData(LPFORMATETC pFE)
{
// Arbitrary system formats are used for image feedback during drag
// and drop. We are responsible for storing these internally during
// drag operations.
LPDATAENTRY pde;
if (LookupArbitraryFormat(pFE, &pde, FALSE))
return S_OK;
// Firefox internal formats
ULONG count;
FORMATETC fe;
m_enumFE->Reset();
while (NOERROR == m_enumFE->Next(1, &fe, &count)) {
if (fe.cfFormat == pFE->cfFormat) {
return S_OK;
}
}
return E_FAIL;
}
//-----------------------------------------------------
STDMETHODIMP nsDataObj::GetCanonicalFormatEtc
(LPFORMATETC pFEIn, LPFORMATETC pFEOut)
{
return E_FAIL;
}
//-----------------------------------------------------
STDMETHODIMP nsDataObj::SetData(LPFORMATETC aFormat, LPSTGMEDIUM aMedium, BOOL shouldRel)
{
// Arbitrary system formats are used for image feedback during drag
// and drop. We are responsible for storing these internally during
// drag operations.
LPDATAENTRY pde;
if (LookupArbitraryFormat(aFormat, &pde, TRUE)) {
// Release the old data the lookup handed us for this format. This
// may have been set in CopyMediumData when we originally stored the
// data.
if (pde->stgm.tymed) {
ReleaseStgMedium(&pde->stgm);
memset(&pde->stgm, 0, sizeof(STGMEDIUM));
}
bool result = true;
if (shouldRel) {
// If shouldRel is TRUE, the data object called owns the storage medium
// after the call returns. Store the incoming data in our data array for
// release when we are destroyed. This is the common case with arbitrary
// data from explorer.
pde->stgm = *aMedium;
} else {
// Copy the incoming data into our data array. (AFAICT, this never gets
// called with arbitrary formats for drag images.)
result = CopyMediumData(&pde->stgm, aMedium, aFormat, TRUE);
}
pde->fe.tymed = pde->stgm.tymed;
return result ? S_OK : DV_E_TYMED;
}
if (shouldRel)
ReleaseStgMedium(aMedium);
return S_OK;
}
bool
nsDataObj::LookupArbitraryFormat(FORMATETC *aFormat, LPDATAENTRY *aDataEntry, BOOL aAddorUpdate)
{
*aDataEntry = NULL;
if (aFormat->ptd != NULL)
return false;
// See if it's already in our list. If so return the data entry.
for (PRUint32 idx = 0; idx < mDataEntryList.Length(); idx++) {
if (mDataEntryList[idx]->fe.cfFormat == aFormat->cfFormat &&
mDataEntryList[idx]->fe.dwAspect == aFormat->dwAspect &&
mDataEntryList[idx]->fe.lindex == aFormat->lindex) {
if (aAddorUpdate || (mDataEntryList[idx]->fe.tymed & aFormat->tymed)) {
// If the caller requests we update, or if the
// medium type matches, return the entry.
*aDataEntry = mDataEntryList[idx];
return true;
} else {
// Medium does not match, not found.
return false;
}
}
}
if (!aAddorUpdate)
return false;
// Add another entry to mDataEntryList
LPDATAENTRY dataEntry = (LPDATAENTRY)CoTaskMemAlloc(sizeof(DATAENTRY));
if (!dataEntry)
return false;
dataEntry->fe = *aFormat;
*aDataEntry = dataEntry;
memset(&dataEntry->stgm, 0, sizeof(STGMEDIUM));
// Add this to our IEnumFORMATETC impl. so we can return it when
// it's requested.
m_enumFE->AddFormatEtc(aFormat);
// Store a copy internally in the arbitrary formats array.
mDataEntryList.AppendElement(dataEntry);
return true;
}
bool
nsDataObj::CopyMediumData(STGMEDIUM *aMediumDst, STGMEDIUM *aMediumSrc, LPFORMATETC aFormat, BOOL aSetData)
{
STGMEDIUM stgmOut = *aMediumSrc;
switch (stgmOut.tymed) {
case TYMED_ISTREAM:
stgmOut.pstm->AddRef();
break;
case TYMED_ISTORAGE:
stgmOut.pstg->AddRef();
break;
case TYMED_HGLOBAL:
if (!aMediumSrc->pUnkForRelease) {
if (aSetData) {
if (aMediumSrc->tymed != TYMED_HGLOBAL)
return false;
stgmOut.hGlobal = OleDuplicateData(aMediumSrc->hGlobal, aFormat->cfFormat, 0);
if (!stgmOut.hGlobal)
return false;
} else {
// We are returning this data from LookupArbitraryFormat, indicate to the
// shell we hold it and will free it.
stgmOut.pUnkForRelease = static_cast<IDataObject*>(this);
}
}
break;
default:
return false;
}
if (stgmOut.pUnkForRelease)
stgmOut.pUnkForRelease->AddRef();
*aMediumDst = stgmOut;
return true;
}
//-----------------------------------------------------
STDMETHODIMP nsDataObj::EnumFormatEtc(DWORD dwDir, LPENUMFORMATETC *ppEnum)
{
switch (dwDir) {
case DATADIR_GET:
m_enumFE->Clone(ppEnum);
break;
case DATADIR_SET:
// fall through
default:
*ppEnum = NULL;
} // switch
if (NULL == *ppEnum)
return E_FAIL;
(*ppEnum)->Reset();
// Clone already AddRefed the result so don't addref it again.
return NOERROR;
}
//-----------------------------------------------------
STDMETHODIMP nsDataObj::DAdvise(LPFORMATETC pFE, DWORD dwFlags,
LPADVISESINK pIAdviseSink, DWORD* pdwConn)
{
return E_FAIL;
}
//-----------------------------------------------------
STDMETHODIMP nsDataObj::DUnadvise(DWORD dwConn)
{
return E_FAIL;
}
//-----------------------------------------------------
STDMETHODIMP nsDataObj::EnumDAdvise(LPENUMSTATDATA *ppEnum)
{
return E_FAIL;
}
// IAsyncOperation methods
STDMETHODIMP nsDataObj::EndOperation(HRESULT hResult,
IBindCtx *pbcReserved,
DWORD dwEffects)
{
mIsInOperation = FALSE;
return S_OK;
}
STDMETHODIMP nsDataObj::GetAsyncMode(BOOL *pfIsOpAsync)
{
*pfIsOpAsync = mIsAsyncMode;
return S_OK;
}
STDMETHODIMP nsDataObj::InOperation(BOOL *pfInAsyncOp)
{
*pfInAsyncOp = mIsInOperation;
return S_OK;
}
STDMETHODIMP nsDataObj::SetAsyncMode(BOOL fDoOpAsync)
{
mIsAsyncMode = fDoOpAsync;
return S_OK;
}
STDMETHODIMP nsDataObj::StartOperation(IBindCtx *pbcReserved)
{
mIsInOperation = TRUE;
return S_OK;
}
//-----------------------------------------------------
// GetData and SetData helper functions
//-----------------------------------------------------
HRESULT nsDataObj::AddSetFormat(FORMATETC& aFE)
{
return S_OK;
}
//-----------------------------------------------------
HRESULT nsDataObj::AddGetFormat(FORMATETC& aFE)
{
return S_OK;
}
//
// GetDIB
//
// Someone is asking for a bitmap. The data in the transferable will be a straight
// imgIContainer, so just QI it.
//
HRESULT
nsDataObj :: GetDib ( const nsACString& inFlavor, FORMATETC &, STGMEDIUM & aSTG )
{
ULONG result = E_FAIL;
PRUint32 len = 0;
nsCOMPtr<nsISupports> genericDataWrapper;
mTransferable->GetTransferData(PromiseFlatCString(inFlavor).get(), getter_AddRefs(genericDataWrapper), &len);
nsCOMPtr<imgIContainer> image ( do_QueryInterface(genericDataWrapper) );
if ( !image ) {
// Check if the image was put in an nsISupportsInterfacePointer wrapper.
// This might not be necessary any more, but could be useful for backwards
// compatibility.
nsCOMPtr<nsISupportsInterfacePointer> ptr(do_QueryInterface(genericDataWrapper));
if ( ptr )
ptr->GetData(getter_AddRefs(image));
}
if ( image ) {
// use the |nsImageToClipboard| helper class to build up a bitmap. We now own
// the bits, and pass them back to the OS in |aSTG|.
nsImageToClipboard converter ( image );
HANDLE bits = nsnull;
nsresult rv = converter.GetPicture ( &bits );
if ( NS_SUCCEEDED(rv) && bits ) {
aSTG.hGlobal = bits;
aSTG.tymed = TYMED_HGLOBAL;
result = S_OK;
}
} // if we have an image
else
NS_WARNING ( "Definitely not an image on clipboard" );
return result;
}
//
// GetFileDescriptor
//
HRESULT
nsDataObj :: GetFileDescriptor ( FORMATETC& aFE, STGMEDIUM& aSTG, bool aIsUnicode )
{
HRESULT res = S_OK;
// How we handle this depends on if we're dealing with an internet
// shortcut, since those are done under the covers.
if (IsFlavourPresent(kFilePromiseMime) ||
IsFlavourPresent(kFileMime))
{
if (aIsUnicode)
return GetFileDescriptor_IStreamW(aFE, aSTG);
else
return GetFileDescriptor_IStreamA(aFE, aSTG);
}
else if (IsFlavourPresent(kURLMime))
{
if ( aIsUnicode )
res = GetFileDescriptorInternetShortcutW ( aFE, aSTG );
else
res = GetFileDescriptorInternetShortcutA ( aFE, aSTG );
}
else
NS_WARNING ( "Not yet implemented\n" );
return res;
} // GetFileDescriptor
//
HRESULT
nsDataObj :: GetFileContents ( FORMATETC& aFE, STGMEDIUM& aSTG )
{
HRESULT res = S_OK;
// How we handle this depends on if we're dealing with an internet
// shortcut, since those are done under the covers.
if (IsFlavourPresent(kFilePromiseMime) ||
IsFlavourPresent(kFileMime))
return GetFileContents_IStream(aFE, aSTG);
else if (IsFlavourPresent(kURLMime))
return GetFileContentsInternetShortcut ( aFE, aSTG );
else
NS_WARNING ( "Not yet implemented\n" );
return res;
} // GetFileContents
//
// Given a unicode string, we ensure that it contains only characters which are valid within
// the file system. Remove all forbidden characters from the name, and completely disallow
// any title that starts with a forbidden name and extension (e.g. "nul" is invalid, but
// "nul." and "nul.txt" are also invalid and will cause problems).
//
// It would seem that this is more functionality suited to being in nsILocalFile.
//
static void
MangleTextToValidFilename(nsString & aText)
{
static const char* forbiddenNames[] = {
"COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9",
"LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9",
"CON", "PRN", "AUX", "NUL", "CLOCK$"
};
aText.StripChars(FILE_PATH_SEPARATOR FILE_ILLEGAL_CHARACTERS);
aText.CompressWhitespace(true, true);
PRUint32 nameLen;
for (size_t n = 0; n < ArrayLength(forbiddenNames); ++n) {
nameLen = (PRUint32) strlen(forbiddenNames[n]);
if (aText.EqualsIgnoreCase(forbiddenNames[n], nameLen)) {
// invalid name is either the entire string, or a prefix with a period
if (aText.Length() == nameLen || aText.CharAt(nameLen) == PRUnichar('.')) {
aText.Truncate();
break;
}
}
}
}
//
// Given a unicode string, convert it down to a valid local charset filename
// with the supplied extension. This ensures that we do not cut MBCS characters
// in the middle.
//
// It would seem that this is more functionality suited to being in nsILocalFile.
//
static bool
CreateFilenameFromTextA(nsString & aText, const char * aExtension,
char * aFilename, PRUint32 aFilenameLen)
{
// ensure that the supplied name doesn't have invalid characters. If
// a valid mangled filename couldn't be created then it will leave the
// text empty.
MangleTextToValidFilename(aText);
if (aText.IsEmpty())
return false;
// repeatably call WideCharToMultiByte as long as the title doesn't fit in the buffer
// available to us. Continually reduce the length of the source title until the MBCS
// version will fit in the buffer with room for the supplied extension. Doing it this
// way ensures that even in MBCS environments there will be a valid MBCS filename of
// the correct length.
int maxUsableFilenameLen = aFilenameLen - strlen(aExtension) - 1; // space for ext + null byte
int currLen, textLen = (int) NS_MIN(aText.Length(), aFilenameLen);
char defaultChar = '_';
do {
currLen = WideCharToMultiByte(CP_ACP,
WC_COMPOSITECHECK|WC_DEFAULTCHAR,
aText.get(), textLen--, aFilename, maxUsableFilenameLen, &defaultChar, NULL);
}
while (currLen == 0 && textLen > 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER);
if (currLen > 0 && textLen > 0) {
strcpy(&aFilename[currLen], aExtension);
return true;
}
else {
// empty names aren't permitted
return false;
}
}
static bool
CreateFilenameFromTextW(nsString & aText, const wchar_t * aExtension,
wchar_t * aFilename, PRUint32 aFilenameLen)
{
// ensure that the supplied name doesn't have invalid characters. If
// a valid mangled filename couldn't be created then it will leave the
// text empty.
MangleTextToValidFilename(aText);
if (aText.IsEmpty())
return false;
const int extensionLen = wcslen(aExtension);
if (aText.Length() + extensionLen + 1 > aFilenameLen)
aText.Truncate(aFilenameLen - extensionLen - 1);
wcscpy(&aFilename[0], aText.get());
wcscpy(&aFilename[aText.Length()], aExtension);
return true;
}
#define PAGEINFO_PROPERTIES "chrome://navigator/locale/pageInfo.properties"
static bool
GetLocalizedString(const PRUnichar * aName, nsXPIDLString & aString)
{
nsCOMPtr<nsIStringBundleService> stringService =
mozilla::services::GetStringBundleService();
if (!stringService)
return false;
nsCOMPtr<nsIStringBundle> stringBundle;
nsresult rv = stringService->CreateBundle(PAGEINFO_PROPERTIES,
getter_AddRefs(stringBundle));
if (NS_FAILED(rv))
return false;
rv = stringBundle->GetStringFromName(aName, getter_Copies(aString));
return NS_SUCCEEDED(rv);
}
//
// GetFileDescriptorInternetShortcut
//
// Create the special format for an internet shortcut and build up the data
// structures the shell is expecting.
//
HRESULT
nsDataObj :: GetFileDescriptorInternetShortcutA ( FORMATETC& aFE, STGMEDIUM& aSTG )
{
// get the title of the shortcut
nsAutoString title;
if ( NS_FAILED(ExtractShortcutTitle(title)) )
return E_OUTOFMEMORY;
HGLOBAL fileGroupDescHandle = ::GlobalAlloc(GMEM_ZEROINIT|GMEM_SHARE,sizeof(FILEGROUPDESCRIPTORA));
if (!fileGroupDescHandle)
return E_OUTOFMEMORY;
LPFILEGROUPDESCRIPTORA fileGroupDescA = reinterpret_cast<LPFILEGROUPDESCRIPTORA>(::GlobalLock(fileGroupDescHandle));
if (!fileGroupDescA) {
::GlobalFree(fileGroupDescHandle);
return E_OUTOFMEMORY;
}
// get a valid filename in the following order: 1) from the page title,
// 2) localized string for an untitled page, 3) just use "Untitled.URL"
if (!CreateFilenameFromTextA(title, ".URL",
fileGroupDescA->fgd[0].cFileName, NS_MAX_FILEDESCRIPTOR)) {
nsXPIDLString untitled;
if (!GetLocalizedString(NS_LITERAL_STRING("noPageTitle").get(), untitled) ||
!CreateFilenameFromTextA(untitled, ".URL",
fileGroupDescA->fgd[0].cFileName, NS_MAX_FILEDESCRIPTOR)) {
strcpy(fileGroupDescA->fgd[0].cFileName, "Untitled.URL");
}
}
// one file in the file block
fileGroupDescA->cItems = 1;
fileGroupDescA->fgd[0].dwFlags = FD_LINKUI;
::GlobalUnlock( fileGroupDescHandle );
aSTG.hGlobal = fileGroupDescHandle;
aSTG.tymed = TYMED_HGLOBAL;
return S_OK;
} // GetFileDescriptorInternetShortcutA
HRESULT
nsDataObj :: GetFileDescriptorInternetShortcutW ( FORMATETC& aFE, STGMEDIUM& aSTG )
{
// get the title of the shortcut
nsAutoString title;
if ( NS_FAILED(ExtractShortcutTitle(title)) )
return E_OUTOFMEMORY;
HGLOBAL fileGroupDescHandle = ::GlobalAlloc(GMEM_ZEROINIT|GMEM_SHARE,sizeof(FILEGROUPDESCRIPTORW));
if (!fileGroupDescHandle)
return E_OUTOFMEMORY;
LPFILEGROUPDESCRIPTORW fileGroupDescW = reinterpret_cast<LPFILEGROUPDESCRIPTORW>(::GlobalLock(fileGroupDescHandle));
if (!fileGroupDescW) {
::GlobalFree(fileGroupDescHandle);
return E_OUTOFMEMORY;
}
// get a valid filename in the following order: 1) from the page title,
// 2) localized string for an untitled page, 3) just use "Untitled.URL"
if (!CreateFilenameFromTextW(title, NS_LITERAL_STRING(".URL").get(),
fileGroupDescW->fgd[0].cFileName, NS_MAX_FILEDESCRIPTOR)) {
nsXPIDLString untitled;
if (!GetLocalizedString(NS_LITERAL_STRING("noPageTitle").get(), untitled) ||
!CreateFilenameFromTextW(untitled, NS_LITERAL_STRING(".URL").get(),
fileGroupDescW->fgd[0].cFileName, NS_MAX_FILEDESCRIPTOR)) {
wcscpy(fileGroupDescW->fgd[0].cFileName, NS_LITERAL_STRING("Untitled.URL").get());
}
}
// one file in the file block
fileGroupDescW->cItems = 1;
fileGroupDescW->fgd[0].dwFlags = FD_LINKUI;
::GlobalUnlock( fileGroupDescHandle );
aSTG.hGlobal = fileGroupDescHandle;
aSTG.tymed = TYMED_HGLOBAL;
return S_OK;
} // GetFileDescriptorInternetShortcutW
//
// GetFileContentsInternetShortcut
//
// Create the special format for an internet shortcut and build up the data
// structures the shell is expecting.
//
HRESULT
nsDataObj :: GetFileContentsInternetShortcut ( FORMATETC& aFE, STGMEDIUM& aSTG )
{
nsAutoString url;
if ( NS_FAILED(ExtractShortcutURL(url)) )
return E_OUTOFMEMORY;
// will need to change if we ever support iDNS
nsCAutoString asciiUrl;
LossyCopyUTF16toASCII(url, asciiUrl);
static const char* shortcutFormatStr = "[InternetShortcut]\r\nURL=%s\r\n";
static const int formatLen = strlen(shortcutFormatStr) - 2; // don't include %s in the len
const int totalLen = formatLen + asciiUrl.Length(); // we don't want a null character on the end
// create a global memory area and build up the file contents w/in it
HGLOBAL hGlobalMemory = ::GlobalAlloc(GMEM_SHARE, totalLen);
if ( !hGlobalMemory )
return E_OUTOFMEMORY;
char* contents = reinterpret_cast<char*>(::GlobalLock(hGlobalMemory));
if ( !contents ) {
::GlobalFree( hGlobalMemory );
return E_OUTOFMEMORY;
}
//NOTE: we intentionally use the Microsoft version of snprintf here because it does NOT null
// terminate strings which reach the maximum size of the buffer. Since we know that the
// formatted length here is totalLen, this call to _snprintf will format the string into
// the buffer without appending the null character.
_snprintf( contents, totalLen, shortcutFormatStr, asciiUrl.get() );
::GlobalUnlock(hGlobalMemory);
aSTG.hGlobal = hGlobalMemory;
aSTG.tymed = TYMED_HGLOBAL;
return S_OK;
} // GetFileContentsInternetShortcut
// check if specified flavour is present in the transferable
bool nsDataObj :: IsFlavourPresent(const char *inFlavour)
{
bool retval = false;
NS_ENSURE_TRUE(mTransferable, false);
// get the list of flavors available in the transferable
nsCOMPtr<nsISupportsArray> flavorList;
mTransferable->FlavorsTransferableCanExport(getter_AddRefs(flavorList));
NS_ENSURE_TRUE(flavorList, false);
// try to find requested flavour
PRUint32 cnt;
flavorList->Count(&cnt);
for (PRUint32 i = 0; i < cnt; ++i) {
nsCOMPtr<nsISupports> genericFlavor;
flavorList->GetElementAt (i, getter_AddRefs(genericFlavor));
nsCOMPtr<nsISupportsCString> currentFlavor (do_QueryInterface(genericFlavor));
if (currentFlavor) {
nsCAutoString flavorStr;
currentFlavor->GetData(flavorStr);
if (flavorStr.Equals(inFlavour)) {
retval = true; // found it!
break;
}
}
} // for each flavor
return retval;
}
HRESULT nsDataObj::GetPreferredDropEffect ( FORMATETC& aFE, STGMEDIUM& aSTG )
{
HRESULT res = S_OK;
aSTG.tymed = TYMED_HGLOBAL;
aSTG.pUnkForRelease = NULL;
HGLOBAL hGlobalMemory = NULL;
hGlobalMemory = ::GlobalAlloc(GMEM_MOVEABLE, sizeof(DWORD));
if (hGlobalMemory) {
DWORD* pdw = (DWORD*) GlobalLock(hGlobalMemory);
// The PreferredDropEffect clipboard format is only registered if a drag/drop
// of an image happens from Mozilla to the desktop. We want its value
// to be DROPEFFECT_MOVE in that case so that the file is moved from the
// temporary location, not copied.
// This value should, ideally, be set on the data object via SetData() but
// our IDataObject implementation doesn't implement SetData. It adds data
// to the data object lazily only when the drop target asks for it.
*pdw = (DWORD) DROPEFFECT_MOVE;
GlobalUnlock(hGlobalMemory);
}
else {
res = E_OUTOFMEMORY;
}
aSTG.hGlobal = hGlobalMemory;
return res;
}
//-----------------------------------------------------
HRESULT nsDataObj::GetText(const nsACString & aDataFlavor, FORMATETC& aFE, STGMEDIUM& aSTG)
{
void* data = NULL;
PRUint32 len;
// if someone asks for text/plain, look up text/unicode instead in the transferable.
const char* flavorStr;
const nsPromiseFlatCString& flat = PromiseFlatCString(aDataFlavor);
if ( aDataFlavor.Equals("text/plain") )
flavorStr = kUnicodeMime;
else
flavorStr = flat.get();
// NOTE: CreateDataFromPrimitive creates new memory, that needs to be deleted
nsCOMPtr<nsISupports> genericDataWrapper;
mTransferable->GetTransferData(flavorStr, getter_AddRefs(genericDataWrapper), &len);
if ( !len )
return E_FAIL;
nsPrimitiveHelpers::CreateDataFromPrimitive ( flavorStr, genericDataWrapper, &data, len );
if ( !data )
return E_FAIL;
HGLOBAL hGlobalMemory = NULL;
aSTG.tymed = TYMED_HGLOBAL;
aSTG.pUnkForRelease = NULL;
// We play games under the hood and advertise flavors that we know we
// can support, only they require a bit of conversion or munging of the data.
// Do that here.
//
// The transferable gives us data that is null-terminated, but this isn't reflected in
// the |len| parameter. Windoze apps expect this null to be there so bump our data buffer
// by the appropriate size to account for the null (one char for CF_TEXT, one PRUnichar for
// CF_UNICODETEXT).
DWORD allocLen = (DWORD)len;
if ( aFE.cfFormat == CF_TEXT ) {
// Someone is asking for text/plain; convert the unicode (assuming it's present)
// to text with the correct platform encoding.
char* plainTextData = nsnull;
PRUnichar* castedUnicode = reinterpret_cast<PRUnichar*>(data);
PRInt32 plainTextLen = 0;
nsPrimitiveHelpers::ConvertUnicodeToPlatformPlainText ( castedUnicode, len / 2, &plainTextData, &plainTextLen );
// replace the unicode data with our plaintext data. Recall that |plainTextLen| doesn't include
// the null in the length.
nsMemory::Free(data);
if ( plainTextData ) {
data = plainTextData;
allocLen = plainTextLen + sizeof(char);
}
else {
NS_WARNING ( "Oh no, couldn't convert unicode to plain text" );
return S_OK;
}
}
else if ( aFE.cfFormat == nsClipboard::CF_HTML ) {
// Someone is asking for win32's HTML flavor. Convert our html fragment
// from unicode to UTF-8 then put it into a format specified by msft.
NS_ConvertUTF16toUTF8 converter ( reinterpret_cast<PRUnichar*>(data) );
char* utf8HTML = nsnull;
nsresult rv = BuildPlatformHTML ( converter.get(), &utf8HTML ); // null terminates
nsMemory::Free(data);
if ( NS_SUCCEEDED(rv) && utf8HTML ) {
// replace the unicode data with our HTML data. Don't forget the null.
data = utf8HTML;
allocLen = strlen(utf8HTML) + sizeof(char);
}
else {
NS_WARNING ( "Oh no, couldn't convert to HTML" );
return S_OK;
}
}
else {
// we assume that any data that isn't caught above is unicode. This may
// be an erroneous assumption, but is true so far.
allocLen += sizeof(PRUnichar);
}
hGlobalMemory = (HGLOBAL)GlobalAlloc(GMEM_MOVEABLE, allocLen);
// Copy text to Global Memory Area
if ( hGlobalMemory ) {
char* dest = reinterpret_cast<char*>(GlobalLock(hGlobalMemory));
char* source = reinterpret_cast<char*>(data);
memcpy ( dest, source, allocLen ); // copies the null as well
GlobalUnlock(hGlobalMemory);
}
aSTG.hGlobal = hGlobalMemory;
// Now, delete the memory that was created by CreateDataFromPrimitive (or our text/plain data)
nsMemory::Free(data);
return S_OK;
}
//-----------------------------------------------------
HRESULT nsDataObj::GetFile(FORMATETC& aFE, STGMEDIUM& aSTG)
{
PRUint32 dfInx = 0;
ULONG count;
FORMATETC fe;
m_enumFE->Reset();
while (NOERROR == m_enumFE->Next(1, &fe, &count)
&& dfInx < mDataFlavors.Length()) {
if (mDataFlavors[dfInx].EqualsLiteral(kNativeImageMime))
return DropImage(aFE, aSTG);
if (mDataFlavors[dfInx].EqualsLiteral(kFileMime))
return DropFile(aFE, aSTG);
if (mDataFlavors[dfInx].EqualsLiteral(kFilePromiseMime))
return DropTempFile(aFE, aSTG);
dfInx++;
}
return E_FAIL;
}
HRESULT nsDataObj::DropFile(FORMATETC& aFE, STGMEDIUM& aSTG)
{
nsresult rv;
PRUint32 len = 0;
nsCOMPtr<nsISupports> genericDataWrapper;
mTransferable->GetTransferData(kFileMime, getter_AddRefs(genericDataWrapper),
&len);
nsCOMPtr<nsIFile> file ( do_QueryInterface(genericDataWrapper) );
if (!file)
{
nsCOMPtr<nsISupportsInterfacePointer> ptr(do_QueryInterface(genericDataWrapper));
if (ptr)
ptr->GetData(getter_AddRefs(file));
}
if (!file)
return E_FAIL;
aSTG.tymed = TYMED_HGLOBAL;
aSTG.pUnkForRelease = NULL;
nsAutoString path;
rv = file->GetPath(path);
if (NS_FAILED(rv))
return E_FAIL;
PRUint32 allocLen = path.Length() + 2;
HGLOBAL hGlobalMemory = NULL;
PRUnichar *dest;
hGlobalMemory = GlobalAlloc(GMEM_MOVEABLE, sizeof(DROPFILES) +
allocLen * sizeof(PRUnichar));
if (!hGlobalMemory)
return E_FAIL;
DROPFILES* pDropFile = (DROPFILES*)GlobalLock(hGlobalMemory);
// First, populate the drop file structure
pDropFile->pFiles = sizeof(DROPFILES); //Offset to start of file name string
pDropFile->fNC = 0;
pDropFile->pt.x = 0;
pDropFile->pt.y = 0;
pDropFile->fWide = TRUE;
// Copy the filename right after the DROPFILES structure
dest = (PRUnichar*)(((char*)pDropFile) + pDropFile->pFiles);
memcpy(dest, path.get(), (allocLen - 1) * sizeof(PRUnichar));
// Two null characters are needed at the end of the file name.
// Lookup the CF_HDROP shell clipboard format for more info.
// Add the second null character right after the first one.
dest[allocLen - 1] = L'\0';
GlobalUnlock(hGlobalMemory);
aSTG.hGlobal = hGlobalMemory;
return S_OK;
}
HRESULT nsDataObj::DropImage(FORMATETC& aFE, STGMEDIUM& aSTG)
{
nsresult rv;
if (!mCachedTempFile) {
PRUint32 len = 0;
nsCOMPtr<nsISupports> genericDataWrapper;
mTransferable->GetTransferData(kNativeImageMime, getter_AddRefs(genericDataWrapper), &len);
nsCOMPtr<imgIContainer> image(do_QueryInterface(genericDataWrapper));
if (!image) {
// Check if the image was put in an nsISupportsInterfacePointer wrapper.
// This might not be necessary any more, but could be useful for backwards
// compatibility.
nsCOMPtr<nsISupportsInterfacePointer> ptr(do_QueryInterface(genericDataWrapper));
if (ptr)
ptr->GetData(getter_AddRefs(image));
}
if (!image)
return E_FAIL;
// Use the clipboard helper class to build up a memory bitmap.
nsImageToClipboard converter(image);
HANDLE bits = nsnull;
rv = converter.GetPicture(&bits); // Clipboard routines return a global handle we own.
if (NS_FAILED(rv) || !bits)
return E_FAIL;
// We now own these bits!
PRUint32 bitmapSize = GlobalSize(bits);
if (!bitmapSize) {
GlobalFree(bits);
return E_FAIL;
}
// Save the bitmap to a temporary location.
nsCOMPtr<nsIFile> dropFile;
rv = NS_GetSpecialDirectory(NS_OS_TEMP_DIR, getter_AddRefs(dropFile));
if (!dropFile) {
GlobalFree(bits);
return E_FAIL;
}
// Filename must be random so as not to confuse apps like
// Photoshop which handle multiple drags into a single window.
char buf[13];
nsCString filename;
MakeRandomString(buf, 8);
memcpy(buf+8, ".bmp", 5);
filename.Append(nsDependentCString(buf, 12));
dropFile->AppendNative(filename);
rv = dropFile->CreateUnique(nsIFile::NORMAL_FILE_TYPE, 0660);
if (NS_FAILED(rv)) {
GlobalFree(bits);
return E_FAIL;
}
// Cache the temp file so we can delete it later and so
// it doesn't get recreated over and over on multiple calls
// which does occur from windows shell.
dropFile->Clone(getter_AddRefs(mCachedTempFile));
// Write the data to disk.
nsCOMPtr<nsIOutputStream> outStream;
rv = NS_NewLocalFileOutputStream(getter_AddRefs(outStream), dropFile);
if (NS_FAILED(rv)) {
GlobalFree(bits);
return E_FAIL;
}
char * bm = (char *)GlobalLock(bits);
BITMAPFILEHEADER fileHdr;
BITMAPINFOHEADER *bmpHdr = (BITMAPINFOHEADER*)bm;
fileHdr.bfType = ((WORD) ('M' << 8) | 'B');
fileHdr.bfSize = GlobalSize (bits) + sizeof(fileHdr);
fileHdr.bfReserved1 = 0;
fileHdr.bfReserved2 = 0;
fileHdr.bfOffBits = (DWORD) (sizeof(fileHdr) + bmpHdr->biSize);
PRUint32 writeCount = 0;
if (NS_FAILED(outStream->Write((const char *)&fileHdr, sizeof(fileHdr), &writeCount)) ||
NS_FAILED(outStream->Write((const char *)bm, bitmapSize, &writeCount)))
rv = NS_ERROR_FAILURE;
outStream->Close();
GlobalUnlock(bits);
GlobalFree(bits);
if (NS_FAILED(rv))
return E_FAIL;
}
// Pass the file name back to the drop target so that it can access the file.
nsAutoString path;
rv = mCachedTempFile->GetPath(path);
if (NS_FAILED(rv))
return E_FAIL;
// Two null characters are needed to terminate the file name list.
HGLOBAL hGlobalMemory = NULL;
PRUint32 allocLen = path.Length() + 2;
aSTG.tymed = TYMED_HGLOBAL;
aSTG.pUnkForRelease = NULL;
hGlobalMemory = GlobalAlloc(GMEM_MOVEABLE, sizeof(DROPFILES) + allocLen * sizeof(PRUnichar));
if (!hGlobalMemory)
return E_FAIL;
DROPFILES* pDropFile = (DROPFILES*)GlobalLock(hGlobalMemory);
// First, populate the drop file structure.
pDropFile->pFiles = sizeof(DROPFILES); // Offset to start of file name char array.
pDropFile->fNC = 0;
pDropFile->pt.x = 0;
pDropFile->pt.y = 0;
pDropFile->fWide = TRUE;
// Copy the filename right after the DROPFILES structure.
PRUnichar* dest = (PRUnichar*)(((char*)pDropFile) + pDropFile->pFiles);
memcpy(dest, path.get(), (allocLen - 1) * sizeof(PRUnichar)); // Copies the null character in path as well.
// Two null characters are needed at the end of the file name.
// Lookup the CF_HDROP shell clipboard format for more info.
// Add the second null character right after the first one.
dest[allocLen - 1] = L'\0';
GlobalUnlock(hGlobalMemory);
aSTG.hGlobal = hGlobalMemory;
return S_OK;
}
HRESULT nsDataObj::DropTempFile(FORMATETC& aFE, STGMEDIUM& aSTG)
{
nsresult rv;
if (!mCachedTempFile) {
// Tempfile will need a temporary location.
nsCOMPtr<nsIFile> dropFile;
rv = NS_GetSpecialDirectory(NS_OS_TEMP_DIR, getter_AddRefs(dropFile));
if (!dropFile)
return E_FAIL;
// Filename must be random
nsCString filename;
nsAutoString wideFileName;
nsCOMPtr<nsIURI> sourceURI;
rv = GetDownloadDetails(getter_AddRefs(sourceURI),
wideFileName);
if (NS_FAILED(rv))
return E_FAIL;
NS_UTF16ToCString(wideFileName, NS_CSTRING_ENCODING_NATIVE_FILESYSTEM, filename);
dropFile->AppendNative(filename);
rv = dropFile->CreateUnique(nsIFile::NORMAL_FILE_TYPE, 0660);
if (NS_FAILED(rv))
return E_FAIL;
// Cache the temp file so we can delete it later and so
// it doesn't get recreated over and over on multiple calls
// which does occur from windows shell.
dropFile->Clone(getter_AddRefs(mCachedTempFile));
// Write the data to disk.
nsCOMPtr<nsIOutputStream> outStream;
rv = NS_NewLocalFileOutputStream(getter_AddRefs(outStream), dropFile);
if (NS_FAILED(rv))
return E_FAIL;
IStream *pStream = NULL;
nsDataObj::CreateStream(&pStream);
NS_ENSURE_TRUE(pStream, E_FAIL);
char buffer[512];
ULONG readCount = 0;
PRUint32 writeCount = 0;
while (1) {
rv = pStream->Read(buffer, sizeof(buffer), &readCount);
if (NS_FAILED(rv))
return E_FAIL;
if (readCount == 0)
break;
rv = outStream->Write(buffer, readCount, &writeCount);
if (NS_FAILED(rv))
return E_FAIL;
}
outStream->Close();
pStream->Release();
}
// Pass the file name back to the drop target so that it can access the file.
nsAutoString path;
rv = mCachedTempFile->GetPath(path);
if (NS_FAILED(rv))
return E_FAIL;
PRUint32 allocLen = path.Length() + 2;
// Two null characters are needed to terminate the file name list.
HGLOBAL hGlobalMemory = NULL;
aSTG.tymed = TYMED_HGLOBAL;
aSTG.pUnkForRelease = NULL;
hGlobalMemory = GlobalAlloc(GMEM_MOVEABLE, sizeof(DROPFILES) + allocLen * sizeof(PRUnichar));
if (!hGlobalMemory)
return E_FAIL;
DROPFILES* pDropFile = (DROPFILES*)GlobalLock(hGlobalMemory);
// First, populate the drop file structure.
pDropFile->pFiles = sizeof(DROPFILES); // Offset to start of file name char array.
pDropFile->fNC = 0;
pDropFile->pt.x = 0;
pDropFile->pt.y = 0;
pDropFile->fWide = TRUE;
// Copy the filename right after the DROPFILES structure.
PRUnichar* dest = (PRUnichar*)(((char*)pDropFile) + pDropFile->pFiles);
memcpy(dest, path.get(), (allocLen - 1) * sizeof(PRUnichar)); // Copies the null character in path as well.
// Two null characters are needed at the end of the file name.
// Lookup the CF_HDROP shell clipboard format for more info.
// Add the second null character right after the first one.
dest[allocLen - 1] = L'\0';
GlobalUnlock(hGlobalMemory);
aSTG.hGlobal = hGlobalMemory;
return S_OK;
}
//-----------------------------------------------------
HRESULT nsDataObj::GetMetafilePict(FORMATETC&, STGMEDIUM&)
{
return E_NOTIMPL;
}
//-----------------------------------------------------
HRESULT nsDataObj::SetBitmap(FORMATETC&, STGMEDIUM&)
{
return E_NOTIMPL;
}
//-----------------------------------------------------
HRESULT nsDataObj::SetDib(FORMATETC&, STGMEDIUM&)
{
return E_FAIL;
}
//-----------------------------------------------------
HRESULT nsDataObj::SetText (FORMATETC& aFE, STGMEDIUM& aSTG)
{
return E_FAIL;
}
//-----------------------------------------------------
HRESULT nsDataObj::SetMetafilePict(FORMATETC&, STGMEDIUM&)
{
return E_FAIL;
}
//-----------------------------------------------------
//-----------------------------------------------------
CLSID nsDataObj::GetClassID() const
{
return CLSID_nsDataObj;
}
//-----------------------------------------------------
// Registers the DataFlavor/FE pair.
//-----------------------------------------------------
void nsDataObj::AddDataFlavor(const char* aDataFlavor, LPFORMATETC aFE)
{
// These two lists are the mapping to and from data flavors and FEs.
// Later, OLE will tell us it needs a certain type of FORMATETC (text, unicode, etc)
// unicode, etc), so we will look up the data flavor that corresponds to
// the FE and then ask the transferable for that type of data.
mDataFlavors.AppendElement(aDataFlavor);
m_enumFE->AddFormatEtc(aFE);
}
//-----------------------------------------------------
// Sets the transferable object
//-----------------------------------------------------
void nsDataObj::SetTransferable(nsITransferable * aTransferable)
{
NS_IF_RELEASE(mTransferable);
mTransferable = aTransferable;
if (nsnull == mTransferable) {
return;
}
NS_ADDREF(mTransferable);
return;
}
//
// ExtractURL
//
// Roots around in the transferable for the appropriate flavor that indicates
// a url and pulls out the url portion of the data. Used mostly for creating
// internet shortcuts on the desktop. The url flavor is of the format:
//
// <url> <linefeed> <page title>
//
nsresult
nsDataObj :: ExtractShortcutURL ( nsString & outURL )
{
NS_ASSERTION ( mTransferable, "We don't have a good transferable" );
nsresult rv = NS_ERROR_FAILURE;
PRUint32 len = 0;
nsCOMPtr<nsISupports> genericURL;
if ( NS_SUCCEEDED(mTransferable->GetTransferData(kURLMime, getter_AddRefs(genericURL), &len)) ) {
nsCOMPtr<nsISupportsString> urlObject ( do_QueryInterface(genericURL) );
if ( urlObject ) {
nsAutoString url;
urlObject->GetData ( url );
outURL = url;
// find the first linefeed in the data, that's where the url ends. trunc the
// result string at that point.
PRInt32 lineIndex = outURL.FindChar ( '\n' );
NS_ASSERTION ( lineIndex > 0, "Format for url flavor is <url> <linefeed> <page title>" );
if ( lineIndex > 0 ) {
outURL.Truncate ( lineIndex );
rv = NS_OK;
}
}
} else if ( NS_SUCCEEDED(mTransferable->GetTransferData(kURLDataMime, getter_AddRefs(genericURL), &len)) ||
NS_SUCCEEDED(mTransferable->GetTransferData(kURLPrivateMime, getter_AddRefs(genericURL), &len)) ) {
nsCOMPtr<nsISupportsString> urlObject ( do_QueryInterface(genericURL) );
if ( urlObject ) {
nsAutoString url;
urlObject->GetData ( url );
outURL = url;
rv = NS_OK;
}
} // if found flavor
return rv;
} // ExtractShortcutURL
//
// ExtractShortcutTitle
//
// Roots around in the transferable for the appropriate flavor that indicates
// a url and pulls out the title portion of the data. Used mostly for creating
// internet shortcuts on the desktop. The url flavor is of the format:
//
// <url> <linefeed> <page title>
//
nsresult
nsDataObj :: ExtractShortcutTitle ( nsString & outTitle )
{
NS_ASSERTION ( mTransferable, "We'd don't have a good transferable" );
nsresult rv = NS_ERROR_FAILURE;
PRUint32 len = 0;
nsCOMPtr<nsISupports> genericURL;
if ( NS_SUCCEEDED(mTransferable->GetTransferData(kURLMime, getter_AddRefs(genericURL), &len)) ) {
nsCOMPtr<nsISupportsString> urlObject ( do_QueryInterface(genericURL) );
if ( urlObject ) {
nsAutoString url;
urlObject->GetData ( url );
// find the first linefeed in the data, that's where the url ends. we want
// everything after that linefeed. FindChar() returns -1 if we can't find
PRInt32 lineIndex = url.FindChar ( '\n' );
NS_ASSERTION ( lineIndex != -1, "Format for url flavor is <url> <linefeed> <page title>" );
if ( lineIndex != -1 ) {
url.Mid ( outTitle, lineIndex + 1, (len/2) - (lineIndex + 1) );
rv = NS_OK;
}
}
} // if found flavor
return rv;
} // ExtractShortcutTitle
//
// BuildPlatformHTML
//
// Munge our HTML data to win32's CF_HTML spec. Basically, put the requisite
// header information on it. This will null terminate |outPlatformHTML|. See
// http://msdn.microsoft.com/workshop/networking/clipboard/htmlclipboard.asp
// for details.
//
// We assume that |inOurHTML| is already a fragment (ie, doesn't have <HTML>
// or <BODY> tags). We'll wrap the fragment with them to make other apps
// happy.
//
nsresult
nsDataObj :: BuildPlatformHTML ( const char* inOurHTML, char** outPlatformHTML )
{
*outPlatformHTML = nsnull;
nsDependentCString inHTMLString(inOurHTML);
const char* const numPlaceholder = "00000000";
const char* const startHTMLPrefix = "Version:0.9\r\nStartHTML:";
const char* const endHTMLPrefix = "\r\nEndHTML:";
const char* const startFragPrefix = "\r\nStartFragment:";
const char* const endFragPrefix = "\r\nEndFragment:";
const char* const startSourceURLPrefix = "\r\nSourceURL:";
const char* const endFragTrailer = "\r\n";
// Do we already have mSourceURL from a drag?
if (mSourceURL.IsEmpty()) {
nsAutoString url;
ExtractShortcutURL(url);
AppendUTF16toUTF8(url, mSourceURL);
}
const PRInt32 kSourceURLLength = mSourceURL.Length();
const PRInt32 kNumberLength = strlen(numPlaceholder);
const PRInt32 kTotalHeaderLen = strlen(startHTMLPrefix) +
strlen(endHTMLPrefix) +
strlen(startFragPrefix) +
strlen(endFragPrefix) +
strlen(endFragTrailer) +
(kSourceURLLength > 0 ? strlen(startSourceURLPrefix) : 0) +
kSourceURLLength +
(4 * kNumberLength);
NS_NAMED_LITERAL_CSTRING(htmlHeaderString, "<html><body>\r\n");
NS_NAMED_LITERAL_CSTRING(fragmentHeaderString, "<!--StartFragment-->");
nsDependentCString trailingString(
"<!--EndFragment-->\r\n"
"</body>\r\n"
"</html>");
// calculate the offsets
PRInt32 startHTMLOffset = kTotalHeaderLen;
PRInt32 startFragOffset = startHTMLOffset
+ htmlHeaderString.Length()
+ fragmentHeaderString.Length();
PRInt32 endFragOffset = startFragOffset
+ inHTMLString.Length();
PRInt32 endHTMLOffset = endFragOffset
+ trailingString.Length();
// now build the final version
nsCString clipboardString;
clipboardString.SetCapacity(endHTMLOffset);
clipboardString.Append(startHTMLPrefix);
clipboardString.Append(nsPrintfCString("%08u", startHTMLOffset));
clipboardString.Append(endHTMLPrefix);
clipboardString.Append(nsPrintfCString("%08u", endHTMLOffset));
clipboardString.Append(startFragPrefix);
clipboardString.Append(nsPrintfCString("%08u", startFragOffset));
clipboardString.Append(endFragPrefix);
clipboardString.Append(nsPrintfCString("%08u", endFragOffset));
if (kSourceURLLength > 0) {
clipboardString.Append(startSourceURLPrefix);
clipboardString.Append(mSourceURL);
}
clipboardString.Append(endFragTrailer);
clipboardString.Append(htmlHeaderString);
clipboardString.Append(fragmentHeaderString);
clipboardString.Append(inHTMLString);
clipboardString.Append(trailingString);
*outPlatformHTML = ToNewCString(clipboardString);
if (!*outPlatformHTML)
return NS_ERROR_OUT_OF_MEMORY;
return NS_OK;
}
HRESULT
nsDataObj :: GetUniformResourceLocator( FORMATETC& aFE, STGMEDIUM& aSTG, bool aIsUnicode )
{
HRESULT res = S_OK;
if (IsFlavourPresent(kURLMime)) {
if ( aIsUnicode )
res = ExtractUniformResourceLocatorW( aFE, aSTG );
else
res = ExtractUniformResourceLocatorA( aFE, aSTG );
}
else
NS_WARNING ("Not yet implemented\n");
return res;
}
HRESULT
nsDataObj::ExtractUniformResourceLocatorA(FORMATETC& aFE, STGMEDIUM& aSTG )
{
HRESULT result = S_OK;
nsAutoString url;
if (NS_FAILED(ExtractShortcutURL(url)))
return E_OUTOFMEMORY;
NS_LossyConvertUTF16toASCII asciiUrl(url);
const int totalLen = asciiUrl.Length() + 1;
HGLOBAL hGlobalMemory = GlobalAlloc(GMEM_ZEROINIT|GMEM_SHARE, totalLen);
if (!hGlobalMemory)
return E_OUTOFMEMORY;
char* contents = reinterpret_cast<char*>(GlobalLock(hGlobalMemory));
if (!contents) {
GlobalFree(hGlobalMemory);
return E_OUTOFMEMORY;
}
strcpy(contents, asciiUrl.get());
GlobalUnlock(hGlobalMemory);
aSTG.hGlobal = hGlobalMemory;
aSTG.tymed = TYMED_HGLOBAL;
return result;
}
HRESULT
nsDataObj::ExtractUniformResourceLocatorW(FORMATETC& aFE, STGMEDIUM& aSTG )
{
HRESULT result = S_OK;
nsAutoString url;
if (NS_FAILED(ExtractShortcutURL(url)))
return E_OUTOFMEMORY;
const int totalLen = (url.Length() + 1) * sizeof(PRUnichar);
HGLOBAL hGlobalMemory = GlobalAlloc(GMEM_ZEROINIT|GMEM_SHARE, totalLen);
if (!hGlobalMemory)
return E_OUTOFMEMORY;
wchar_t* contents = reinterpret_cast<wchar_t*>(GlobalLock(hGlobalMemory));
if (!contents) {
GlobalFree(hGlobalMemory);
return E_OUTOFMEMORY;
}
wcscpy(contents, url.get());
GlobalUnlock(hGlobalMemory);
aSTG.hGlobal = hGlobalMemory;
aSTG.tymed = TYMED_HGLOBAL;
return result;
}
// Gets the filename from the kFilePromiseURLMime flavour
nsresult nsDataObj::GetDownloadDetails(nsIURI **aSourceURI,
nsAString &aFilename)
{
*aSourceURI = nsnull;
NS_ENSURE_TRUE(mTransferable, NS_ERROR_FAILURE);
// get the URI from the kFilePromiseURLMime flavor
nsCOMPtr<nsISupports> urlPrimitive;
PRUint32 dataSize = 0;
mTransferable->GetTransferData(kFilePromiseURLMime, getter_AddRefs(urlPrimitive), &dataSize);
nsCOMPtr<nsISupportsString> srcUrlPrimitive = do_QueryInterface(urlPrimitive);
NS_ENSURE_TRUE(srcUrlPrimitive, NS_ERROR_FAILURE);
nsAutoString srcUri;
srcUrlPrimitive->GetData(srcUri);
if (srcUri.IsEmpty())
return NS_ERROR_FAILURE;
nsCOMPtr<nsIURI> sourceURI;
NS_NewURI(getter_AddRefs(sourceURI), srcUri);
nsAutoString srcFileName;
nsCOMPtr<nsISupports> fileNamePrimitive;
mTransferable->GetTransferData(kFilePromiseDestFilename, getter_AddRefs(fileNamePrimitive), &dataSize);
nsCOMPtr<nsISupportsString> srcFileNamePrimitive = do_QueryInterface(fileNamePrimitive);
if (srcFileNamePrimitive) {
srcFileNamePrimitive->GetData(srcFileName);
} else {
nsCOMPtr<nsIURL> sourceURL = do_QueryInterface(sourceURI);
if (!sourceURL)
return NS_ERROR_FAILURE;
nsCAutoString urlFileName;
sourceURL->GetFileName(urlFileName);
NS_UnescapeURL(urlFileName);
CopyUTF8toUTF16(urlFileName, srcFileName);
}
if (srcFileName.IsEmpty())
return NS_ERROR_FAILURE;
// make the name safe for the filesystem
MangleTextToValidFilename(srcFileName);
sourceURI.swap(*aSourceURI);
aFilename = srcFileName;
return NS_OK;
}
HRESULT nsDataObj::GetFileDescriptor_IStreamA(FORMATETC& aFE, STGMEDIUM& aSTG)
{
HGLOBAL fileGroupDescHandle = ::GlobalAlloc(GMEM_ZEROINIT|GMEM_SHARE,sizeof(FILEGROUPDESCRIPTORW));
NS_ENSURE_TRUE(fileGroupDescHandle, E_OUTOFMEMORY);
LPFILEGROUPDESCRIPTORA fileGroupDescA = reinterpret_cast<LPFILEGROUPDESCRIPTORA>(GlobalLock(fileGroupDescHandle));
if (!fileGroupDescA) {
::GlobalFree(fileGroupDescHandle);
return E_OUTOFMEMORY;
}
nsAutoString wideFileName;
nsresult rv;
nsCOMPtr<nsIURI> sourceURI;
rv = GetDownloadDetails(getter_AddRefs(sourceURI),
wideFileName);
if (NS_FAILED(rv))
{
::GlobalFree(fileGroupDescHandle);
return E_FAIL;
}
nsCAutoString nativeFileName;
NS_UTF16ToCString(wideFileName, NS_CSTRING_ENCODING_NATIVE_FILESYSTEM, nativeFileName);
strncpy(fileGroupDescA->fgd[0].cFileName, nativeFileName.get(), NS_MAX_FILEDESCRIPTOR - 1);
fileGroupDescA->fgd[0].cFileName[NS_MAX_FILEDESCRIPTOR - 1] = '\0';
// one file in the file block
fileGroupDescA->cItems = 1;
fileGroupDescA->fgd[0].dwFlags = FD_PROGRESSUI;
GlobalUnlock( fileGroupDescHandle );
aSTG.hGlobal = fileGroupDescHandle;
aSTG.tymed = TYMED_HGLOBAL;
return S_OK;
}
HRESULT nsDataObj::GetFileDescriptor_IStreamW(FORMATETC& aFE, STGMEDIUM& aSTG)
{
HGLOBAL fileGroupDescHandle = ::GlobalAlloc(GMEM_ZEROINIT|GMEM_SHARE,sizeof(FILEGROUPDESCRIPTORW));
NS_ENSURE_TRUE(fileGroupDescHandle, E_OUTOFMEMORY);
LPFILEGROUPDESCRIPTORW fileGroupDescW = reinterpret_cast<LPFILEGROUPDESCRIPTORW>(GlobalLock(fileGroupDescHandle));
if (!fileGroupDescW) {
::GlobalFree(fileGroupDescHandle);
return E_OUTOFMEMORY;
}
nsAutoString wideFileName;
nsresult rv;
nsCOMPtr<nsIURI> sourceURI;
rv = GetDownloadDetails(getter_AddRefs(sourceURI),
wideFileName);
if (NS_FAILED(rv))
{
::GlobalFree(fileGroupDescHandle);
return E_FAIL;
}
wcsncpy(fileGroupDescW->fgd[0].cFileName, wideFileName.get(), NS_MAX_FILEDESCRIPTOR - 1);
fileGroupDescW->fgd[0].cFileName[NS_MAX_FILEDESCRIPTOR - 1] = '\0';
// one file in the file block
fileGroupDescW->cItems = 1;
fileGroupDescW->fgd[0].dwFlags = FD_PROGRESSUI;
GlobalUnlock(fileGroupDescHandle);
aSTG.hGlobal = fileGroupDescHandle;
aSTG.tymed = TYMED_HGLOBAL;
return S_OK;
}
HRESULT nsDataObj::GetFileContents_IStream(FORMATETC& aFE, STGMEDIUM& aSTG)
{
IStream *pStream = NULL;
nsDataObj::CreateStream(&pStream);
NS_ENSURE_TRUE(pStream, E_FAIL);
aSTG.tymed = TYMED_ISTREAM;
aSTG.pstm = pStream;
aSTG.pUnkForRelease = NULL;
return S_OK;
}
void nsDataObj::RemoveTempFile(nsITimer* aTimer, void* aClosure)
{
nsDataObj *timedDataObj = static_cast<nsDataObj *>(aClosure);
if (timedDataObj->mCachedTempFile) {
timedDataObj->mCachedTempFile->Remove(false);
timedDataObj->mCachedTempFile = NULL;
}
timedDataObj->Release();
}