Add CefContextMenuParams::GetTitleText method (issue #2030)

This commit is contained in:
Marshall Greenblatt 2017-01-17 12:43:49 -05:00
parent 3f0c94f7e6
commit 5f4190ff75
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)( int (CEF_CALLBACK *has_image_contents)(
struct _cef_context_menu_params_t* self); 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. // 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()--*/ /*--cef()--*/
virtual bool HasImageContents() =0; 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. // 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; return const_value().has_image_contents;
} }
CefString CefContextMenuParamsImpl::GetTitleText() {
CEF_VALUE_VERIFY_RETURN(false, CefString());
return const_value().title_text;
}
CefString CefContextMenuParamsImpl::GetPageUrl() { CefString CefContextMenuParamsImpl::GetPageUrl() {
CEF_VALUE_VERIFY_RETURN(false, CefString()); CEF_VALUE_VERIFY_RETURN(false, CefString());
return const_value().page_url.spec(); return const_value().page_url.spec();

View File

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

View File

@ -125,6 +125,21 @@ int CEF_CALLBACK context_menu_params_has_image_contents(
return _retval; 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( cef_string_userfree_t CEF_CALLBACK context_menu_params_get_page_url(
struct _cef_context_menu_params_t* self) { struct _cef_context_menu_params_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
@ -352,6 +367,7 @@ CefContextMenuParamsCppToC::CefContextMenuParamsCppToC() {
context_menu_params_get_unfiltered_link_url; context_menu_params_get_unfiltered_link_url;
GetStruct()->get_source_url = context_menu_params_get_source_url; GetStruct()->get_source_url = context_menu_params_get_source_url;
GetStruct()->has_image_contents = context_menu_params_has_image_contents; 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_page_url = context_menu_params_get_page_url;
GetStruct()->get_frame_url = context_menu_params_get_frame_url; GetStruct()->get_frame_url = context_menu_params_get_frame_url;
GetStruct()->get_frame_charset = context_menu_params_get_frame_charset; GetStruct()->get_frame_charset = context_menu_params_get_frame_charset;

View File

@ -120,6 +120,22 @@ bool CefContextMenuParamsCToCpp::HasImageContents() {
return _retval?true:false; 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() { CefString CefContextMenuParamsCToCpp::GetPageUrl() {
cef_context_menu_params_t* _struct = GetStruct(); cef_context_menu_params_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_page_url)) if (CEF_MEMBER_MISSING(_struct, get_page_url))

View File

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