Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merged fixes in master with 1.7

  • Loading branch information...
commit 076223e30684fe85c2df46f63f0dfba117abf73d 2 parents 0223e82 + eb23dcb
@taxilian taxilian authored
Showing with 1,289 additions and 186 deletions.
  1. +19 −1 cmake/Mac.cmake
  2. +4 −4 cmake/PluginConfigDefaults.cmake
  3. +66 −1 cmake/Win.cmake
  4. +1 −1  cmake/buildconfig.cmake
  5. +29 −0 cmake/chrome.cmake
  6. +34 −15 cmake/common.cmake
  7. +19 −0 cmake/wix.cmake
  8. +35 −0 cmake/xpi.cmake
  9. 0  examples/FBTestPlugin/Mac/dmg_template/.background/PLACE_BACKGROUND_PICTURE_HERE.txt
  10. BIN  examples/FBTestPlugin/Mac/dmg_template/.background/background.png
  11. 0  examples/FBTestPlugin/Mac/dmg_template/README.txt
  12. +21 −0 examples/FBTestPlugin/Mac/dmgdesign.applescript
  13. +45 −0 examples/FBTestPlugin/Mac/installer.cmake
  14. +3 −0  examples/FBTestPlugin/Mac/projectDef.cmake
  15. +9 −3 fbgen.py
  16. +17 −0 fbgen/src/CMakeLists.txt
  17. +9 −0 fbgen/src/Chrome/chromepackage/manifest.json
  18. 0  fbgen/src/Mac/dmg_template/.background/PLACE_BACKGROUND_PICTURE_HERE.txt
  19. BIN  fbgen/src/Mac/dmg_template/.background/background.png
  20. 0  fbgen/src/Mac/dmg_template/README.txt
  21. +21 −0 fbgen/src/Mac/dmgdesign.applescript
  22. +45 −0 fbgen/src/Mac/installer.cmake
  23. +3 −0  fbgen/src/Mac/projectDef.cmake
  24. +9 −0 fbgen/src/Win/WiX/Template.ddf
  25. +9 −0 fbgen/src/Win/WiX/Template.inf
  26. +9 −0 fbgen/src/Win/projectDef.cmake
  27. +1 −0  fbgen/src/xpi/content/chrome.manifest
  28. +36 −0 fbgen/src/xpi/content/install.rdf
  29. +15 −26 src/ActiveXCore/ActiveXBrowserHost.cpp
  30. +3 −7 src/ActiveXCore/ActiveXBrowserHost.h
  31. +3 −2 src/ActiveXCore/precompiled_headers.h
  32. +38 −29 src/NpapiCore/NpapiBrowserHost.cpp
  33. +5 −7 src/NpapiCore/NpapiBrowserHost.h
  34. +34 −6 src/NpapiCore/NpapiPlugin.cpp
  35. +2 −0  src/NpapiCore/Win/NpapiBrowserHostAsyncWin.cpp
  36. +3 −1 src/NpapiCore/precompiled_headers.h
  37. +8 −4 src/PluginAuto/CMakeLists.txt
  38. +7 −0 src/PluginAuto/Win/PluginWindowWin.cpp
  39. +11 −0 src/PluginAuto/Win/PluginWindowWin.h
  40. +19 −5 src/PluginAuto/X11/PluginWindowX11.cpp
  41. +1 −0  src/PluginAuto/X11/PluginWindowX11.h
  42. +4 −0 src/PluginAuto/precompiled_headers.h
  43. +258 −0 src/PluginCore/BrowserStreamRequest.h
  44. +18 −1 src/PluginCore/DefaultBrowserStreamHandler.cpp
  45. +33 −0 src/PluginCore/DefaultBrowserStreamHandler.h
  46. +8 −0 src/PluginCore/PluginCore.cpp
  47. +26 −6 src/PluginCore/PluginCore.h
  48. +34 −0 src/PluginCore/PluginEvents/X11NativeGdkEvent.cpp
  49. +89 −0 src/PluginCore/PluginEvents/X11NativeGdkEvent.h
  50. +54 −30 src/PluginCore/SimpleStreamHelper.cpp
  51. +51 −0 src/PluginCore/SimpleStreamHelper.h
  52. +2 −0  src/PluginCore/Win/SystemHelpersWin.cpp
  53. +7 −0 src/PluginCore/Win/SystemProxyDetectorWin.cpp
  54. +3 −0  src/PluginCore/precompiled_headers.h
  55. +36 −5 src/ScriptingCore/BrowserHost.cpp
  56. +49 −19 src/ScriptingCore/BrowserHost.h
  57. +10 −10 src/ScriptingCore/CrossThreadCall.h
  58. +2 −1  src/ScriptingCore/FBPointers.h
  59. +1 −1  src/ScriptingCore/URI.cpp
  60. +4 −0 src/ScriptingCore/URI.h
  61. +4 −0 src/ScriptingCore/precompiled_headers.h
  62. +3 −1 src/ScriptingCore/utf8_tools.cpp
View
20 cmake/Mac.cmake
@@ -83,7 +83,8 @@ MACRO(add_mac_plugin PROJECT_NAME PLIST_TEMPLATE STRINGS_TEMPLATE LOCALIZED_TEMP
endforeach()
# Compile the resource file
- find_program(RC_COMPILER Rez NO_DEFAULT_PATHS)
+ firebreath_find_commands()
+ set(RC_COMPILER ${CMD_REZ})
execute_process(COMMAND
${RC_COMPILER} ${RCFILES} -useDF ${ARCHS} -arch x86_64 -o ${CMAKE_CURRENT_BINARY_DIR}/bundle/English.lproj/Localized.rsrc
)
@@ -116,3 +117,20 @@ MACRO(add_mac_plugin PROJECT_NAME PLIST_TEMPLATE STRINGS_TEMPLATE LOCALIZED_TEMP
ENDMACRO(add_mac_plugin)
+MACRO(firebreath_find_commands)
+
+ set(XCODE_TOOLS_PATHS /Developer/Tools /Applications/Xcode.app/Contents/Developer/Tools /Applications/Xcode.app/Contents/Developer/usr/bin /usr/bin)
+
+ find_program(CMD_CP cp)
+ find_program(CMD_RM rm)
+ find_program(CMD_LN ln)
+ find_program(CMD_MV mv)
+ find_program(CMD_HDIUTIL hdiutil)
+ find_program(CMD_SIPS sips)
+ find_program(CMD_SLEEP sleep)
+ find_program(CMD_OSASCRIPT osascript)
+ find_program(CMD_SETFILE SetFile ${XCODE_TOOLS_PATHS} )
+ find_program(CMD_DEREZ DeRez ${XCODE_TOOLS_PATHS} )
+ find_program(CMD_REZ Rez ${XCODE_TOOLS_PATHS} )
+
+ENDMACRO(firebreath_find_commands)
View
8 cmake/PluginConfigDefaults.cmake
@@ -12,10 +12,10 @@
if (APPLE)
- set (FBMAC_USE_CARBON 1)
- set (FBMAC_USE_COCOA 0)
- set (FBMAC_USE_QUICKDRAW 1)
- set (FBMAC_USE_COREGRAPHICS 0)
+ set (FBMAC_USE_CARBON 0)
+ set (FBMAC_USE_COCOA 1)
+ set (FBMAC_USE_QUICKDRAW 0)
+ set (FBMAC_USE_COREGRAPHICS 1)
set (FBMAC_USE_COREANIMATION 0)
set (FBMAC_USE_INVALIDATINGCOREANIMATION 0)
endif(APPLE)
View
67 cmake/Win.cmake
@@ -136,6 +136,9 @@ set(ATL_INCLUDE_DIRS
${MFC_INCLUDE_DIR}
CACHE INTERNAL "ATL and MFC include dirs")
+IF(NOT DEFINED CMAKE_MAKECAB)
+ SET(CMAKE_MAKECAB makecab)
+ENDIF(NOT DEFINED CMAKE_MAKECAB)
MACRO(add_windows_plugin PROJNAME INSOURCES)
set(SOURCES
@@ -251,6 +254,68 @@ function (add_wix_installer PROJNAME WIX_SOURCEFILES WIX_COMPGROUP WIX_OUTDIR WI
WIX_LINK(${PROJNAME}${FB_WIX_SUFFIX} ${WIX_DEST} WIX_FULLOBJLIST NONE)
ADD_DEPENDENCIES(${PROJNAME}${FB_WIX_SUFFIX} ${WIX_PROJDEP})
-
+
+ # Create the EXE wrapper
+
+ if (FB_WIX_EXEDEST)
+ SET (WIX_EXEDEST ${FB_WIX_EXEDEST})
+ else()
+ SET (WIX_EXEDEST ${WIX_OUTDIR}/${PROJNAME}.exe)
+ endif()
+
+ if (NOT FB_WIX_EXE_SUFFIX)
+ set (FB_WIX_EXE_SUFFIX _WiXInstallExe)
+ endif()
+
+ set (WIX_EXESOURCES
+ ${FB_ROOT}/cmake/dummy.cpp
+ ${WIX_DEST}
+ )
+ ADD_LIBRARY(${PROJNAME}${FB_WIX_EXE_SUFFIX} STATIC ${WIX_EXESOURCES})
+
+ WIX_SETUPBLD(${PROJNAME}${FB_WIX_EXE_SUFFIX} ${WIX_EXEDEST} ${WIX_DEST})
+
+ ADD_DEPENDENCIES(${PROJNAME}${FB_WIX_EXE_SUFFIX} ${PROJNAME}${FB_WIX_SUFFIX})
endif()
endfunction(add_wix_installer)
+
+function (create_cab PROJNAME DDF CAB_SOURCEFILES CAB_OUTDIR PROJDEP)
+ GET_FILENAME_COMPONENT(_tmp_File ${DDF} NAME)
+ configure_file(${DDF} ${CMAKE_CURRENT_BINARY_DIR}/${_tmp_File})
+ message("Configuring ${DDF} -> ${CMAKE_CURRENT_BINARY_DIR}/${_tmp_File}")
+ set(CAB_DDF ${CMAKE_CURRENT_BINARY_DIR}/${_tmp_File})
+
+ set(SOURCELIST ${CAB_DDF})
+ FOREACH(_curFile ${CAB_SOURCEFILES})
+ GET_FILENAME_COMPONENT(_tmp_File ${_curFile} NAME)
+ configure_file(${_curFile} ${CMAKE_CURRENT_BINARY_DIR}/${_tmp_File})
+ message("Configuring ${_curFile} -> ${CMAKE_CURRENT_BINARY_DIR}/${_tmp_File}")
+ set(SOURCELIST ${SOURCELIST} ${CMAKE_CURRENT_BINARY_DIR}/${_tmp_File})
+ ENDFOREACH()
+
+ set (WIX_SOURCES
+ ${FB_ROOT}/cmake/dummy.cpp
+ ${DDF}
+ ${CAB_SOURCEFILES}
+ ${SOURCELIST}
+ )
+
+ if (FB_CAB_DEST)
+ SET (CAB_DEST ${FB_CAB_DEST})
+ else()
+ SET (CAB_DEST ${CAB_OUTDIR}/${PROJNAME}.cab)
+ endif()
+
+ if (NOT FB_CAB_SUFFIX)
+ set (FB_CAB_SUFFIX _Cab)
+ endif()
+
+ ADD_LIBRARY(${PROJNAME}${FB_CAB_SUFFIX} STATIC ${WIX_SOURCES})
+ ADD_CUSTOM_COMMAND( TARGET ${PROJNAME}${FB_CAB_SUFFIX} POST_BUILD
+ COMMAND ${CMAKE_MAKECAB}
+ ARGS /D "OUTDIR=${CAB_OUTDIR}" /F "${CAB_DDF}"
+ DEPENDS ${SOURCELIST}
+ COMMENT "Create Cab ${CAB_DEST}"
+ )
+ ADD_DEPENDENCIES(${PROJNAME}${FB_CAB_SUFFIX} ${PROJDEP})
+endfunction(create_cab)
View
2  cmake/buildconfig.cmake
@@ -25,7 +25,7 @@ if (WIN32)
message(STATUS "Balanced size/speed optimization")
endif()
- set(CMAKE_C_FLAGS "/GF /DWIN32 /DFB_WIN=1 /DXP_WIN=1 /W3 /wd4996 /nologo /D UNICODE /D _UNICODE /D _WINDOWS /Zm256")
+ set(CMAKE_C_FLAGS "/GF /DWIN32 /DFB_WIN=1 /DXP_WIN=1 /W3 /wd4996 /nologo /D UNICODE /D _UNICODE /D _WINDOWS /Zm256 /Y-")
set(CMAKE_CXX_FLAGS "/GF /DWIN32 /DFB_WIN=1 /DXP_WIN=1 /W3 /wd4996 /nologo /EHsc /wd4290 /D UNICODE /D _UNICODE /D _WINDOWS /Zm256")
set(CMAKE_C_FLAGS_RELEASE "/GL /MT ${FB_OPT_PARAM} /DNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "/GL /MT ${FB_OPT_PARAM} /DNDEBUG")
View
29 cmake/chrome.cmake
@@ -0,0 +1,29 @@
+# Build a signed Chrome package to distribute the plugin
+# 2012/01 Geoffroy Couprie geoffroy.couprie@loginpeople.com
+
+function (add_chrome_package PROJNAME CRX_OUTDIR DLLFILE KEYFILE CRX_PROJDEP)
+ message(STATUS "CONFIGURING CRX PACKAGING")
+ set (CRX_SOURCES
+ ${FB_ROOT}/cmake/dummy.cpp
+ )
+ if (NOT FB_CRX_SUFFIX)
+ set (FB_CRX_SUFFIX _CRX)
+ endif()
+ ADD_LIBRARY(${PROJNAME}${FB_CRX_SUFFIX} STATIC ${CRX_SOURCES})
+
+ #Replace the plugin version in the install.rdf template
+ file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/gen/${FBSTRING_PluginFileName}-crx)
+ configure_template(${CMAKE_CURRENT_SOURCE_DIR}/Chrome/chromepackage/manifest.json ${CMAKE_CURRENT_BINARY_DIR}/gen/${FBSTRING_PluginFileName}-crx/manifest.json)
+
+ add_custom_command(
+ TARGET ${PROJNAME}${FB_CRX_SUFFIX}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy_directory "\"${CMAKE_CURRENT_BINARY_DIR}/gen/${FBSTRING_PluginFileName}-crx\"" "\"${CRX_OUTDIR}/${FBSTRING_PluginFileName}/\""
+ COMMAND ${CMAKE_COMMAND} -E copy ${DLLFILE} "\"${CRX_OUTDIR}/${FBSTRING_PluginFileName}/\""
+ COMMAND $ENV{LOCALAPPDATA}\\Google\\Chrome\\Application\\chrome.exe --pack-extension="\"${CRX_OUTDIR}/${FBSTRING_PluginFileName}\"" --pack-extension-key="\"${KEYFILE}\"" --no-message-box
+ COMMAND popd
+ COMMAND ${CMAKE_COMMAND} -E remove_directory "${CRX_OUTDIR}/${FBSTRING_PluginFileName}"
+ )
+ ADD_DEPENDENCIES(${PROJNAME}${FB_CRX_SUFFIX} ${CRX_PROJDEP})
+
+endfunction(add_chrome_package)
View
49 cmake/common.cmake
@@ -48,6 +48,12 @@ else ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
set ( FB_PLATFORM_ARCH_NAME "i386" )
endif ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
+# include the Chrome package generation function
+include(${FB_ROOT}/cmake/chrome.cmake)
+
+# include the XPI generation function
+include(${FB_ROOT}/cmake/xpi.cmake)
+
# include file with the crazy configure_template function
include(${FB_ROOT}/cmake/configure_template.cmake)
@@ -306,19 +312,32 @@ function (fb_check_boost)
endfunction()
MACRO(ADD_PRECOMPILED_HEADER PROJECT_NAME PrecompiledHeader PrecompiledSource SourcesVar)
- IF(MSVC)
- GET_FILENAME_COMPONENT(PrecompiledBasename ${PrecompiledHeader} NAME_WE)
- SET(__PrecompiledBinary "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${PrecompiledBasename}.pch")
-
- # Found this example of setting up PCH in the cmake source code under Tests/PrecompiledHeader
- SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES
- COMPILE_FLAGS "/Yu\"${PrecompiledHeader}\" /FI\"${PrecompiledHeader}\" /Fp\"${__PrecompiledBinary}\"")
-
- SET_SOURCE_FILES_PROPERTIES(${PrecompiledSource}
- PROPERTIES COMPILE_FLAGS "/Yc\"${PrecompiledBasename}.h\"")
- elseif (APPLE)
- message("Setting precompiled header ${PrecompiledHeader} on ${PROJECT_NAME}")
- SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER YES)
- SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES XCODE_ATTRIBUTE_GCC_PREFIX_HEADER "${PrecompiledHeader}")
- endif()
+ IF(FB_USE_PCH)
+ add_definitions(-D FB_USE_PCH=1)
+ IF(MSVC)
+ GET_FILENAME_COMPONENT(PrecompiledBasename ${PrecompiledHeader} NAME_WE)
+ SET(__PrecompiledBinary "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${PrecompiledBasename}.pch")
+
+ # Found this example of setting up PCH in the cmake source code under Tests/PrecompiledHeader
+ SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES
+ COMPILE_FLAGS "/Yu\"${PrecompiledHeader}\" /FI\"${PrecompiledHeader}\" /Fp\"${__PrecompiledBinary}\"")
+
+ SET_SOURCE_FILES_PROPERTIES(${PrecompiledSource}
+ PROPERTIES COMPILE_FLAGS "/Yc\"${PrecompiledBasename}.h\"")
+
+ FOREACH( src_file ${${SourcesVar}} )
+
+ GET_FILENAME_COMPONENT(src_ext ${src_file} EXT)
+ if ("${src_ext}" STREQUAL ".c")
+ SET_SOURCE_FILES_PROPERTIES(${src_file} PROPERTIES COMPILE_FLAGS "/Y-")
+ message("${src_file} is a C file")
+ endif()
+
+ ENDFOREACH()
+ elseif (APPLE)
+ message("Setting precompiled header ${PrecompiledHeader} on ${PROJECT_NAME}")
+ SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER YES)
+ SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES XCODE_ATTRIBUTE_GCC_PREFIX_HEADER "${PrecompiledHeader}")
+ endif()
+ ENDIF()
ENDMACRO(ADD_PRECOMPILED_HEADER)
View
19 cmake/wix.cmake
@@ -72,6 +72,8 @@ if (WIN32)
SET(WIX_CANDLE ${WIX_ROOT_DIR}/bin/candle.exe)
SET(WIX_LIGHT ${WIX_ROOT_DIR}/bin/light.exe)
SET(WIX_HEAT ${WIX_ROOT_DIR}/bin/heat.exe)
+ SET(WIX_SETUPBLD ${WIX_ROOT_DIR}/bin/setupbld.exe)
+ SET(WIX_SETUP ${WIX_ROOT_DIR}/bin/setup.exe)
# MESSAGE(STATUS "Windows Installer XML found.")
ENDIF(NOT WIX_FOUND)
@@ -209,4 +211,21 @@ if (WIN32)
)
ENDMACRO(WIX_LINK)
+
+ #
+ # Create
+ #
+ # Parameters
+ # _target - Name of target exe file
+ # _source - Name of source msi file
+ #
+ MACRO(WIX_SETUPBLD _project _target _source )
+ ADD_CUSTOM_COMMAND( TARGET ${_project} POST_BUILD
+ COMMAND ${WIX_SETUPBLD}
+ ARGS -out "${_target}" -mpsu "${_source}" -setup ${WIX_SETUP}
+ DEPENDS ${_source}
+ COMMENT "Wrapping ${_source} -> ${_target}"
+ )
+
+ ENDMACRO(WIX_LINK)
endif(WIN32)
View
35 cmake/xpi.cmake
@@ -0,0 +1,35 @@
+# Build a signed XPI package to distribute the plugin
+# 2012/01 Geoffroy Couprie geoffroy.couprie@loginpeople.com
+
+function (add_signed_xpi_installer PROJNAME XPI_OUTDIR DLLFILE XPISIGNERPATH PFXFILE PASSFILE XPI_PROJDEP)
+ message(STATUS "CONFIGURING XPI PACKAGING")
+ set (XPI_SOURCES
+ ${FB_ROOT}/cmake/dummy.cpp
+ )
+ if (NOT FB_XPI_SUFFIX)
+ set (FB_XPI_SUFFIX _XPI)
+ endif()
+ ADD_LIBRARY(${PROJNAME}${FB_XPI_SUFFIX} STATIC ${XPI_SOURCES})
+
+ if (NOT "${PASSFILE}" STREQUAL "")
+ file(STRINGS "${PASSFILE}" PASSPHRASE LIMIT_COUNT 1)
+ endif()
+
+ #Replace the plugin version in the install.rdf template
+ file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/gen/${FBSTRING_PluginFileName}-xpi)
+ file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/xpi/content/chrome.manifest DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/gen/${FBSTRING_PluginFileName}-xpi)
+ configure_template(${CMAKE_CURRENT_SOURCE_DIR}/xpi/content/install.rdf ${CMAKE_CURRENT_BINARY_DIR}/gen/${FBSTRING_PluginFileName}-xpi/install.rdf)
+
+ add_custom_command(
+ TARGET ${PROJNAME}${FB_XPI_SUFFIX}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy_directory "\"${CMAKE_CURRENT_BINARY_DIR}/gen/${FBSTRING_PluginFileName}-xpi\"" "\"${XPI_OUTDIR}/${FBSTRING_PluginFileName}/\""
+ COMMAND mkdir "\"${XPI_OUTDIR}/${FBSTRING_PluginFileName}/plugins/\""
+ COMMAND ${CMAKE_COMMAND} -E copy "${DLLFILE}" "\"${XPI_OUTDIR}/${FBSTRING_PluginFileName}/plugins/\""
+ COMMAND java -jar ${XPISIGNERPATH} ${PFXFILE} ${PASSPHRASE} "${XPI_OUTDIR}/${FBSTRING_PluginFileName}" "${XPI_OUTDIR}/${FBSTRING_PluginFileName}.xpi"
+ COMMAND popd
+ COMMAND ${CMAKE_COMMAND} -E remove_directory "${XPI_OUTDIR}/${FBSTRING_PluginFileName}"
+ )
+ ADD_DEPENDENCIES(${PROJNAME}${FB_XPI_SUFFIX} ${XPI_PROJDEP})
+
+endfunction(add_signed_xpi_installer)
View
0  examples/FBTestPlugin/Mac/dmg_template/.background/PLACE_BACKGROUND_PICTURE_HERE.txt
No changes.
View
BIN  examples/FBTestPlugin/Mac/dmg_template/.background/background.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  examples/FBTestPlugin/Mac/dmg_template/README.txt
No changes.
View
21 examples/FBTestPlugin/Mac/dmgdesign.applescript
@@ -0,0 +1,21 @@
+on run args
+ set thePluginName to (item 1 of args)
+ set theInstallerName to (item 2 of args)
+ tell application "Finder"
+ tell disk theInstallerName
+ open
+ set current view of container window to icon view
+ set toolbar visible of container window to false
+ set statusbar visible of container window to false
+ set the bounds of container window to {200, 100, 712, 612}
+ set opts to the icon view options of container window
+ set background picture of opts to file ".background:background.png"
+ set arrangement of opts to not arranged
+ set icon size of opts to 80
+ set position of item thePluginName of container window to {150, 275}
+ set position of item "Plugins" of container window to {650, 275}
+ delay 5
+ eject
+ end tell
+ end tell
+end run
View
45 examples/FBTestPlugin/Mac/installer.cmake
@@ -0,0 +1,45 @@
+set(INSTALLER_NAME "${PLUGIN_NAME} Installer")
+
+FIREBREATH_FIND_COMMANDS()
+
+message(STATUS "Adding DMG installer for ${PROJECT_NAME}")
+add_custom_command(
+ TARGET ${PROJECT_NAME}
+ POST_BUILD
+ COMMENT "------------ CREATE DMG INSTALLER"
+
+ #replace the copy with svn/git/whatever export if needed
+ COMMAND ${CMD_CP} -r ${CMAKE_CURRENT_SOURCE_DIR}/Mac/dmg_template ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/dmg_template
+ COMMAND ${CMD_CP} -R ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${PLUGIN_NAME}.plugin ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/dmg_template
+
+ #Give an icon to your bundle
+ #COMMAND ${CMD_SIPS} -i ${CMAKE_CURRENT_SOURCE_DIR}/Mac/icon.png
+ #COMMAND ${CMD_DEREZ} -only icns ${CMAKE_CURRENT_SOURCE_DIR}/Mac/icon.png > ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/tempicns.rsrc
+ #COMMAND ${CMD_REZ} -append ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/tempicns.rsrc -o `printf "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/dmg_template/${PLUGIN_NAME}.plugin/Icon\r"`
+
+ COMMAND ${CMD_SETFILE} -a C ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/dmg_template/${PLUGIN_NAME}.plugin/
+ COMMAND ${CMD_LN} -s /Library/Internet\ Plug-Ins ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/dmg_template/
+ COMMAND ${CMD_MV} ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/dmg_template/Internet\ Plug-Ins ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/dmg_template/Plugins
+
+ #Create the DMG
+ COMMAND ${CMD_HDIUTIL} create -fs HFS+ -srcfolder ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/dmg_template/ -volname "${INSTALLER_NAME}" -format UDRW ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${PLUGIN_NAME}-temp.dmg
+ COMMAND ${CMD_HDIUTIL} attach ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${PLUGIN_NAME}-temp.dmg -noautoopen -quiet
+
+ #Wait for the installer to mount
+ COMMAND ${CMD_SLEEP} 2
+ COMMAND ${CMD_OSASCRIPT} ${CMAKE_CURRENT_SOURCE_DIR}/Mac/dmgdesign.applescript ${PLUGIN_NAME}.plugin "${INSTALLER_NAME}"
+ COMMAND ${CMD_SLEEP} 2
+ COMMAND ${CMD_HDIUTIL} attach ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${PLUGIN_NAME}-temp.dmg -noautoopen -quiet
+
+ #Repeat the commands, as they are not always executed o_O
+ COMMAND ${CMD_SLEEP} 2
+ COMMAND ${CMD_OSASCRIPT} ${CMAKE_CURRENT_SOURCE_DIR}/Mac/dmgdesign.applescript ${PLUGIN_NAME}.plugin "${INSTALLER_NAME}"
+ COMMAND ${CMD_SLEEP} 2
+
+ COMMAND ${CMD_HDIUTIL} convert ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${PLUGIN_NAME}-temp.dmg -format UDZO -imagekey zlib-level=9 -o ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${PLUGIN_NAME}.dmg
+
+ COMMAND ${CMD_RM} ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${PLUGIN_NAME}-temp.dmg
+ COMMAND ${CMD_RM} -rf ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/dmg_template
+
+ #COMMAND ${CMD_RM} ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/tempicns.rsrc
+)
View
3  examples/FBTestPlugin/Mac/projectDef.cmake
@@ -69,3 +69,6 @@ set (CPACK_GENERATOR PackageMaker DragNDrop TGZ ZIP)
set (CPACK_INSTALL_DIRECTORIES ${PLUGIN_BUILD_DIR}/Debug/${PLUGIN_FNAME}.plugin/)
set (CPACK_OUTPUT_CONFIG_FILE ${PLUGIN_BUILD_DIR}/Debug/CPackConfig.cmake)
include (CPack)
+
+#To create a DMG, include the following file
+#include(Mac/installer.cmake)
View
12 fbgen.py
@@ -32,7 +32,7 @@ def getTemplateFiles(basePath, origPath=None):
files = []
for filename in os.listdir(basePath):
tmpName = os.path.join(basePath, filename)
- if filename[0:1] == '.' or tmpName is None:
+ if filename == '.' or filename == ".." or tmpName is None:
continue
if os.path.isdir(tmpName):
files.extend(getTemplateFiles(tmpName, origPath) )
@@ -164,8 +164,14 @@ def Main():
tplFile = os.path.join("fbgen", "src", tpl)
print tplFile
template = Template(tplFile)
- f = open(filename, "wb")
- f.write(template.process(plugin, company, guid, generatedGuids, templateTime))
+ #Special case for binary files
+ if(tplFilename == "background.png"):
+ input = open(tplFile, "rb")
+ output = open(filename, "wb")
+ output.write(input.read())
+ else:
+ f = open(filename, "wb")
+ f.write(template.process(plugin, company, guid, generatedGuids, templateTime))
print " Processed", tpl
except:
print " Error processing", tpl
View
17 fbgen/src/CMakeLists.txt
@@ -37,3 +37,20 @@ SET( SOURCES
# This will include Win/projectDef.cmake, X11/projectDef.cmake, Mac/projectDef
# depending on the platform
include_platform()
+
+#this will build a Chrome package
+#add_chrome_package(${PLUGIN_NAME}
+# ${FB_BIN_DIR}/${PLUGIN_NAME}/${CMAKE_CFG_INTDIR}/
+# "${FB_BIN_DIR}/${PLUGIN_NAME}/${CMAKE_CFG_INTDIR}/${FBSTRING_PluginFileName}.dll"
+# "${CMAKE_CURRENT_SOURCE_DIR}/sign/package_key.pem"
+# ${PROJECT_NAME})
+
+#this will build a XPI package using XPISigner (see http://code.google.com/p/xpisigner/ )
+# add_signed_xpi_installer(${PLUGIN_NAME}
+# ${FB_BIN_DIR}/${PLUGIN_NAME}/${CMAKE_CFG_INTDIR}/
+# "${FB_BIN_DIR}/${PLUGIN_NAME}/${CMAKE_CFG_INTDIR}/${FBSTRING_PluginFileName}.dll"
+# $ENV{XPI_PATH}
+# "${CMAKE_CURRENT_SOURCE_DIR}/sign/certificate.pfx"
+# "${CMAKE_CURRENT_SOURCE_DIR}/sign/passphrase.txt"
+# ${PROJECT_NAME})
+
View
9 fbgen/src/Chrome/chromepackage/manifest.json
@@ -0,0 +1,9 @@
+{
+ "name": "@{PLUGIN_name}",
+ "version": "${FBSTRING_PLUGIN_VERSION}",
+ "description": "@{PLUGIN_desc}",
+
+ "plugins": [
+ { "path": "np@{PLUGIN_ident}.dll", "public": true }
+ ]
+}
View
0  fbgen/src/Mac/dmg_template/.background/PLACE_BACKGROUND_PICTURE_HERE.txt
No changes.
View
BIN  fbgen/src/Mac/dmg_template/.background/background.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  fbgen/src/Mac/dmg_template/README.txt
No changes.
View
21 fbgen/src/Mac/dmgdesign.applescript
@@ -0,0 +1,21 @@
+on run args
+ set thePluginName to (item 1 of args)
+ set theInstallerName to (item 2 of args)
+ tell application "Finder"
+ tell disk theInstallerName
+ open
+ set current view of container window to icon view
+ set toolbar visible of container window to false
+ set statusbar visible of container window to false
+ set the bounds of container window to {200, 100, 712, 612}
+ set opts to the icon view options of container window
+ set background picture of opts to file ".background:background.png"
+ set arrangement of opts to not arranged
+ set icon size of opts to 80
+ set position of item thePluginName of container window to {150, 275}
+ set position of item "Plugins" of container window to {650, 275}
+ delay 5
+ eject
+ end tell
+ end tell
+end run
View
45 fbgen/src/Mac/installer.cmake
@@ -0,0 +1,45 @@
+set(INSTALLER_NAME "${PLUGIN_NAME} Installer")
+
+FIREBREATH_FIND_COMMANDS()
+
+message(STATUS "Adding DMG installer for ${PROJECT_NAME}")
+add_custom_command(
+ TARGET ${PROJECT_NAME}
+ POST_BUILD
+ COMMENT "------------ CREATE DMG INSTALLER"
+
+ #replace the copy with svn/git/whatever export if needed
+ COMMAND ${CMD_CP} -r ${CMAKE_CURRENT_SOURCE_DIR}/Mac/dmg_template ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/dmg_template
+ COMMAND ${CMD_CP} -R ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${PLUGIN_NAME}.plugin ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/dmg_template
+
+ #Give an icon to your bundle
+ #COMMAND ${CMD_SIPS} -i ${CMAKE_CURRENT_SOURCE_DIR}/Mac/icon.png
+ #COMMAND ${CMD_DEREZ} -only icns ${CMAKE_CURRENT_SOURCE_DIR}/Mac/icon.png > ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/tempicns.rsrc
+ #COMMAND ${CMD_REZ} -append ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/tempicns.rsrc -o `printf "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/dmg_template/${PLUGIN_NAME}.plugin/Icon\r"`
+
+ COMMAND ${CMD_SETFILE} -a C ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/dmg_template/${PLUGIN_NAME}.plugin/
+ COMMAND ${CMD_LN} -s /Library/Internet\ Plug-Ins ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/dmg_template/
+ COMMAND ${CMD_MV} ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/dmg_template/Internet\ Plug-Ins ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/dmg_template/Plugins
+
+ #Create the DMG
+ COMMAND ${CMD_HDIUTIL} create -fs HFS+ -srcfolder ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/dmg_template/ -volname "${INSTALLER_NAME}" -format UDRW ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${PLUGIN_NAME}-temp.dmg
+ COMMAND ${CMD_HDIUTIL} attach ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${PLUGIN_NAME}-temp.dmg -noautoopen -quiet
+
+ #Wait for the installer to mount
+ COMMAND ${CMD_SLEEP} 2
+ COMMAND ${CMD_OSASCRIPT} ${CMAKE_CURRENT_SOURCE_DIR}/Mac/dmgdesign.applescript ${PLUGIN_NAME}.plugin "${INSTALLER_NAME}"
+ COMMAND ${CMD_SLEEP} 2
+ COMMAND ${CMD_HDIUTIL} attach ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${PLUGIN_NAME}-temp.dmg -noautoopen -quiet
+
+ #Repeat the commands, as they are not always executed o_O
+ COMMAND ${CMD_SLEEP} 2
+ COMMAND ${CMD_OSASCRIPT} ${CMAKE_CURRENT_SOURCE_DIR}/Mac/dmgdesign.applescript ${PLUGIN_NAME}.plugin "${INSTALLER_NAME}"
+ COMMAND ${CMD_SLEEP} 2
+
+ COMMAND ${CMD_HDIUTIL} convert ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${PLUGIN_NAME}-temp.dmg -format UDZO -imagekey zlib-level=9 -o ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${PLUGIN_NAME}.dmg
+
+ COMMAND ${CMD_RM} ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${PLUGIN_NAME}-temp.dmg
+ COMMAND ${CMD_RM} -rf ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/dmg_template
+
+ #COMMAND ${CMD_RM} ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/tempicns.rsrc
+)
View
3  fbgen/src/Mac/projectDef.cmake
@@ -36,3 +36,6 @@ add_mac_plugin(${PROJECT_NAME} ${PLIST} ${STRINGS} ${LOCALIZED} SOURCES)
target_link_libraries(${PROJECT_NAME}
${PLUGIN_INTERNAL_DEPS}
)
+
+#To create a DMG, include the following file
+#include(Mac/installer.cmake)
View
9 fbgen/src/Win/WiX/Template.ddf
@@ -0,0 +1,9 @@
+;
+.Set DiskDirectoryTemplate=%OUTDIR%/
+.Set CabinetNameTemplate=${PROJECT_NAME}.cab
+.Set Cabinet=on
+.Set Compress=on
+.Set MaxDiskSize=0
+%OUTDIR%/${PROJECT_NAME}.exe
+${CMAKE_CURRENT_BINARY_DIR}/@{PLUGIN_ident}.inf
+;
View
9 fbgen/src/Win/WiX/Template.inf
@@ -0,0 +1,9 @@
+[version]
+Signature="$CHICAGO$"
+AdvancedINF=2.0
+
+[Setup Hooks]
+hook1=hook1
+
+[hook1]
+run="%EXTRACT_DIR%\${PROJECT_NAME}.exe"
View
9 fbgen/src/Win/projectDef.cmake
@@ -71,3 +71,12 @@ add_wix_installer( ${PLUGIN_NAME}
# "${CMAKE_CURRENT_SOURCE_DIR}/sign/certificate.pfx"
# "${CMAKE_CURRENT_SOURCE_DIR}/sign/passphrase.txt"
# "http://timestamp.verisign.com/scripts/timestamp.dll")
+
+# This is an example of how to create a cab
+# -- uncomment lines below this to enable signing --
+#create_cab(${PLUGIN_NAME}
+# ${CMAKE_CURRENT_SOURCE_DIR}/Win/Wix/@{PLUGIN_ident}.ddf
+# ${CMAKE_CURRENT_SOURCE_DIR}/Win/Wix/@{PLUGIN_ident}.inf
+# ${FB_BIN_DIR}/${PLUGIN_NAME}/${CMAKE_CFG_INTDIR}/
+# ${PROJECT_NAME}_WiXInstallExe
+# )
View
1  fbgen/src/xpi/content/chrome.manifest
@@ -0,0 +1 @@
+binary-component plugins/np@{PLUGIN_ident} abi=WINNT_x86-MSVC
View
36 fbgen/src/xpi/content/install.rdf
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#">
+ <Description about="urn:mozilla:install-manifest">
+
+ <em:id>EMAIL_ADDRESS_HERE</em:id>
+ <em:name>@{PLUGIN_ident}</em:name>
+ <em:version>${FBSTRING_PLUGIN_VERSION}</em:version>
+ <!--<em:iconURL></em:iconURL>-->
+ <!--em:updateURL>http://@{COMPANY_domain}/update.rdf</em:updateURL>
+ <em:updateKey></em:updateKey-->
+ <em:unpack>true</em:unpack>
+
+ <em:localized>
+ <Description>
+ <em:locale>en-US</em:locale>
+ <em:name>@{PLUGIN_name}</em:name>
+ <em:description>@{PLUGIN_desc}</em:description>
+ <em:creator>@{COMPANY_name}</em:creator>
+ <em:homepageURL>http://@{COMPANY_domain}</em:homepageURL>
+ </Description>
+ </em:localized>
+
+ <!-- Mozilla Firefox -->
+ <em:targetApplication>
+ <Description>
+ <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
+ <em:minVersion>3.*</em:minVersion>
+ <em:maxVersion>10.*</em:maxVersion>
+ </Description>
+ </em:targetApplication>
+
+ <!-- Platforms -->
+ <em:targetPlatform>WINNT_x86-msvc</em:targetPlatform>
+
+ </Description>
+</RDF>
View
41 src/ActiveXCore/ActiveXBrowserHost.cpp
@@ -12,6 +12,8 @@ License: Dual license model; choose one of two:
Copyright 2009 Richard Bateman, Firebreath development team
\**********************************************************/
+#include "win_targetver.h"
+#include "win_common.h"
#include <boost/assign.hpp>
#include <boost/smart_ptr/make_shared.hpp>
#include "axstream.h"
@@ -27,6 +29,7 @@ Copyright 2009 Richard Bateman, Firebreath development team
#include "ComVariantUtil.h"
#include "ActiveXFactoryDefinitions.h"
#include "ActiveXBrowserHost.h"
+#include "BrowserStreamRequest.h"
#include "precompiled_headers.h" // On windows, everything above this line in PCH
using namespace FB;
@@ -267,18 +270,25 @@ void ActiveXBrowserHost::getComVariant(VARIANT *dest, const FB::variant &var)
outVar.Detach(dest);
}
-FB::BrowserStreamPtr ActiveXBrowserHost::_createStream(const std::string& url, const FB::PluginEventSinkPtr& callback,
- bool cache, bool seekable, size_t internalBufferSize ) const
+FB::BrowserStreamPtr FB::ActiveX::ActiveXBrowserHost::_createStream( const BrowserStreamRequest& req ) const
{
assertMainThread();
- ActiveXStreamPtr stream(boost::make_shared<ActiveXStream>(url, cache, seekable, internalBufferSize));
- stream->AttachObserver( callback );
+ std::string url(req.uri.toString());
+ ActiveXStreamPtr stream;
+ if (req.method == "POST") {
+ stream = boost::make_shared<ActiveXStream>(url, req.cache, req.seekable, req.internalBufferSize, req.getPostData());
+ } else {
+ stream = boost::make_shared<ActiveXStream>(url, req.cache, req.seekable, req.internalBufferSize);
+ }
+ if (req.getEventSink()) {
+ stream->AttachObserver( req.getEventSink() );
+ }
if ( stream->init() )
{
StreamCreatedEvent ev(stream.get());
stream->SendEvent( &ev );
- if ( seekable ) stream->signalOpened();
+ if ( req.seekable ) stream->signalOpened();
}
else
{
@@ -291,26 +301,6 @@ bool isExpired(std::pair<void*, FB::WeakIDispatchExRef> cur) {
return cur.second.expired();
}
-FB::BrowserStreamPtr ActiveXBrowserHost::_createPostStream(const std::string& url, const FB::PluginEventSinkPtr& callback,
- const std::string& postdata, bool cache, bool seekable, size_t internalBufferSize ) const
-{
- assertMainThread();
- ActiveXStreamPtr stream(boost::make_shared<ActiveXStream>(url, cache, seekable, internalBufferSize, postdata));
- stream->AttachObserver( callback );
-
- if ( stream->init() )
- {
- StreamCreatedEvent ev(stream.get());
- stream->SendEvent( &ev );
- if ( seekable ) stream->signalOpened();
- }
- else
- {
- stream.reset();
- }
- return stream;
-}
-
void ActiveXBrowserHost::DoDeferredRelease() const
{
assertMainThread();
@@ -403,4 +393,3 @@ void FB::ActiveX::ActiveXBrowserHost::Navigate( const std::string& url, const st
HRESULT hr = m_webBrowser->Navigate(destURL, &vEmpty, &targetWin, &vEmpty, &vEmpty);
assert(SUCCEEDED(hr));
}
-
View
10 src/ActiveXCore/ActiveXBrowserHost.h
@@ -29,6 +29,7 @@ Copyright 2009 Richard Bateman, Firebreath development team
namespace FB {
class WinMessageWindow;
+ class BrowserStreamRequest;
namespace ActiveX {
FB_FORWARD_PTR(ActiveXBrowserHost);
FB_FORWARD_PTR(IDispatchAPI);
@@ -50,17 +51,12 @@ namespace FB {
virtual void *getContextID() const;
- virtual FB::BrowserStreamPtr _createStream(const std::string& url, const FB::PluginEventSinkPtr& callback,
- bool cache = true, bool seekable = false,
- size_t internalBufferSize = 128 * 1024 ) const;
+ virtual FB::BrowserStreamPtr _createStream( const BrowserStreamRequest& req ) const;
+ virtual FB::BrowserStreamPtr _createUnsolicitedStream(const BrowserStreamRequest& req) const { return FB::BrowserStreamPtr(); }
IDispatchEx* getJSAPIWrapper(const FB::JSAPIWeakPtr& api, bool autoRelease = false);
IDispatchWRef getIDispatchRef(IDispatch* obj);
- virtual FB::BrowserStreamPtr _createPostStream(const std::string& url, const FB::PluginEventSinkPtr& callback,
- const std::string& postdata, bool cache = true, bool seekable = false,
- size_t internalBufferSize = 128 * 1024 ) const;
-
public:
FB::DOM::DocumentPtr getDOMDocument();
FB::DOM::WindowPtr getDOMWindow();
View
5 src/ActiveXCore/precompiled_headers.h
@@ -1,5 +1,5 @@
-#ifdef FB_WIN // For now only use this on windows; eventually we'd like to have PCH cross platform
+#ifdef FB_USE_PCH
#include "win_targetver.h"
#include "win_common.h"
@@ -35,6 +35,7 @@
#include "AXDOM/Element.h"
#include "AXDOM/Node.h"
#include "axutil.h"
+#include "BrowserStreamRequest.h"
-#endif
+#endif // FB_USE_PCH
View
67 src/NpapiCore/NpapiBrowserHost.cpp
@@ -27,6 +27,7 @@ Copyright 2009 Richard Bateman, Firebreath development team
#include "NpapiStream.h"
#include "NpapiBrowserHost.h"
+#include "BrowserStreamRequest.h"
#include "precompiled_headers.h" // On windows, everything above this line in PCH
#include "NPVariantUtil.h"
@@ -717,15 +718,33 @@ NPError FB::Npapi::NpapiBrowserHost::GetAuthenticationInfo( const char *protocol
}
}
-FB::BrowserStreamPtr NpapiBrowserHost::_createStream(const std::string& url, const FB::PluginEventSinkPtr& callback,
- bool cache, bool seekable, size_t internalBufferSize ) const
+FB::BrowserStreamPtr FB::Npapi::NpapiBrowserHost::_createStream( const BrowserStreamRequest& req ) const
{
- NpapiStreamPtr stream( boost::make_shared<NpapiStream>( url, cache, seekable, internalBufferSize, FB::ptr_cast<const NpapiBrowserHost>(shared_from_this()) ) );
- stream->AttachObserver( callback );
+ assertMainThread();
+ std::string url(req.uri.toString());
+ NpapiStreamPtr stream( boost::make_shared<NpapiStream>( url, req.cache, req.seekable, req.internalBufferSize, FB::ptr_cast<const NpapiBrowserHost>(shared_from_this()) ) );
+ if (req.getEventSink()) {
+ stream->AttachObserver( req.getEventSink() );
+ }
- // always use target = 0 for now
- if ( GetURLNotify( url.c_str(), 0, stream.get() ) == NPERR_NO_ERROR )
- {
+ NPError err;
+ if (req.method == "GET") {
+ err = GetURLNotify(url.c_str(), 0, stream.get());
+ } else {
+ std::stringstream postOutput;
+ std::string postdata = req.getPostData();
+ std::string postheaders = req.getPostHeaders();
+ if (!postheaders.empty()) {
+ postOutput << postheaders << "\n\n";
+ } else {
+ postOutput << "Content-type: application/x-www-form-urlencoded\n";
+ postOutput << "Content-Length: " << postdata.length() << "\n\n";
+ }
+ postOutput << postdata;
+ std::string out = postOutput.str();
+ err = PostURLNotify( url.c_str(), 0, out.length(), out.c_str(), false, stream.get() );
+ }
+ if (err == NPERR_NO_ERROR) {
stream->setCreated();
StreamCreatedEvent ev(stream.get());
stream->SendEvent( &ev );
@@ -737,31 +756,21 @@ FB::BrowserStreamPtr NpapiBrowserHost::_createStream(const std::string& url, con
return stream;
}
-FB::BrowserStreamPtr NpapiBrowserHost::_createPostStream(const std::string& url, const FB::PluginEventSinkPtr& callback,
- const std::string& postdata, bool cache, bool seekable, size_t internalBufferSize ) const
+FB::BrowserStreamPtr NpapiBrowserHost::_createUnsolicitedStream(const FB::BrowserStreamRequest& req) const
{
- NpapiStreamPtr stream( boost::make_shared<NpapiStream>( url, cache, seekable, internalBufferSize, FB::ptr_cast<const NpapiBrowserHost>(shared_from_this()) ) );
- stream->AttachObserver( callback );
-
- // Add custom headers before data to post!
- std::stringstream headers;
- headers << "Content-type: application/x-www-form-urlencoded\n";
- headers << "Content-Length: " << postdata.length() << "\n\n";
- headers << postdata;
+ std::string url = req.uri.toString();
+ bool cache(false);
+ NpapiStreamPtr stream( boost::make_shared<NpapiStream>( url, cache, req.seekable, req.internalBufferSize, FB::ptr_cast<const NpapiBrowserHost>(shared_from_this()) ) );
+ // The observer is attached by the caller
- // always use target = 0 for now
- if ( PostURLNotify( url.c_str(), 0, headers.str().length(), headers.str().c_str(), false, stream.get() ) == NPERR_NO_ERROR )
- {
- stream->setCreated();
- StreamCreatedEvent ev(stream.get());
- stream->SendEvent( &ev );
- }
- else
- {
- stream.reset();
- }
+ stream->setCreated();
+ // we're not waiting for a URLNotify call from this stream
+ stream->setNotified();
+ StreamCreatedEvent ev(stream.get());
+ stream->SendEvent( &ev );
return stream;
}
+
NPJavascriptObject* FB::Npapi::NpapiBrowserHost::getJSAPIWrapper( const FB::JSAPIWeakPtr& api, bool autoRelease/* = false*/ )
{
assertMainThread(); // This should only be called on the main thread
@@ -833,4 +842,4 @@ void FB::Npapi::NpapiBrowserHost::Navigate( const std::string& url, const std::s
PushPopupsEnabledState(true);
GetURL(url.c_str(), target.c_str());
PopPopupsEnabledState();
-}
+}
View
12 src/NpapiCore/NpapiBrowserHost.h
@@ -22,7 +22,9 @@ Copyright 2009 Richard Bateman, Firebreath development team
#include "ShareableReference.h"
#include <boost/thread.hpp>
-namespace FB { namespace Npapi {
+namespace FB {
+ class BrowserStreamRequest;
+ namespace Npapi {
FB_FORWARD_PTR(NpapiPluginModule);
FB_FORWARD_PTR(NPObjectAPI);
@@ -46,13 +48,9 @@ namespace FB { namespace Npapi {
void setBrowserFuncs(NPNetscapeFuncs *pFuncs);
public:
- virtual BrowserStreamPtr _createStream(const std::string& url, const PluginEventSinkPtr& callback,
- bool cache = true, bool seekable = false,
- size_t internalBufferSize = 128 * 1024 ) const;
+ virtual BrowserStreamPtr _createStream( const BrowserStreamRequest& req ) const;
- virtual BrowserStreamPtr _createPostStream(const std::string& url, const PluginEventSinkPtr& callback,
- const std::string& postdata, bool cache = true, bool seekable = false,
- size_t internalBufferSize = 128 * 1024 ) const;
+ virtual BrowserStreamPtr _createUnsolicitedStream(const BrowserStreamRequest& req) const;
public:
virtual bool _scheduleAsyncCall(void (*func)(void *), void *userData) const;
View
40 src/NpapiCore/NpapiPlugin.cpp
@@ -19,7 +19,9 @@ Copyright 2009 Richard Bateman, Firebreath development team
#include "BrowserHost.h"
#include "precompiled_headers.h" // On windows, everything above this line in PCH
+#include "BrowserStreamRequest.h"
#include "NpapiPlugin.h"
+#include "PluginEventSink.h"
using namespace FB::Npapi;
NpapiPlugin::NpapiPlugin(const NpapiBrowserHostPtr& host, const std::string& mimetype)
@@ -164,7 +166,7 @@ see if the plug-in can receive data again by resending the data at regular inter
*/
int32_t NpapiPlugin::WriteReady(NPStream* stream)
{
- NpapiStream* s = static_cast<NpapiStream*>( stream->notifyData );
+ NpapiStream* s = static_cast<NpapiStream*>( stream->pdata );
// check for streams we did not request or create
if ( !s ) return -1;
@@ -191,7 +193,7 @@ byte range requests, you can use this parameter to track NPN_RequestRead request
*/
int32_t NpapiPlugin::Write(NPStream* stream, int32_t offset, int32_t len, void* buffer)
{
- NpapiStream* s = static_cast<NpapiStream*>( stream->notifyData );
+ NpapiStream* s = static_cast<NpapiStream*>( stream->pdata );
// check for streams we did not request or create
if ( !s ) return -1;
@@ -207,7 +209,7 @@ If an error occurs while retrieving the data or writing the file, the file name
*/
void NpapiPlugin::StreamAsFile(NPStream* stream, const char* fname)
{
- NpapiStream* s = static_cast<NpapiStream*>( stream->notifyData );
+ NpapiStream* s = static_cast<NpapiStream*>( stream->pdata );
// check for streams we did not request or create
if ( !s ) return;
@@ -309,9 +311,34 @@ NPN_DestroyStream.
*/
NPError NpapiPlugin::NewStream(NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype)
{
- NpapiStream* s = static_cast<NpapiStream*>( stream->notifyData );
+ if (stream->notifyData && !stream->pdata) stream->pdata = stream->notifyData;
+
+ NpapiStream* s = static_cast<NpapiStream*>( stream->pdata );
// check for streams we did not request or create
- if ( !s ) return NPERR_NO_DATA;
+ if ( !s )
+ {
+ // Create a BrowserStreamRequest; only GET is supported
+ BrowserStreamRequest streamReq(stream->url, "GET", false);
+ streamReq.setLastModified(stream->lastmodified);
+ streamReq.setHeaders(stream->headers);
+ streamReq.setSeekable(seekable != 0);
+
+ pluginMain->handleUnsolicitedStream(streamReq);
+
+ FB::BrowserStreamPtr newstream;
+ if (streamReq.wasAccepted()) {
+ newstream = m_npHost->createUnsolicitedStream(streamReq);
+ PluginEventSinkPtr sink(streamReq.getEventSink());
+ if (sink) {
+ newstream->AttachObserver(sink);
+ }
+ // continue function using the newly created stream object
+ s = dynamic_cast<NpapiStream*> ( newstream.get() );
+ stream->pdata = static_cast<void*>( s );
+ }
+ }
+
+ if ( !s ) return NPERR_NO_ERROR;
s->setMimeType( type );
s->setStream( stream );
@@ -358,11 +385,12 @@ any further references to the stream object.
*/
NPError NpapiPlugin::DestroyStream(NPStream* stream, NPReason reason)
{
- NpapiStream* s = static_cast<NpapiStream*>( stream->notifyData );
+ NpapiStream* s = static_cast<NpapiStream*>( stream->pdata );
// check for streams we did not request or create
if ( !s || !s->getStream() ) return NPERR_NO_ERROR;
s->setStream( 0 );
+ stream->pdata = 0;
stream->notifyData = 0;
if ( !s->isCompleted() ) s->signalCompleted( reason == NPRES_DONE );
View
2  src/NpapiCore/Win/NpapiBrowserHostAsyncWin.cpp
@@ -13,6 +13,8 @@ License: Dual license model; choose one of two:
Copyright 2010 Georg Fritzsche, Firebreath development team
\**********************************************************/
+#include "win_targetver.h"
+#include "win_common.h"
#include "precompiled_headers.h" // On windows, everything above this line in PCH
#include "AsyncFunctionCall.h"
#include "Win/WinMessageWindow.h"
View
4 src/NpapiCore/precompiled_headers.h
@@ -1,4 +1,6 @@
+#ifdef FB_USE_PCH
+
#ifdef _WIN32
#include "win_targetver.h"
#include "win_common.h"
@@ -44,4 +46,4 @@
#include "DOM/Window.h"
#include "variant_list.h"
-
+#endif
View
12 src/PluginAuto/CMakeLists.txt
@@ -147,10 +147,16 @@ endif()
# ActiveX Support
######
if (WIN32)
+ if (FB_USE_PCH)
+ set(IDLC_EXT "cpp")
+ else()
+ set(IDLC_EXT "c")
+ endif()
+
set (GENERATED_IDL
"${FB_TEMPLATE_DEST_DIR}/FireBreathWin.tlb"
"${FB_TEMPLATE_DEST_DIR}/FireBreathWin_i.h"
- "${FB_TEMPLATE_DEST_DIR}/FireBreathWin_i.cpp"
+ "${FB_TEMPLATE_DEST_DIR}/FireBreathWin_i.${IDLC_EXT}"
)
SET (IDL_FILE ${FB_TEMPLATE_DEST_DIR}/FireBreathWin.idl)
@@ -159,7 +165,6 @@ if (WIN32)
${IDL_FILE}
"${FB_TEMPLATE_DEST_DIR}/FireBreathWin.tlb"
"${FB_TEMPLATE_DEST_DIR}/FireBreathWin_i.h"
- "${FB_TEMPLATE_DEST_DIR}/FireBreathWin_p.cpp"
PROPERTIES
HEADER_FILE_ONLY 1
GENERATED 1
@@ -180,8 +185,7 @@ if (WIN32)
/out "${FB_TEMPLATE_DEST_DIR}"
/tlb "FireBreathWin.tlb"
/h "FireBreathWin_i.h"
- /iid "FireBreathWin_i.cpp"
- /proxy "FireBreathWin_p.cpp"
+ /iid "FireBreathWin_i.${IDLC_EXT}"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${IDL_FILE}
)
View
7 src/PluginAuto/Win/PluginWindowWin.cpp
@@ -46,6 +46,7 @@ PluginWindowWin::PluginWindowWin(const WindowContextWin& ctx)
, m_browserhWnd(NULL)
, lpOldWinProc(NULL)
, m_callOldWinProc(false)
+ , m_suppressEraseBackground(false)
{
// subclass window so we can intercept window messages
lpOldWinProc = SubclassWindow(m_hWnd, (WNDPROC)&PluginWindowWin::_WinProc);
@@ -195,6 +196,12 @@ bool PluginWindowWin::WinProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
return true;
break;
}
+ case WM_ERASEBKGND:
+ {
+ if (getSuppressEraseBackground())
+ return 1;
+ return 0;
+ }
case WM_PAINT:
{
FB::Rect bounds = getWindowPosition();
View
11 src/PluginAuto/Win/PluginWindowWin.h
@@ -79,6 +79,16 @@ namespace FB {
boost::int16_t HandleEvent(NPEvent* evt) { return 0; }
virtual void InvalidateWindow() const;
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ /// @fn HWND PluginWindowWin::setSuppressEraseBackground(bool suppressEraseBackground)
+ ///
+ /// @brief Determines if a window background should be automatically erased (for example, when a window is resized).
+ ///
+ /// @return An application should set to true if it erases the background; otherwise, it should set to false (the default).
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual void setSuppressEraseBackground(bool suppressEraseBackground) { m_suppressEraseBackground = suppressEraseBackground; }
+ virtual bool getSuppressEraseBackground() { return m_suppressEraseBackground; }
+
protected:
static PluginWindowMap m_windowMap;
@@ -87,6 +97,7 @@ namespace FB {
bool m_callOldWinProc;
HWND m_hWnd;
HWND m_browserhWnd;
+ bool m_suppressEraseBackground;
virtual bool CustomWinProc(HWND hWnd,
UINT uMsg,
View
24 src/PluginAuto/X11/PluginWindowX11.cpp
@@ -12,8 +12,8 @@ License: Dual license model; choose one of two:
Copyright 2009 Richard Bateman, Firebreath development team
\**********************************************************/
-
#include "PluginEvents/X11Event.h"
+#include "PluginEvents/X11NativeGdkEvent.h"
#include "PluginEvents/GeneralEvents.h"
#include "PluginEvents/DrawingEvents.h"
#include "PluginEvents/MouseEvents.h"
@@ -317,10 +317,20 @@ gboolean PluginWindowX11::EventCallback(GtkWidget *widget, GdkEvent *event)
GdkNativeWindow PluginWindowX11::getWindow()
{
+ return GDK_WINDOW_XID(getWidgetWindow());
+//#if GTK_CHECK_VERSION(2, 14, 0)
+// return GDK_WINDOW_XID(gtk_widget_get_window(m_canvas));
+//#else
+// return GDK_WINDOW_XID(GTK_WIDGET(m_canvas)->window);
+//#endif
+}
+
+GdkWindow* PluginWindowX11::getWidgetWindow() const
+{
#if GTK_CHECK_VERSION(2, 14, 0)
- return GDK_WINDOW_XID(gtk_widget_get_window(m_canvas));
+ return (gtk_widget_get_window(m_canvas));
#else
- return GDK_WINDOW_XID(GTK_WIDGET(m_canvas)->window);
+ return (GTK_WIDGET(m_canvas)->window);
#endif
}
@@ -328,6 +338,10 @@ GdkNativeWindow PluginWindowX11::getWindow()
void PluginWindowX11::InvalidateWindow() const
{
- // Doesn't exist yet
+#if FB_GUI_DISABLED != 1
+ GdkWindow* gdkWindow = getWidgetWindow();
+ GdkRegion* gdkRegion = 0;
+ X11NativeGdkEventExpose expose(gdkWindow, gdkRegion, 0,0, m_width,m_height);
+ expose.SendEvent();
+#endif // FB_GUI_DISABLED != 1
}
-
View
1  src/PluginAuto/X11/PluginWindowX11.h
@@ -56,6 +56,7 @@ namespace FB {
public:
bool hasKeyboardFocus() const { return m_focus; }
GdkNativeWindow getWindow();
+ GdkWindow* getWidgetWindow() const;
GtkWidget* getWidget() { return m_canvas; }
void setBrowserWindow(GdkNativeWindow win) { m_browserWindow = win; }
GdkNativeWindow getBrowserWindow() { return m_browserWindow; }
View
4 src/PluginAuto/precompiled_headers.h
@@ -1,4 +1,6 @@
+#ifdef FB_USE_PCH
+
#if !defined(FB_UNITTEST)
#ifdef _WIN32
@@ -47,3 +49,5 @@
#endif
+
+#endif // FB_USE_PCH
View
258 src/PluginCore/BrowserStreamRequest.h
@@ -0,0 +1,258 @@
+/**********************************************************\
+Original Author: Richard Bateman (taxilian)
+
+Created: Sep 25, 2012
+License: Dual license model; choose one of two:
+ New BSD License
+ http://www.opensource.org/licenses/bsd-license.php
+ - or -
+ GNU Lesser General Public License, version 2.1
+ http://www.gnu.org/licenses/lgpl-2.1.html
+
+Copyright 2009 Richard Bateman, Firebreath development team
+\**********************************************************/
+#pragma once
+#ifndef BrowserStreamRequest_h__
+#define BrowserStreamRequest_h__
+
+#include "SimpleStreamHelper.h"
+#include <string>
+
+#define k_DEFAULT_REQUEST_BUFFER 128 * 1024
+
+namespace FB {
+
+ FB_FORWARD_PTR(PluginEventSink);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ /// @class BrowserStreamRequest
+ ///
+ /// @brief Information about an HTTP request to be made
+ ///
+ /// Use this class to make HTTP requests through the browser. Create the stream and then
+ /// call BrowserHost::createStream
+ ///
+ /// @see BrowserHost::createStream
+ /// @since 1.7
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ class BrowserStreamRequest
+ {
+ public:
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ /// @fn FB::BrowserStreamRequest::BrowserStreamRequest(const std::string& uri, const std::string method /*= "GET"*/, const bool accept /*= true*/);
+ ///
+ /// @brief Create a BrowserStreamRequest from a string containing the URI to call
+ ///
+ /// @param uri const std::string & The string containing the URI to request
+ /// @param method const std::string Defaults to "GET", can be "GET" or "POST"
+ /// @param accept const bool Used internally; can be safely omitted
+ ///
+ /// @author taxilian
+ /// @since 1.7
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ BrowserStreamRequest(const std::string& uri, const std::string method = "GET", const bool accept = true)
+ : uri(uri), method(method), accepted(accept), lastModified(0), seekable(false),
+ internalBufferSize(k_DEFAULT_REQUEST_BUFFER), cache(false)
+ {
+
+ }
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ /// @fn FB::BrowserStreamRequest::BrowserStreamRequest(const FB::URI& uri, const std::string method /*= "GET"*/, const bool accept /*= true*/);
+ ///
+ /// @brief Create a BrowserStreamRequest from a FB:URI object
+ ///
+ /// @param uri const FB::URI & FB::URI object containing the URI to be used for the request
+ /// @param method const std::string
+ /// @param accept const bool
+ ///
+ /// @author taxilian
+ /// @since 1.7
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ BrowserStreamRequest(const FB::URI& uri, const std::string method = "GET", const bool accept = true)
+ : uri(uri), method(method), accepted(accept), lastModified(0), seekable(false),
+ internalBufferSize(k_DEFAULT_REQUEST_BUFFER), cache(false)
+ {
+
+ }
+
+ FB::URI uri;
+ std::string method;
+ FB::HeaderMap headers;
+ uint32_t lastModified;
+ bool seekable;
+ size_t internalBufferSize;
+ bool cache;
+
+ private:
+ PluginEventSinkPtr sinkPtr;
+ HttpCallback callback;
+ bool accepted;
+ std::string postdata;
+ std::string postheaders;
+
+ public: // Helper methods
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ /// @fn void FB::BrowserStreamRequest::setSeekable(bool s);
+ ///
+ /// @brief Call with true to request that the stream be seekable; default is false
+ ///
+ /// @param s bool to indicate if it should be seekable
+ ///
+ /// @author taxilian
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ void setSeekable(bool s) { seekable = s; }
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ /// @fn void FB::BrowserStreamRequest::setCacheable(bool c);
+ ///
+ /// @brief Call with true to indicate that the browser's cache may be used for this request;
+ /// default is false. Currently only honored on ActiveX (IE)
+ ///
+ /// @param c bool to indicate if cache should be used
+ ///
+ /// @author taxilian
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ void setCacheable(bool c) { cache = c; }
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ /// @fn bool FB::BrowserStreamRequest::wasAccepted();
+ ///
+ /// @brief Returns true if the request was accepted; used internally. User-created
+ /// requests are accepted by default
+ ///
+ /// @author taxilian
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ bool wasAccepted() const { return accepted; }
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ /// @fn void FB::BrowserStreamRequest::addQueryData(const std::string& key, const std::string& val);
+ ///
+ /// @brief Add a GET querystring parameter (... &key=val ...)
+ ///
+ /// @param key const std::string & Key to add
+ /// @param val const std::string & Value to add
+ ///
+ /// @author taxilian
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ void addQueryData(const std::string& key, const std::string& val) {
+ uri.addQueryData(key, val);
+ }
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ /// @fn void FB::BrowserStreamRequest::setHeaders(const std::string& headers);
+ ///
+ /// @brief Used internally to set the headers on this object. Should not be called normally
+ ///
+ /// @param headers const std::string &
+ ///
+ /// @author taxilian
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ void setHeaders(const std::string& headers) {
+ this->headers = SimpleStreamHelper::parse_http_headers(headers);
+ }
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ /// @fn void FB::BrowserStreamRequest::setLastModified(uint32_t ts);
+ ///
+ /// @brief Used internally to set the lastmodified timestamp on the object
+ ///
+ /// @param ts uint32_t
+ ///
+ /// @author taxilian
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ void setLastModified(uint32_t ts) { lastModified = ts; }
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ /// @fn void FB::BrowserStreamRequest::setBufferSize(size_t size);
+ ///
+ /// @brief Call this to indicate the preferred internal buffer size of the BrowserStream object
+ ///
+ /// @param size size_t preferred size of the internal buffer
+ ///
+ /// @author taxilian
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ void setBufferSize(size_t size) { internalBufferSize = size; }
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ /// @fn void FB::BrowserStreamRequest::setEventSink(const PluginEventSinkPtr& ptr);
+ ///
+ /// @brief To use a PluginEventSink such as DefaultBrowserStreamHandler or a derivative
+ /// call this method to specify the object that should be attached to the stream
+ /// as an observer.
+ ///
+ /// This method cannot be used with setCallback. One or the other must be called or the request
+ /// will be ignored. If you need to receive data as it comes from the browser or a really large
+ /// file, use this method. If you just want to be notified when the download completes and
+ /// receive a byte buffer with the output data, use setCallback.
+ ///
+ /// @param ptr const PluginEventSinkPtr & observer for the stream object
+ ///
+ /// @author taxilian
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ void setEventSink(const PluginEventSinkPtr& ptr) { sinkPtr = ptr; accepted = true; }
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ /// @fn FB::PluginEventSinkPtr FB::BrowserStreamRequest::getEventSink();
+ ///
+ /// @brief Returns the PluginEventSink assigned to be the observer for the BrowserStream,
+ /// or a NULL BrowserStreamPtr if none
+ ///
+ /// @author taxilian
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ PluginEventSinkPtr getEventSink() const { return sinkPtr; }
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ /// @fn void FB::BrowserStreamRequest::setCallback(const HttpCallback& cb);
+ ///
+ /// @brief Call this method to provide a callback function that should be called when the
+ /// request completes.
+ ///
+ /// This method cannot be used with setEventSink. One or the other must be called or the request
+ /// will be ignored. If you need to receive data as it comes from the browser or a really large
+ /// file, use this method. If you just want to be notified when the download completes and
+ /// receive a byte buffer with the output data, use setCallback.
+ ///
+ /// In the case of an unsolicited stream, either this method or setEventSink *must* be called
+ /// in order to accept the stream.
+ ///
+ /// @param cb const HttpCallback &
+ ///
+ /// @author taxilian
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ void setCallback( const HttpCallback& cb ) { callback = cb; accepted = true; }
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ /// @fn FB::HttpCallback FB::BrowserStreamRequest::getCallback();
+ ///
+ /// @brief Returns the HttpCallback functor assigned to the object, or a NULL HttpCallback
+ /// if none
+ ///
+ /// @author taxilian
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ HttpCallback getCallback() const { return callback; }
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ /// @fn void FB::BrowserStreamRequest::setPostData(const std::string& data, const std::string& post_headers /*= ""*/);
+ ///
+ /// @brief Sets POST data for the request; only used if the type of the request is POST
+ ///
+ /// @param data const std::string & POST data to use. Should be in querystring format (var1=val&var2=val)
+ /// @param post_headers const std::string & HTTP POST headers to send; use only if you know what you're doing. Ignored on ActiveX
+ ///
+ /// @author taxilian
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ void setPostData(const std::string& data, const std::string& post_headers = "") { postdata = data; postheaders = post_headers; }
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ /// @fn std::string FB::BrowserStreamRequest::getPostData();
+ ///
+ /// @brief Returns POST data for the object, if any
+ ///
+ /// @author taxilian
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ std::string getPostData() const { return postdata; }
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ /// @fn std::string FB::BrowserStreamRequest::getPostHeaders();
+ ///
+ /// @brief Returns POST headers for the object, if any.
+ ///
+ /// @author taxilian
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ std::string getPostHeaders() const { return postheaders; }
+ };
+
+};
+
+#endif // BrowserStreamRequest_h__
View
19 src/PluginCore/DefaultBrowserStreamHandler.cpp
@@ -26,13 +26,30 @@ DefaultBrowserStreamHandler::~DefaultBrowserStreamHandler()
{
}
-bool DefaultBrowserStreamHandler::onStreamCreated(FB::StreamCreatedEvent *evt, FB::BrowserStream* Stream)
+bool DefaultBrowserStreamHandler::onStreamAttached( AttachedEvent *evt, FB::BrowserStream * Stream )
{
assert(Stream != NULL);
setStream( ptr_cast<BrowserStream>(Stream->shared_from_this()) );
return false;
}
+bool DefaultBrowserStreamHandler::onStreamDetached( DetachedEvent *evt, FB::BrowserStream * Stream )
+{
+ clearStream();
+ return false;
+}
+
+bool DefaultBrowserStreamHandler::cancel()
+{
+ FB::BrowserStreamPtr ptr(getStream());
+ return ptr && ptr->close();
+}
+
+bool DefaultBrowserStreamHandler::onStreamCreated(FB::StreamCreatedEvent *evt, FB::BrowserStream* Stream)
+{
+ return false;
+}
+
bool DefaultBrowserStreamHandler::onStreamDestroyed(FB::StreamDestroyedEvent *evt, FB::BrowserStream *)
{
clearStream();
View
33 src/PluginCore/DefaultBrowserStreamHandler.h
@@ -17,6 +17,7 @@ Copyright 2010 PacketPass, Inc and the Firebreath development team
\**********************************************************/
#include "BrowserStream.h"
+#include "PluginEvents/AttachedEvent.h"
namespace FB {
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -36,6 +37,8 @@ namespace FB {
{
public:
BEGIN_PLUGIN_EVENT_MAP()
+ EVENTTYPE_CASE(FB::AttachedEvent, onStreamAttached, FB::BrowserStream)
+ EVENTTYPE_CASE(FB::DetachedEvent, onStreamDetached, FB::BrowserStream)
EVENTTYPE_CASE(FB::StreamCreatedEvent, onStreamCreated, FB::BrowserStream)
EVENTTYPE_CASE(FB::StreamDestroyedEvent, onStreamDestroyed, FB::BrowserStream)
EVENTTYPE_CASE(FB::StreamFailedOpenEvent, onStreamFailedOpen, FB::BrowserStream)
@@ -64,6 +67,26 @@ namespace FB {
~DefaultBrowserStreamHandler();
////////////////////////////////////////////////////////////////////////////////////////////////////
+ /// @fn virtual bool onStreamAttached(FB:AttachedEvent *evt, FB::BrowserStream * Stream);
+ ///
+ /// @brief Called when the stream is attached to this handler (may have already been created).
+ ///
+ /// @author taxilian
+ /// @since 1.7
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual bool onStreamAttached(FB::AttachedEvent *evt, FB::BrowserStream * Stream);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ /// @fn virtual bool onStreamDetached(FB:AttachedEvent *evt, FB::BrowserStream * Stream);
+ ///
+ /// @brief Called when the stream is detached from this handler (may not have been destroyed).
+ ///
+ /// @author taxilian
+ /// @since 1.7
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual bool onStreamDetached(FB::DetachedEvent *evt, FB::BrowserStream * Stream);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn virtual bool DefaultBrowserStreamHandler::onStreamCreated(FB::StreamCreatedEvent *evt, FB::BrowserStream * Stream);
///
/// @brief Called when the stream was created.
@@ -126,6 +149,16 @@ namespace FB {
////////////////////////////////////////////////////////////////////////////////////////////////////
virtual const FB::BrowserStreamPtr& getStream() const;
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ /// @fn virtual bool FB::DefaultBrowserStreamHandler::cancel();
+ ///
+ /// @brief Cancels the stream
+ ///
+ /// @author taxilian
+ /// @since 1.7
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual bool cancel();
+
protected:
////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn virtual void DefaultBrowserStreamHandler::setStream(const FB::BrowserStreamPtr& stream);
View
8 src/PluginCore/PluginCore.cpp
@@ -95,6 +95,14 @@ boost::optional<std::string> PluginCore::getParam(const std::string& key) {
return rval;
}
+FB::variant FB::PluginCore::getParamVariant( const std::string& key )
+{
+ FB::VariantMap::const_iterator fnd = m_params.find(key.c_str());
+ if (fnd != m_params.end())
+ return fnd->second;
+ return FB::variant();
+}
+
// If you override this, you probably want to call it again, since this is what calls back into the page
// to indicate that we're done.
bool PluginCore::setReady()
View
32 src/PluginCore/PluginCore.h
@@ -17,6 +17,8 @@ Copyright 2009 PacketPass, Inc and the Firebreath development team
#define H_FB_PLUGINCORE
#include "PluginEventSink.h"
+#include "BrowserStream.h"
+#include "BrowserPlugin.h"
#include "APITypes.h"
#include <string>
#include <set>
@@ -29,6 +31,7 @@ namespace FB {
class PluginWindow;
class PluginEvent;
+ class BrowserStreamRequest;
FB_FORWARD_PTR(PluginCore);
FB_FORWARD_PTR(JSAPI);
FB_FORWARD_PTR(BrowserHost);
@@ -292,16 +295,16 @@ namespace FB {
virtual void setFSPath(const std::string& path) { m_filesystemPath = path; }
////////////////////////////////////////////////////////////////////////////////////////////////////
- /// @fn virtual std::string& getFSPath()
+ /// @fn static std::string getFSPath()
///
/// @brief Returns the path and filename of the current plugin module
///
/// On Windows, this returns the path to the plugin DLL file. On Mac, it's a .dylib. On linux a .so
///
/// @return Full pathname of the file.
- /// @since 1.4
+ /// @since 1.4 (in 1.7 it became static)
////////////////////////////////////////////////////////////////////////////////////////////////////
- virtual std::string& getFSPath() { return m_filesystemPath; }
+ static std::string getFSPath() { return BrowserPlugin::getFSPath(); }
////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn virtual void PluginCore::setParams(const FB::VariantMap& inParams)
@@ -319,15 +322,32 @@ namespace FB {
virtual void setParams(const FB::VariantMap& inParams);
virtual boost::optional<std::string> getParam(const std::string& key);
+ virtual FB::variant getParamVariant(const std::string& key);
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ /// @fn virtual bool PluginCore::handleUnsolicitedStream(const BrowserStreamRequest& req)
+ ///
+ /// @brief Called by the browser to handle an unsolicited BrowserStream
+ ///
+ /// If you wish to accept the request, you must call req.setEventSink() and pass in the
+ /// eventsink object you want to handle the new stream.
+ ///
+ /// @param req The browser request containing information about the unsolicited stream
+ /// @since 1.7.0
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ virtual void handleUnsolicitedStream(const BrowserStreamRequest& req) { }
+ public:
+ virtual BrowserHostPtr getHost() { return m_host; }
protected:
- /// The BrowserHost object for the current session
+ /// The BrowserHost object for the current session; deprecated, use getHost()
BrowserHostPtr m_host;
- /// Stores the value passed into setFSPath()
+ /// Stores the value passed into setFSPath(); deprecated, use getFSPath()
std::string m_filesystemPath;
/// Boolean value indicates if the browser has called setParams() yet or not
bool m_paramsSet;
- /// Stores the list of params provided by the browser to setParams()
+ /// Stores the list of params provided by the browser to setParams(); deprecated, use
+ /// getParam insead
FB::VariantMap m_params;
private:
/// Don't use directly; use GetWindow()
View
34 src/PluginCore/PluginEvents/X11NativeGdkEvent.cpp
@@ -0,0 +1,34 @@
+/**********************************************************\
+File: X11NativeGdkEvent.cpp
+
+Original Author: John Boyd (medusade)
+
+Created: 5/4/2012
+License: Dual license model; choose one of two:
+ New BSD License
+ http://www.opensource.org/licenses/bsd-license.php
+ - or -
+ GNU Lesser General Public License, version 2.1
+ http://www.gnu.org/licenses/lgpl-2.1.html
+
+Copyright John Boyd (medusade), Firebreath development team
+\**********************************************************/
+#include "X11NativeGdkEvent.h"
+
+namespace FB {
+
+///////////////////////////////////////////////////////////////////////
+/// @class X11NativeGdkEvent
+///
+/// @author John Boyd (medusade)
+/// @date 5/4/2012
+///////////////////////////////////////////////////////////////////////
+
+///////////////////////////////////////////////////////////////////////
+/// @class X11NativeGdkEventExpose
+///
+/// @author John Boyd (medusade)
+/// @date 5/4/2012
+///////////////////////////////////////////////////////////////////////
+
+} // namespace FB
View
89 src/PluginCore/PluginEvents/X11NativeGdkEvent.h
@@ -0,0 +1,89 @@
+/**********************************************************\
+File: X11NativeGdkEvent.h
+
+Original Author: John Boyd (medusade)
+
+Created: 5/4/2012
+License: Dual license model; choose one of two:
+ New BSD License
+ http://www.opensource.org/licenses/bsd-license.php
+ - or -
+ GNU Lesser General Public License, version 2.1
+ http://www.gnu.org/licenses/lgpl-2.1.html
+
+Copyright John Boyd (medusade), Firebreath development team
+\**********************************************************/
+#pragma once
+#ifndef H_FB_EVENTS_X11NATIVEGDKEVENT
+#define H_FB_EVENTS_X11NATIVEGDKEVENT
+
+#include <gdk/gdk.h>
+
+namespace FB {
+
+///////////////////////////////////////////////////////////////////////
+/// @class X11NativeGdkEvent
+///
+/// @author John Boyd (medusade)
+/// @date 5/4/2012
+///
+/// @brief Class encapsulation for native Gdk event
+///////////////////////////////////////////////////////////////////////
+class X11NativeGdkEvent
+{
+public:
+ GdkEvent m_gdkEvent;
+
+ X11NativeGdkEvent
+ (GdkWindow* window=0, GdkEventType type=GDK_NOTHING, gint8 send_event=TRUE)
+ {
+ m_gdkEvent.any.type = type;
+ m_gdkEvent.any.window = window;
+ m_gdkEvent.any.send_event = send_event;
+ }
+ bool SendEvent()
+ {
+ bool sent = false;
+ if ((sent = (m_gdkEvent.any.type != GDK_NOTHING) && (m_gdkEvent.any.window != 0)))
+ {
+ gdk_threads_enter();
+ gdk_event_put(&m_gdkEvent);
+ gdk_threads_leave();
+ }
+ return sent;
+ }
+ inline operator GdkEvent* () const
+ { return (GdkEvent*)(&m_gdkEvent); }
+};
+
+///////////////////////////////////////////////////////////////////////
+/// @class X11NativeGdkEventExpose
+///
+/// @author John Boyd (medusade)
+/// @date 5/4/2012
+///
+/// @brief Class encapsulation for native Gdk expose event
+///////////////////////////////////////////////////////////////////////
+class X11NativeGdkEventExpose: public X11NativeGdkEvent
+{
+public:
+ typedef X11NativeGdkEvent Extends;
+
+ X11NativeGdkEventExpose
+ (GdkWindow* window=0, GdkRegion* region=0,
+ int x=0, int y=0, int width=0, int height=0, int count=0,
+ GdkEventType type=GDK_EXPOSE, gint8 send_event=TRUE)
+ : Extends(window, type, send_event)
+ {
+ m_gdkEvent.expose.area.x = x;
+ m_gdkEvent.expose.area.y = y;
+ m_gdkEvent.expose.area.width = width;
+ m_gdkEvent.expose.area.height = height;
+ m_gdkEvent.expose.region = region;
+ m_gdkEvent.expose.count = count;
+ }
+};
+
+} // namespace FB
+
+#endif // H_FB_EVENTS_X11NATIVEGDKEVENT
View
84 src/PluginCore/SimpleStreamHelper.cpp
@@ -18,6 +18,7 @@ Copyright 2011 Richard Bateman,
#include <boost/bind.hpp>
#include "precompiled_headers.h" // On windows, everything above this line in PCH
+#include "BrowserStreamRequest.h"
#include "SimpleStreamHelper.h"
static const int MEGABYTE = 1024 * 1024;
@@ -25,34 +26,56 @@ static const int MEGABYTE = 1024 * 1024;
FB::SimpleStreamHelperPtr FB::SimpleStreamHelper::AsyncGet( const FB::BrowserHostPtr& host, const FB::URI& uri,
const HttpCallback& callback, bool cache /*= true*/, size_t bufferSize /*= 256*1024*/ )
{
+ BrowserStreamRequest req(uri, "GET");
+ req.setCallback(callback);
+ req.setBufferSize(bufferSize);
+ req.setCacheable(cache);
+ return AsyncRequest(host, req);
+}
+
+FB::SimpleStreamHelperPtr FB::SimpleStreamHelper::AsyncPost(const FB::BrowserHostPtr& host,
+ const FB::URI& uri,
+ const std::string& postdata,
+ const HttpCallback& callback,
+ bool cache /*= true*/,
+ size_t bufferSize /*= 256*1024*/ )
+{
+ BrowserStreamRequest req(uri, "POST");
+ req.setPostData(postdata);
+ req.setCallback(callback);
+ req.setBufferSize(bufferSize);
+ req.setCacheable(cache);
+ return AsyncRequest(host, req);
+}
+
+FB::SimpleStreamHelperPtr FB::SimpleStreamHelper::AsyncRequest( const FB::BrowserHostConstPtr& host,
+ const BrowserStreamRequest& req ) {
+ if (!req.getCallback()) {
+ throw std::runtime_error("Invalid callback");
+ }
if (!host->isMainThread()) {
// This must be run from the main thread
- return host->CallOnMainThread(boost::bind(&FB::SimpleStreamHelper::AsyncGet, host, uri, callback, cache, bufferSize));
+ return host->CallOnMainThread(boost::bind(&AsyncRequest, host, req));
}
- FB::SimpleStreamHelperPtr ptr(boost::make_shared<FB::SimpleStreamHelper>(callback, bufferSize));
- // This is kinda a weird trick; it's responsible for freeing itself, unless something decides
- // to hold a reference to it.
- ptr->keepReference(ptr);
- FB::BrowserStreamPtr stream(host->createStream(uri.toString(), ptr, cache, false, bufferSize));
- return ptr;
+ FB::BrowserStreamPtr stream(host->createStream(req, false));
+ return AsyncRequest(host, stream, req);
}
-FB::SimpleStreamHelperPtr FB::SimpleStreamHelper::AsyncPost( const FB::BrowserHostPtr& host, const FB::URI& uri, const std::string& postdata,
- const HttpCallback& callback, bool cache /*= true*/, size_t bufferSize /*= 256*1024*/ )
-{
+FB::SimpleStreamHelperPtr FB::SimpleStreamHelper::AsyncRequest( const FB::BrowserHostConstPtr& host,
+ const FB::BrowserStreamPtr& stream,
+ const BrowserStreamRequest& req ) {
if (!host->isMainThread()) {
// This must be run from the main thread
- return host->CallOnMainThread(boost::bind(&FB::SimpleStreamHelper::AsyncPost, host, uri, postdata, callback, cache, bufferSize));
+ return host->CallOnMainThread(boost::bind(&AsyncRequest, host, stream, req));
}
- FB::SimpleStreamHelperPtr ptr(boost::make_shared<FB::SimpleStreamHelper>(callback, bufferSize));
+ FB::SimpleStreamHelperPtr ptr(boost::make_shared<FB::SimpleStreamHelper>(req.getCallback(), req.internalBufferSize));
// This is kinda a weird trick; it's responsible for freeing itself, unless something decides
// to hold a reference to it.
ptr->keepReference(ptr);
- FB::BrowserStreamPtr stream(host->createPostStream(uri.toString(), ptr, postdata, cache, false, bufferSize));
+ stream->AttachObserver(ptr);
return ptr;
}
-
struct SyncHTTPHelper
{
public:
@@ -82,8 +105,8 @@ struct SyncHTTPHelper
FB::HttpStreamResponsePtr m_response;
};
-FB::HttpStreamResponsePtr FB::SimpleStreamHelper::SynchronousGet( const FB::BrowserHostPtr& host,
- const FB::URI& uri, const bool cache /*= true*/, const size_t bufferSize /*= 128*1024*/ )
+
+FB::HttpStreamResponsePtr FB::SimpleStreamHelper::SynchronousRequest( const FB::BrowserHostPtr& host, const BrowserStreamRequest& req )
{
// We can't ever block on the main thread, so SynchronousGet can't be called from there.
// Also, if you could block the main thread, that still wouldn't work because the request
@@ -92,7 +115,7 @@ FB::HttpStreamResponsePtr FB::SimpleStreamHelper::SynchronousGet( const FB::Brow
SyncHTTPHelper helper;
try {
FB::HttpCallback cb(boost::bind(&SyncHTTPHelper::getURLCallback, &helper, _1, _2, _3, _4));
- FB::SimpleStreamHelperPtr ptr = AsyncGet(host, uri, cb, cache, bufferSize);
+ FB::SimpleStreamHelperPtr ptr = AsyncRequest(host, req);
helper.setPtr(ptr);
helper.waitForDone();
} catch (const std::exception&) {
@@ -102,22 +125,23 @@ FB::HttpStreamResponsePtr FB::SimpleStreamHelper::SynchronousGet( const FB::Brow
return helper.m_response;
}
+FB::HttpStreamResponsePtr FB::SimpleStreamHelper::SynchronousGet( const FB::BrowserHostPtr& host,
+ const FB::URI& uri, const bool cache /*= true*/, const size_t bufferSize /*= 128*1024*/ )
+{
+ FB::BrowserStreamRequest req(uri, "GET");
+ req.setCacheable(cache);
+ req.setBufferSize(bufferSize);
+ return SynchronousRequest(host, req);
+}
+
FB::HttpStreamResponsePtr FB::SimpleStreamHelper::SynchronousPost( const FB::BrowserHostPtr& host,
const FB::URI& uri, const std::string& postdata, const bool cache /*= true*/, const size_t bufferSize /*= 128*1024*/ )
{
- // Do not call this on the main thread.
- assert(!host->isMainThread());
- SyncHTTPHelper helper;
- try {
- FB::HttpCallback cb(boost::bind(&SyncHTTPHelper::getURLCallback, &helper, _1, _2, _3, _4));
- FB::SimpleStreamHelperPtr ptr = AsyncPost(host, uri, postdata, cb, cache, bufferSize);
- helper.setPtr(ptr);
- helper.waitForDone();
- } catch (const std::exception&) {
- // If anything weird happens, just return NULL (to indicate failure)
- return FB::HttpStreamResponsePtr();
- }
- return helper.m_response;
+ FB::BrowserStreamRequest req(uri, "POST");
+ req.setCacheable(cache);
+ req.setBufferSize(bufferSize);
+ req.setPostData(postdata);
+ return SynchronousRequest(host, req);
}
FB::SimpleStreamHelper::SimpleStreamHelper( const HttpCallback& callback, const size_t blockSize )
View
51 src/PluginCore/SimpleStreamHelper.h
@@ -75,6 +75,39 @@ namespace FB {
{
public:
////////////////////////////////////////////////////////////////////////////////////////////////////
+ /// @fn static FB::SimpleStreamHelperPtr FB::SimpleStreamHelper::AsyncRequest(const BrowserHostConstPtr& host, const BrowserStreamRequest& req);
+ ///
+ /// @brief Creates an asynchronous HTTP request from the provided BrowserStreamRequest
+ ///
+ /// Using this method is basically the same as calling BrowserHost::createStream and providing
+ /// the same BrowserStreamRequest object. Note that a BrowserStreamRequest object passed to
+ /// this method *must* have a callback (see BrowserStreamRequest::setCallback)
+ ///
+ /// @param host const BrowserHostConstPtr &
+ /// @param req const BrowserStreamRequest &
+ ///
+ /// @author taxilian
+ /// @since 1.7
+ /// @see FB::BrowserStreamRequest:setCallback
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ static FB::SimpleStreamHelperPtr AsyncRequest( const BrowserHostConstPtr& host, const BrowserStreamRequest& req );
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ /// @fn static FB::SimpleStreamHelperPtr FB::SimpleStreamHelper::AsyncRequest(const BrowserHostConstPtr& host, const BrowserStreamPtr& stream, const BrowserStreamRequest& req);
+ ///
+ /// @brief Creates an asynchronous HTTP request from the provided BrowserStreamRequest and existing stream object
+ ///
+ /// This method is generally only used internally; it works on an existing (but not really started) stream object.
+ ///
+ /// @param host const BrowserHostConstPtr &
+ /// @param stream const BrowserStreamPtr &
+ /// @param req const BrowserStreamRequest &
+ ///
+ /// @author taxilian
+ /// @since 1.7
+ /// @see FB::BrowserStreamRequest:setCallback
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ static FB::SimpleStreamHelperPtr AsyncRequest( const BrowserHostConstPtr& host, const BrowserStreamPtr& stream, const BrowserStreamRequest& req );
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn public static FB::SimpleStreamHelperPtr FB::SimpleStreamHelper::AsyncGet(const FB::BrowserHostPtr& host, const FB::URI& uri, const HttpCallback& callback, const bool cache = true, const size_t bufferSize = 128*1024)
///
/// @brief Starts an asynchronous HTTP get request
@@ -111,6 +144,7 @@ namespace FB {
/// @since 1.4b3
/// @see SynchronousGet
/// @see FB::URI
+ /// @deprecated 1.7 use AsyncRequest
////////////////////////////////////////////////////////////////////////////////////////////////////
static FB::SimpleStreamHelperPtr AsyncGet(const FB::BrowserHostPtr& host, const FB::URI& uri, const HttpCallback& callback,
bool cache = true, size_t bufferSize = 128*1024);
@@ -154,6 +188,7 @@ namespace FB {
/// @since 1.4b3
/// @see SynchronousGet
/// @see FB::URI
+ /// @deprecated 1.7 use AsyncRequest
////////////////////////////////////////////////////////////////////////////////////////////////////
static FB::SimpleStreamHelperPtr AsyncPost(const FB::BrowserHostPtr& host, const FB::URI& uri, const std::string& postdata, const HttpCallback& callback,
bool cache = true, size_t bufferSize = 128*1024);
@@ -189,10 +224,24 @@ namespace FB {
/// @see AsyncGet
/// @see FB::URI
/// @see FB::HttpStreamResponse
+ /// @deprecated 1.7 use SynchronousRequest
////////////////////////////////////////////////////////////////////////////////////////////////////
static HttpStreamResponsePtr SynchronousGet(const FB::BrowserHostPtr& host, const FB::URI& uri,
const bool cache = true, const size_t bufferSize = 128*1024);
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ /// @fn static FB::HttpStreamResponsePtr FB::SimpleStreamHelper::SynchronousRequest(const FB::BrowserHostPtr& host, const BrowserStreamRequest& req);
+ ///
+ /// @brief Do not call from the main thread! Starts a Synchronous HTTP request
+ ///
+ /// @param host const FB::BrowserHostPtr & BrowserHost to use (m_host on the plugin object)
+ /// @param req const BrowserStreamRequest & BrowserStreamRequest describing the request to make;
+ /// should not have a callback or eventsink
+ ///
+ /// @author taxilian
+ /// @since 1.7
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ static HttpStreamResponsePtr SynchronousRequest(const FB::BrowserHostPtr& host, const BrowserStreamRequest& req );
////////////////////////////////////////////////////////////////////////////////////////////////////
/// @fn public static FB::HttpStreamResponsePtr FB::SimpleStreamHelper::SynchronousPost(const FB::BrowserHostPtr& host, const FB::URI& uri, const std::string& postdata, const bool cache = true, const size_t bufferSize = 128*1024)
@@ -225,6 +274,7 @@ namespace FB {
/// @see SynchronousGet
/// @see FB::URI
/// @see FB::HttpStreamResponse
+ /// @deprecated 1.7 use SynchronousRequest
////////////////////////////////////////////////////////////////////////////////////////////////////
static HttpStreamResponsePtr SynchronousPost(const FB::BrowserHostPtr& host, const FB::URI& uri, const std::string& postdata, const bool cache = true, const size_t bufferSize = 128*1024);
@@ -248,6 +298,7 @@ namespace FB {
private:
void keepReference(const SimpleStreamHelperPtr& ptr);
SimpleStreamHelperPtr self;
+ BrowserStreamPtr streamPtr;
};
};
#endif // SimpleStreamHelper_h__
View
2  src/PluginCore/Win/SystemHelpersWin.cpp
@@ -14,6 +14,8 @@ Copyright 2011 GradeCam, Inc and the Firebreath development team
#include "../SystemHelpers.h"
#include "shlobj.h"
+#include <cassert>
+#include "utf8_tools.h"
#ifndef REFKNOWNFOLDERID
typedef GUID KNOWNFOLDERID;
View
7 src/PluginCore/Win/SystemProxyDetectorWin.cpp
@@ -1,5 +1,12 @@
+#include "win_targetver.h"
+#include "win_common.h"
#include "Win/SystemProxyDetectorWin.h"
+#include <boost/scoped_ptr.hpp>
+#include <boost/scoped_array.hpp>
+#include <sstream>
+#include <URI.h>
+#include "logging.h"
#include "../precompiled_headers.h" // On windows, everything above this line in PCH
#include <boost/algorithm/string.hpp>
View
3  src/PluginCore/precompiled_headers.h
@@ -1,4 +1,6 @@
+#ifdef FB_USE_PCH
+
#ifdef _WIN32
#include "win_targetver.h"
#include <boost/asio.hpp>
@@ -55,3 +57,4 @@
#endif
#include "PluginInfo.h"
+#endif // FB_USE_PCH
View
41 src/ScriptingCore/BrowserHost.cpp
@@ -30,7 +30,9 @@ Copyright 2009 Richard Bateman, Firebreath development team
#include "precompiled_headers.h" // On windows, everything above this line in PCH
#include "BrowserHost.h"