Merge revision 600 changes:

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

git-svn-id: https://chromiumembedded.googlecode.com/svn/branches/1025@601 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2012-04-20 21:15:58 +00:00
parent 77a340ec9c
commit b1f9c5428c
18 changed files with 739 additions and 0 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 "include/cef_web_urlrequest.h"
#include "cefclient/cefclient_switches.h"
#include "cefclient/client_handler.h"
@ -65,6 +66,46 @@ void UIT_InvokeScript(CefRefPtr<CefBrowser> browser) {
}
}
void UIT_RunPluginInfoTest(CefRefPtr<CefBrowser> browser) {
std::string html = "<html><head><title>Plugin Info Test</title></head><body>";
// Find the flash plugin first to test that get by name works.
std::string flash_name;
CefRefPtr<CefWebPluginInfo> info = CefGetWebPluginInfo("Shockwave Flash");
if (info.get()) {
flash_name = info->GetName();
html += "\n<b>Flash is installed!</b>"
"<br/>Name: " + flash_name +
"\n<br/>Description: " + info->GetDescription().ToString() +
"\n<br/>Version: " + info->GetVersion().ToString() +
"\n<br/>Path: " + info->GetPath().ToString();
}
if (!flash_name.empty()) {
html += "\n<br/><br/><b>Other installed plugins:</b>";
} else {
html += "\n<b>Installed plugins:</b>";
}
// Display all other plugins.
size_t count = CefGetWebPluginCount();
for (size_t i = 0; i < count; ++i) {
CefRefPtr<CefWebPluginInfo> info = CefGetWebPluginInfo(i);
ASSERT(info.get());
if (!flash_name.empty() && info->GetName() == flash_name)
continue;
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();
}
html += "</body></html>";
browser->GetMainFrame()->LoadString(html, "http://tests/plugin_info");
}
// Return the int representation of the specified string.
int GetIntValue(const CefString& str) {
if (str.empty())
@ -601,3 +642,13 @@ void RunDragDropTest(CefRefPtr<CefBrowser> browser) {
void RunModalDialogTest(CefRefPtr<CefBrowser> browser) {
browser->GetMainFrame()->LoadURL("http://tests/modalmain");
}
void RunPluginInfoTest(CefRefPtr<CefBrowser> browser) {
if (CefCurrentlyOn(TID_UI)) {
UIT_RunPluginInfoTest(browser);
} else {
// Execute on the UI thread.
CefPostTask(TID_UI,
NewCefRunnableFunction(&UIT_RunPluginInfoTest, browser));
}
}