Merge revision 600 changes:

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

git-svn-id: https://chromiumembedded.googlecode.com/svn/branches/963@601 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2012-04-20 21:15:58 +00:00
parent dacb86d363
commit 1707bb75e5
18 changed files with 665 additions and 0 deletions

View File

@ -520,6 +520,8 @@
'libcef_dll/cpptoc/v8exception_cpptoc.h',
'libcef_dll/cpptoc/v8value_cpptoc.cc',
'libcef_dll/cpptoc/v8value_cpptoc.h',
'libcef_dll/cpptoc/web_plugin_info_cpptoc.cc',
'libcef_dll/cpptoc/web_plugin_info_cpptoc.h',
'libcef_dll/cpptoc/web_urlrequest_cpptoc.cc',
'libcef_dll/cpptoc/web_urlrequest_cpptoc.h',
'libcef_dll/cpptoc/xml_reader_cpptoc.cc',
@ -869,6 +871,7 @@
'libcef/tracker.h',
'libcef/v8_impl.cc',
'libcef/v8_impl.h',
'libcef/web_plugin_impl.cc',
'libcef/web_urlrequest_impl.cc',
'libcef/web_urlrequest_impl.h',
'libcef/webview_host.cc',

View File

@ -227,6 +227,8 @@
'libcef_dll/ctocpp/v8exception_ctocpp.h',
'libcef_dll/ctocpp/v8value_ctocpp.cc',
'libcef_dll/ctocpp/v8value_ctocpp.h',
'libcef_dll/ctocpp/web_plugin_info_ctocpp.cc',
'libcef_dll/ctocpp/web_plugin_info_ctocpp.h',
'libcef_dll/ctocpp/web_urlrequest_ctocpp.cc',
'libcef_dll/ctocpp/web_urlrequest_ctocpp.h',
'libcef_dll/ctocpp/xml_reader_ctocpp.cc',

View File

@ -81,6 +81,7 @@ class CefTask;
class CefV8Context;
class CefV8Handler;
class CefV8Value;
class CefWebPluginInfo;
class CefWebURLRequest;
class CefWebURLRequestClient;
@ -416,6 +417,27 @@ bool CefDeleteStorage(CefStorageType type, const CefString& origin,
/*--cef(optional_param=path)--*/
bool CefSetStoragePath(CefStorageType type, const CefString& path);
///
// Returns the number of installed web plugins. This method must be called on
// the UI thread.
///
/*--cef()--*/
size_t CefGetWebPluginCount();
///
// Returns information for web plugin at the specified zero-based index. This
// method must be called on the UI thread.
///
/*--cef()--*/
CefRefPtr<CefWebPluginInfo> CefGetWebPluginInfo(int index);
///
// Returns information for web plugin with the specified name. This method must
// be called on the UI thread.
///
/*--cef(capi_name=cef_get_web_plugin_info_byname)--*/
CefRefPtr<CefWebPluginInfo> CefGetWebPluginInfo(const CefString& name);
///
// Interface defining the reference count implementation methods. All framework
@ -4047,5 +4069,36 @@ public:
};
///
// Information about a specific web plugin.
///
/*--cef(source=library)--*/
class CefWebPluginInfo : public virtual CefBase
{
public:
///
// Returns the plugin name (i.e. Flash).
///
/*--cef()--*/
virtual CefString GetName() =0;
///
// Returns the plugin file path (DLL/bundle/library).
///
/*--cef()--*/
virtual CefString GetPath() =0;
///
// Returns the version of the plugin (may be OS-specific).
///
/*--cef()--*/
virtual CefString GetVersion() =0;
///
// Returns a description of the plugin from the version information.
///
/*--cef()--*/
virtual CefString GetDescription() =0;
};
#endif // _CEF_H

View File

@ -350,6 +350,25 @@ CEF_EXPORT int cef_delete_storage(enum cef_storage_type_t type,
CEF_EXPORT int cef_set_storage_path(enum cef_storage_type_t type,
const cef_string_t* path);
///
// Returns the number of installed web plugins. This function must be called on
// the UI thread.
///
CEF_EXPORT size_t cef_get_web_plugin_count();
///
// Returns information for web plugin at the specified zero-based index. This
// function must be called on the UI thread.
///
CEF_EXPORT struct _cef_web_plugin_info_t* cef_get_web_plugin_info(int index);
///
// Returns information for web plugin with the specified name. This function
// must be called on the UI thread.
///
CEF_EXPORT struct _cef_web_plugin_info_t* cef_get_web_plugin_info_byname(
const cef_string_t* name);
typedef struct _cef_base_t
{
// Size of the data structure.
@ -3835,6 +3854,45 @@ typedef struct _cef_command_line_t
CEF_EXPORT cef_command_line_t* cef_command_line_create();
///
// Information about a specific web plugin.
///
typedef struct _cef_web_plugin_info_t
{
// Base structure.
cef_base_t base;
///
// Returns the plugin name (i.e. Flash).
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_name)(
struct _cef_web_plugin_info_t* self);
///
// Returns the plugin file path (DLL/bundle/library).
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_path)(
struct _cef_web_plugin_info_t* self);
///
// Returns the version of the plugin (may be OS-specific).
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_version)(
struct _cef_web_plugin_info_t* self);
///
// Returns a description of the plugin from the version information.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_description)(
struct _cef_web_plugin_info_t* self);
} cef_web_plugin_info_t;
#ifdef __cplusplus
}
#endif

105
libcef/web_plugin_impl.cc Normal file
View File

@ -0,0 +1,105 @@
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#include "include/cef.h"
#include "libcef/cef_context.h"
#include "libcef/cef_thread.h"
#include "base/file_path.h"
#include "base/string_util.h"
#include "webkit/plugins/npapi/plugin_list.h"
namespace {
class CefWebPluginInfoImpl : public CefWebPluginInfo {
public:
explicit CefWebPluginInfoImpl(const webkit::WebPluginInfo& plugin_info)
: plugin_info_(plugin_info) {
}
virtual CefString GetName() OVERRIDE {
return plugin_info_.name;
}
virtual CefString GetPath() OVERRIDE {
return plugin_info_.path.value();
}
virtual CefString GetVersion() OVERRIDE {
return plugin_info_.version;
}
virtual CefString GetDescription() OVERRIDE {
return plugin_info_.desc;
}
private:
webkit::WebPluginInfo plugin_info_;
IMPLEMENT_REFCOUNTING(CefWebPluginInfoImpl);
};
} // namespace
size_t CefGetWebPluginCount() {
if (!CONTEXT_STATE_VALID()) {
NOTREACHED() << "context not valid";
return 0;
}
if (!CefThread::CurrentlyOn(CefThread::UI)) {
NOTREACHED() << "called on invalid thread";
return 0;
}
std::vector<webkit::WebPluginInfo> plugins;
webkit::npapi::PluginList::Singleton()->GetPlugins(&plugins);
return plugins.size();
}
CefRefPtr<CefWebPluginInfo> CefGetWebPluginInfo(int index) {
if (!CONTEXT_STATE_VALID()) {
NOTREACHED() << "context not valid";
return 0;
}
if (!CefThread::CurrentlyOn(CefThread::UI)) {
NOTREACHED() << "called on invalid thread";
return 0;
}
std::vector<webkit::WebPluginInfo> plugins;
webkit::npapi::PluginList::Singleton()->GetPlugins(&plugins);
if (index < 0 || index >= static_cast<int>(plugins.size()))
return NULL;
return new CefWebPluginInfoImpl(plugins[index]);
}
CefRefPtr<CefWebPluginInfo> CefGetWebPluginInfo(const CefString& name) {
if (!CONTEXT_STATE_VALID()) {
NOTREACHED() << "context not valid";
return 0;
}
if (!CefThread::CurrentlyOn(CefThread::UI)) {
NOTREACHED() << "called on invalid thread";
return 0;
}
std::vector<webkit::WebPluginInfo> plugins;
webkit::npapi::PluginList::Singleton()->GetPlugins(&plugins);
std::string nameStr = name;
StringToLowerASCII(&nameStr);
std::vector<webkit::WebPluginInfo>::const_iterator it = plugins.begin();
for (; it != plugins.end(); ++it) {
if (LowerCaseEqualsASCII(it->name, nameStr.c_str()))
return new CefWebPluginInfoImpl(*it);
}
return NULL;
}

View File

@ -0,0 +1,103 @@
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/cpptoc/web_plugin_info_cpptoc.h"
// MEMBER FUNCTIONS - Body may be edited by hand.
cef_string_userfree_t CEF_CALLBACK web_plugin_info_get_name(
struct _cef_web_plugin_info_t* self)
{
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefString _retval = CefWebPluginInfoCppToC::Get(self)->GetName();
// Return type: string
return _retval.DetachToUserFree();
}
cef_string_userfree_t CEF_CALLBACK web_plugin_info_get_path(
struct _cef_web_plugin_info_t* self)
{
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefString _retval = CefWebPluginInfoCppToC::Get(self)->GetPath();
// Return type: string
return _retval.DetachToUserFree();
}
cef_string_userfree_t CEF_CALLBACK web_plugin_info_get_version(
struct _cef_web_plugin_info_t* self)
{
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefString _retval = CefWebPluginInfoCppToC::Get(self)->GetVersion();
// Return type: string
return _retval.DetachToUserFree();
}
cef_string_userfree_t CEF_CALLBACK web_plugin_info_get_description(
struct _cef_web_plugin_info_t* self)
{
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefString _retval = CefWebPluginInfoCppToC::Get(self)->GetDescription();
// Return type: string
return _retval.DetachToUserFree();
}
// CONSTRUCTOR - Do not edit by hand.
CefWebPluginInfoCppToC::CefWebPluginInfoCppToC(CefWebPluginInfo* cls)
: CefCppToC<CefWebPluginInfoCppToC, CefWebPluginInfo,
cef_web_plugin_info_t>(cls)
{
struct_.struct_.get_name = web_plugin_info_get_name;
struct_.struct_.get_path = web_plugin_info_get_path;
struct_.struct_.get_version = web_plugin_info_get_version;
struct_.struct_.get_description = web_plugin_info_get_description;
}
#ifndef NDEBUG
template<> long CefCppToC<CefWebPluginInfoCppToC, CefWebPluginInfo,
cef_web_plugin_info_t>::DebugObjCt = 0;
#endif

View File

@ -0,0 +1,37 @@
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#ifndef _WEBPLUGININFO_CPPTOC_H
#define _WEBPLUGININFO_CPPTOC_H
#ifndef BUILDING_CEF_SHARED
#pragma message("Warning: "__FILE__" may be accessed DLL-side only")
#else // BUILDING_CEF_SHARED
#include "include/cef.h"
#include "include/cef_capi.h"
#include "libcef_dll/cpptoc/cpptoc.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed DLL-side only.
class CefWebPluginInfoCppToC
: public CefCppToC<CefWebPluginInfoCppToC, CefWebPluginInfo,
cef_web_plugin_info_t>
{
public:
CefWebPluginInfoCppToC(CefWebPluginInfo* cls);
virtual ~CefWebPluginInfoCppToC() {}
};
#endif // BUILDING_CEF_SHARED
#endif // _WEBPLUGININFO_CPPTOC_H

View File

@ -0,0 +1,91 @@
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/ctocpp/web_plugin_info_ctocpp.h"
// VIRTUAL METHODS - Body may be edited by hand.
CefString CefWebPluginInfoCToCpp::GetName()
{
if (CEF_MEMBER_MISSING(struct_, get_name))
return CefString();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_string_userfree_t _retval = struct_->get_name(struct_);
// Return type: string
CefString _retvalStr;
_retvalStr.AttachToUserFree(_retval);
return _retvalStr;
}
CefString CefWebPluginInfoCToCpp::GetPath()
{
if (CEF_MEMBER_MISSING(struct_, get_path))
return CefString();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_string_userfree_t _retval = struct_->get_path(struct_);
// Return type: string
CefString _retvalStr;
_retvalStr.AttachToUserFree(_retval);
return _retvalStr;
}
CefString CefWebPluginInfoCToCpp::GetVersion()
{
if (CEF_MEMBER_MISSING(struct_, get_version))
return CefString();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_string_userfree_t _retval = struct_->get_version(struct_);
// Return type: string
CefString _retvalStr;
_retvalStr.AttachToUserFree(_retval);
return _retvalStr;
}
CefString CefWebPluginInfoCToCpp::GetDescription()
{
if (CEF_MEMBER_MISSING(struct_, get_description))
return CefString();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_string_userfree_t _retval = struct_->get_description(struct_);
// Return type: string
CefString _retvalStr;
_retvalStr.AttachToUserFree(_retval);
return _retvalStr;
}
#ifndef NDEBUG
template<> long CefCToCpp<CefWebPluginInfoCToCpp, CefWebPluginInfo,
cef_web_plugin_info_t>::DebugObjCt = 0;
#endif

View File

@ -0,0 +1,45 @@
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#ifndef _WEBPLUGININFO_CTOCPP_H
#define _WEBPLUGININFO_CTOCPP_H
#ifndef USING_CEF_SHARED
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
#else // USING_CEF_SHARED
#include "include/cef.h"
#include "include/cef_capi.h"
#include "libcef_dll/ctocpp/ctocpp.h"
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed wrapper-side only.
class CefWebPluginInfoCToCpp
: public CefCToCpp<CefWebPluginInfoCToCpp, CefWebPluginInfo,
cef_web_plugin_info_t>
{
public:
CefWebPluginInfoCToCpp(cef_web_plugin_info_t* str)
: CefCToCpp<CefWebPluginInfoCToCpp, CefWebPluginInfo,
cef_web_plugin_info_t>(str) {}
virtual ~CefWebPluginInfoCToCpp() {}
// CefWebPluginInfo methods
virtual CefString GetName() OVERRIDE;
virtual CefString GetPath() OVERRIDE;
virtual CefString GetVersion() OVERRIDE;
virtual CefString GetDescription() OVERRIDE;
};
#endif // USING_CEF_SHARED
#endif // _WEBPLUGININFO_CTOCPP_H

View File

@ -27,6 +27,7 @@
#include "libcef_dll/cpptoc/v8context_cpptoc.h"
#include "libcef_dll/cpptoc/v8exception_cpptoc.h"
#include "libcef_dll/cpptoc/v8value_cpptoc.h"
#include "libcef_dll/cpptoc/web_plugin_info_cpptoc.h"
#include "libcef_dll/cpptoc/web_urlrequest_cpptoc.h"
#include "libcef_dll/cpptoc/xml_reader_cpptoc.h"
#include "libcef_dll/cpptoc/zip_reader_cpptoc.h"
@ -143,6 +144,7 @@ CEF_EXPORT void cef_shutdown()
DCHECK(CefV8ExceptionCppToC::DebugObjCt == 0);
DCHECK(CefV8HandlerCToCpp::DebugObjCt == 0);
DCHECK(CefV8ValueCppToC::DebugObjCt == 0);
DCHECK(CefWebPluginInfoCppToC::DebugObjCt == 0);
DCHECK(CefWebURLRequestClientCToCpp::DebugObjCt == 0);
DCHECK(CefWebURLRequestCppToC::DebugObjCt == 0);
DCHECK(CefWriteHandlerCToCpp::DebugObjCt == 0);
@ -543,3 +545,47 @@ CEF_EXPORT int cef_set_storage_path(enum cef_storage_type_t type,
}
CEF_EXPORT size_t cef_get_web_plugin_count()
{
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
size_t _retval = CefGetWebPluginCount();
// Return type: simple
return _retval;
}
CEF_EXPORT struct _cef_web_plugin_info_t* cef_get_web_plugin_info(int index)
{
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
CefRefPtr<CefWebPluginInfo> _retval = CefGetWebPluginInfo(
index);
// Return type: refptr_same
return CefWebPluginInfoCppToC::Wrap(_retval);
}
CEF_EXPORT struct _cef_web_plugin_info_t* cef_get_web_plugin_info_byname(
const cef_string_t* name)
{
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: name; type: string_byref_const
DCHECK(name);
if (!name)
return NULL;
// Execute
CefRefPtr<CefWebPluginInfo> _retval = CefGetWebPluginInfo(
CefString(name));
// Return type: refptr_same
return CefWebPluginInfoCppToC::Wrap(_retval);
}

View File

@ -58,6 +58,7 @@
#include "libcef_dll/ctocpp/v8context_ctocpp.h"
#include "libcef_dll/ctocpp/v8exception_ctocpp.h"
#include "libcef_dll/ctocpp/v8value_ctocpp.h"
#include "libcef_dll/ctocpp/web_plugin_info_ctocpp.h"
#include "libcef_dll/ctocpp/web_urlrequest_ctocpp.h"
#include "libcef_dll/ctocpp/xml_reader_ctocpp.h"
#include "libcef_dll/ctocpp/zip_reader_ctocpp.h"
@ -145,6 +146,7 @@ CEF_GLOBAL void CefShutdown()
DCHECK(CefV8ExceptionCToCpp::DebugObjCt == 0);
DCHECK(CefV8HandlerCppToC::DebugObjCt == 0);
DCHECK(CefV8ValueCToCpp::DebugObjCt == 0);
DCHECK(CefWebPluginInfoCToCpp::DebugObjCt == 0);
DCHECK(CefWebURLRequestCToCpp::DebugObjCt == 0);
DCHECK(CefWebURLRequestClientCppToC::DebugObjCt == 0);
DCHECK(CefWriteHandlerCppToC::DebugObjCt == 0);
@ -510,3 +512,47 @@ CEF_GLOBAL bool CefSetStoragePath(CefStorageType type, const CefString& path)
}
CEF_GLOBAL size_t CefGetWebPluginCount()
{
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
size_t _retval = cef_get_web_plugin_count();
// Return type: simple
return _retval;
}
CEF_GLOBAL CefRefPtr<CefWebPluginInfo> CefGetWebPluginInfo(int index)
{
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_web_plugin_info_t* _retval = cef_get_web_plugin_info(
index);
// Return type: refptr_same
return CefWebPluginInfoCToCpp::Wrap(_retval);
}
CEF_GLOBAL CefRefPtr<CefWebPluginInfo> CefGetWebPluginInfo(
const CefString& name)
{
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: name; type: string_byref_const
DCHECK(!name.empty());
if (name.empty())
return NULL;
// Execute
cef_web_plugin_info_t* _retval = cef_get_web_plugin_info_byname(
name.GetStruct());
// Return type: refptr_same
return CefWebPluginInfoCToCpp::Wrap(_retval);
}

View File

@ -63,6 +63,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)
{
@ -628,3 +668,13 @@ 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));
}
}

View File

@ -45,6 +45,7 @@ void RunWebURLRequestTest(CefRefPtr<CefBrowser> browser);
void RunDOMAccessTest(CefRefPtr<CefBrowser> browser);
void RunDragDropTest(CefRefPtr<CefBrowser> browser);
void RunModalDialogTest(CefRefPtr<CefBrowser> browser);
void RunPluginInfoTest(CefRefPtr<CefBrowser> browser);
#if defined(OS_WIN)
void RunTransparentPopupTest(CefRefPtr<CefBrowser> browser);

View File

@ -79,6 +79,7 @@ BEGIN
MENUITEM "JavaScript Execute", ID_TESTS_JAVASCRIPT_EXECUTE
MENUITEM "JavaScript Invoke", ID_TESTS_JAVASCRIPT_INVOKE
MENUITEM "Plugin", ID_TESTS_PLUGIN
MENUITEM "Plugin Info", ID_TESTS_PLUGIN_INFO
MENUITEM "Popup Window", ID_TESTS_POPUP
MENUITEM "Transparent Popup Window", ID_TESTS_TRANSPARENT_POPUP
MENUITEM "Request", ID_TESTS_REQUEST

View File

@ -204,6 +204,14 @@ gboolean ShowDevtoolsActivated(GtkWidget* widget) {
return FALSE; // Don't stop this message.
}
// Callback for Debug > Plugin Info... menu item.
gboolean PluginInfoActivated(GtkWidget* widget) {
if(g_handler.get() && g_handler->GetBrowserHwnd())
RunPluginInfoTest(g_handler->GetBrowser());
return FALSE; // Don't stop this message.
}
// Callback for when you click the back button.
void BackButtonClicked(GtkButton* button) {
if (g_handler.get() && g_handler->GetBrowserHwnd())
@ -299,6 +307,8 @@ GtkWidget* CreateMenuBar() {
G_CALLBACK(DragDropActivated));
AddMenuEntry(debug_menu, "Show DevTools",
G_CALLBACK(ShowDevtoolsActivated));
AddMenuEntry(debug_menu, "Plugin Info",
G_CALLBACK(PluginInfoActivated));
return menu_bar;
}

View File

@ -208,6 +208,7 @@ NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) {
- (IBAction)testZoomReset:(id)sender;
- (IBAction)testDevToolsShow:(id)sender;
- (IBAction)testDevToolsClose:(id)sender;
- (IBAction)testPluginInfo:(id)sender;
@end
@implementation ClientAppDelegate
@ -298,6 +299,9 @@ NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) {
[testMenu addItemWithTitle:@"Close DevTools"
action:@selector(testDevToolsClose:)
keyEquivalent:@""];
[testMenu addItemWithTitle:@"Plugin Info"
action:@selector(testPluginInfo:)
keyEquivalent:@""];
[testItem setSubmenu:testMenu];
[menubar addItem:testItem];
@ -519,6 +523,11 @@ NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) {
}
}
- (IBAction)testPluginInfo:(id)sender {
if(g_handler.get() && g_handler->GetBrowserHwnd())
RunPluginInfoTest(g_handler->GetBrowser());
}
// Sent by the default notification center immediately before the application
// terminates.
- (void)applicationWillTerminate:(NSNotification *)aNotification {

View File

@ -484,6 +484,10 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
if(browser.get())
RunPluginTest(browser);
return 0;
case ID_TESTS_PLUGIN_INFO: // Test plugin info
if(browser.get())
RunPluginInfoTest(browser);
return 0;
case ID_TESTS_POPUP: // Test a popup window
if(browser.get())
RunPopupTest(browser);

View File

@ -57,6 +57,7 @@
#define ID_TESTS_TRANSPARENT_OSRAPP 32797
#define ID_TESTS_JAVASCRIPT_INVOKE 32798
#define ID_TESTS_GETIMAGE 32799
#define ID_TESTS_PLUGIN_INFO 32800
#define IDC_STATIC -1
#define IDS_LOGO 1000
#define IDS_UIPLUGIN 1001