Add ability to directly retrieve plugin information (issue #575).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@609 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2012-04-27 19:12:01 +00:00
parent 9017c0e74e
commit 4fe0ddf640
22 changed files with 847 additions and 1 deletions

View File

@ -12,6 +12,7 @@
#include "include/cef_command_line.h"
#include "include/cef_frame.h"
#include "include/cef_runnable.h"
#include "include/cef_web_plugin.h"
#include "cefclient/client_handler.h"
#include "cefclient/client_switches.h"
#include "cefclient/string_util.h"
@ -326,6 +327,39 @@ void RunDialogTest(CefRefPtr<CefBrowser> browser) {
browser->GetMainFrame()->LoadURL("http://tests/dialogs");
}
void RunPluginInfoTest(CefRefPtr<CefBrowser> browser) {
class Visitor : public CefWebPluginInfoVisitor {
public:
explicit Visitor(CefRefPtr<CefBrowser> browser)
: browser_(browser) {
html_ = "<html><head><title>Plugin Info Test</title></head><body>"
"\n<b>Installed plugins:</b>";
}
~Visitor() {
html_ += "\n</body></html>";
// Load the html in the browser.
browser_->GetMainFrame()->LoadString(html_, "http://tests/plugin_info");
}
virtual bool Visit(CefRefPtr<CefWebPluginInfo> info, int count, int total)
OVERRIDE {
html_ += "\n<br/><br/>Name: " + info->GetName().ToString() +
"\n<br/>Description: " + info->GetDescription().ToString() +
"\n<br/>Version: " + info->GetVersion().ToString() +
"\n<br/>Path: " + info->GetPath().ToString();
return true;
}
private:
std::string html_;
CefRefPtr<CefBrowser> browser_;
IMPLEMENT_REFCOUNTING(Visitor);
};
CefVisitWebPluginInfo(new Visitor(browser));
}
void RunLocalStorageTest(CefRefPtr<CefBrowser> browser) {
browser->GetMainFrame()->LoadURL("http://tests/localstorage");
}