2014-10-16 36 views
0

如何將多個MIMEType添加到我的FireBreath插件以及插件如何響應多個MIMEType。我曾嘗試在Pluginconfig.cmake中添加一個額外的字符串到集(FBSTRING_MIMEType「application/x-testplugin」「application/x-test-plugin」)並運行失敗的prepmac腳本。在這方面請幫助我。FireBreath多個MIMETypes

回答

1

MULTIMIME_NOTES.txt在FireBreath回購:

Modified original FBTestPlugin as follows to support multiple mimetypes 
in a single codebase: 

1. Edit PluginConfig.cmake, add multiple entries for the following 
    entries: FBSTRING_MIMEType, ACTIVEX_PROGID, FBControl_GUID, and 
    FBSTRING_PluginDescription. Make sure that you provide unique values for 
    all entries, including the GUIDs in FBControl_GUID. 

2. Edit Factory.cpp, modify PluginFactory::createPlugin() and add code 
    to check mimetype and create the appropriate object. Also add 
    "mimetype" as a parameter to 
    "boost::make_shared<FBTestPlugin>(mimetype)". The new code can construct 
    the "standard" FBTestPlugin plugin, or a new "SimpleMath" plugin from 
    either the FBTestPlugin or FBTestMathPlugin C++ objects. 

3. In FBTestPlugin.h, modify the FBTestPlugin constructor to take 
    "const std::string& mimetype" as an argument. Add "std::string 
    m_mimetype;" as a private variable to FBTestPlugin. 

4. In FBTestPlugin.cpp, modify the FBTestPlugin constructor to take 
    "const std::string& mimetype" as an argument and to set m_mimetype from 
    the mimetype parameter. Modify createJSAPI() to return 
    "boost::make_shared<SimpleMathAPI>(m_host)" 
    instead of 
     "boost::make_shared<FBTestPluginAPI>(FB::ptr_cast<FBTestPlugin>(shared_from_this()), m_host)" 
    depending on the mimetype. Include "SimpleMath.h". 
    Modify the plugin text in the drawing code depending on the mimetype for visual feedback to user. 

5. Modify SimpleMathAPI.h and SimpleMathAPI.cpp to add "self" property 
    and "GetSelf()" method, both of which return shared_from_this(). 

6. Copy FBTestPlugin.* to FBTestMathPlugin.* and change object name. 
    Simplify FBTestMathPlugin by removing the LeakFinder. Modify 
    createJSAPI() to return only the SimpleMathAPI object. Modify the 
    plugin text in the drawing code for visual feedback to user. 

7. Modified test code in test.html to test multiple mimetypes. Create 
    three plugins, and test math functions using all three. 
+1

工作就像一個魅力.. !!謝謝 :) – devdev 2014-10-17 06:23:18