Add CefContextMenuParams::GetTitleText method (issue #2030)

This commit is contained in:
Marshall Greenblatt 2017-01-17 12:43:49 -05:00
parent 8b2618a72a
commit d6fc4a4c16
7 changed files with 54 additions and 0 deletions

View File

@ -192,6 +192,14 @@ typedef struct _cef_context_menu_params_t {
int (CEF_CALLBACK *has_image_contents)(
struct _cef_context_menu_params_t* self);
///
// Returns the title text or the alt text if the context menu was invoked on
// an image.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_title_text)(
struct _cef_context_menu_params_t* self);
///
// Returns the URL of the top level page that the context menu was invoked on.
///

View File

@ -195,6 +195,13 @@ class CefContextMenuParams : public virtual CefBase {
/*--cef()--*/
virtual bool HasImageContents() =0;
///
// Returns the title text or the alt text if the context menu was invoked on
// an image.
///
/*--cef()--*/
virtual CefString GetTitleText() = 0;
///
// Returns the URL of the top level page that the context menu was invoked on.
///

View File

@ -64,6 +64,11 @@ bool CefContextMenuParamsImpl::HasImageContents() {
return const_value().has_image_contents;
}
CefString CefContextMenuParamsImpl::GetTitleText() {
CEF_VALUE_VERIFY_RETURN(false, CefString());
return const_value().title_text;
}
CefString CefContextMenuParamsImpl::GetPageUrl() {
CEF_VALUE_VERIFY_RETURN(false, CefString());
return const_value().page_url.spec();

View File

@ -25,6 +25,7 @@ class CefContextMenuParamsImpl
CefString GetUnfilteredLinkUrl() override;
CefString GetSourceUrl() override;
bool HasImageContents() override;
CefString GetTitleText() override;
CefString GetPageUrl() override;
CefString GetFrameUrl() override;
CefString GetFrameCharset() override;

View File

@ -125,6 +125,21 @@ int CEF_CALLBACK context_menu_params_has_image_contents(
return _retval;
}
cef_string_userfree_t CEF_CALLBACK context_menu_params_get_title_text(
struct _cef_context_menu_params_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefString _retval = CefContextMenuParamsCppToC::Get(self)->GetTitleText();
// Return type: string
return _retval.DetachToUserFree();
}
cef_string_userfree_t CEF_CALLBACK context_menu_params_get_page_url(
struct _cef_context_menu_params_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
@ -352,6 +367,7 @@ CefContextMenuParamsCppToC::CefContextMenuParamsCppToC() {
context_menu_params_get_unfiltered_link_url;
GetStruct()->get_source_url = context_menu_params_get_source_url;
GetStruct()->has_image_contents = context_menu_params_has_image_contents;
GetStruct()->get_title_text = context_menu_params_get_title_text;
GetStruct()->get_page_url = context_menu_params_get_page_url;
GetStruct()->get_frame_url = context_menu_params_get_frame_url;
GetStruct()->get_frame_charset = context_menu_params_get_frame_charset;

View File

@ -120,6 +120,22 @@ bool CefContextMenuParamsCToCpp::HasImageContents() {
return _retval?true:false;
}
CefString CefContextMenuParamsCToCpp::GetTitleText() {
cef_context_menu_params_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_title_text))
return CefString();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_string_userfree_t _retval = _struct->get_title_text(_struct);
// Return type: string
CefString _retvalStr;
_retvalStr.AttachToUserFree(_retval);
return _retvalStr;
}
CefString CefContextMenuParamsCToCpp::GetPageUrl() {
cef_context_menu_params_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_page_url))

View File

@ -39,6 +39,7 @@ class CefContextMenuParamsCToCpp
CefString GetUnfilteredLinkUrl() OVERRIDE;
CefString GetSourceUrl() OVERRIDE;
bool HasImageContents() OVERRIDE;
CefString GetTitleText() OVERRIDE;
CefString GetPageUrl() OVERRIDE;
CefString GetFrameUrl() OVERRIDE;
CefString GetFrameCharset() OVERRIDE;