Skip to content

Commit 9892057

Browse files
author
Hosam Tageldin
committed
Changed Url to Uri and context type to context kind
1 parent e019355 commit 9892057

1 file changed

Lines changed: 40 additions & 40 deletions

File tree

specs/ContextMenuRequested.md

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ The developer can add or remove entries to the default WebView context menu. For
3636
CHECK_FAILURE(args->get_MenuItems(&items));
3737
wil::com_ptr<ICoreWebView2ContextMenuInfo> info;
3838
CHECK_FAILURE(args->get_ContextMenuInfo(&info));
39-
COREWEBVIEW2_CONTEXT_TYPE context;
40-
CHECK_FAILURE(info->get_ContextType(&context));
39+
COREWEBVIEW2_CONTEXT_KIND context;
40+
CHECK_FAILURE(info->get_ContextKind(&context));
4141
CHECK_FAILURE(args->put_Handled(false));
4242
UINT32 itemsCount;
4343
CHECK_FAILURE(items->get_Count(&itemsCount));
4444
// Removing the 'Save image as' context menu item for image context selections.
45-
if (context == COREWEBVIEW2_CONTEXT_TYPE_IMAGE)
45+
if (context == COREWEBVIEW2_CONTEXT_KIND_IMAGE)
4646
{
4747
UINT32 removeIndex = itemsCount;
4848
wil::com_ptr<ICoreWebView2ContextMenuItem> current;
@@ -62,7 +62,7 @@ The developer can add or remove entries to the default WebView context menu. For
6262
}
6363
}
6464
// Adding a custom context menu item for links that will display the link's URI.
65-
else if (context == COREWEBVIEW2_CONTEXT_TYPE_LINK)
65+
else if (context == COREWEBVIEW2_CONTEXT_KIND_LINK)
6666
{
6767
wil::com_ptr<ICoreWebView2Environment> webviewEnvironment;
6868
CHECK_FAILURE(m_appWindow->GetWebViewEnvironment()->QueryInterface(
@@ -74,9 +74,9 @@ The developer can add or remove entries to the default WebView context menu. For
7474
ICoreWebView2* sender,
7575
IUnknown* args)
7676
{
77-
wil::unique_cotaskmem_string linkUrl;
78-
CHECK_FAILURE(info->get_LinkUrl(&linkUrl));
79-
std::wstring linkString = linkUrl.get();
77+
wil::unique_cotaskmem_string linkUri;
78+
CHECK_FAILURE(info->get_LinkUri(&linkUri));
79+
std::wstring linkString = linkUri.get();
8080
m_appWindow->RunAsync([this, linkString]()
8181
{
8282
MessageBox(
@@ -217,24 +217,24 @@ The developer can use the data provided in the Event arguments to display a cust
217217
webView.CoreWebView2.ContextMenuRequested += delegate (object sender, CoreWebView2ContextMenuRequestedEventArgs args)
218218
{
219219
IList<CoreWebView2ContextMenuItem> menuList = args.MenuItems;
220-
CoreWebView2ContextType context = args.ContextMenuInfo.ContextType;
220+
CoreWebView2ContextKind context = args.ContextMenuInfo.ContextKind;
221221
args.Handled = false;
222-
if (context == CoreWebView2ContextType.Image)
222+
if (context == CoreWebView2ContextKind.Image)
223223
{
224224
// removes the last item in the collection
225225
menuList.RemoveAt(menuList.Count - 1);
226226
}
227-
else if (context == CoreWebView2ContextType.Link)
227+
else if (context == CoreWebView2ContextKind.Link)
228228
{
229229
// add new item to end of collection
230230
CoreWebView2ContextMenuItem newItem = webView.CoreWebView2.Environment.CreateContextMenuItem(
231231
"Display Link", "Shorcut", null, CoreWebView2ContextMenuItemKind.Normal,1, 0);
232232
newItem.CustomItemSelected += delegate (object send, Object ex)
233233
{
234-
string linkUrl = args.ContextMenuInfo.LinkUrl;
234+
string linkUri = args.ContextMenuInfo.LinkUri;
235235
System.Threading.SynchronizationContext.Current.Post((_) =>
236236
{
237-
MessageBox.Show(linkUrl, "Display Link", MessageBoxButton.YesNo);
237+
MessageBox.Show(linkUri, "Display Link", MessageBoxButton.YesNo);
238238
}, null);
239239
}
240240
menuList.Insert(menuList.Count, newItem);
@@ -394,32 +394,32 @@ The developer can use the data provided in the Event arguments to display a cust
394394
COREWEBVIEW2_CONTEXT_MENU_ITEM_DESCRIPTOR_OTHER,
395395
} COREWEBVIEW2_CONTEXT_MENU_ITEM_DESCRIPTOR;
396396

397-
/// Indicates the type of context for which the context menu was created
398-
/// for the `ICoreWebView2ContextMenuInfo::get_ContextType` method
397+
/// Indicates the kind of context for which the context menu was created
398+
/// for the `ICoreWebView2ContextMenuInfo::get_ContextKind` method
399399
[v1_enum]
400-
typedef enum COREWEBVIEW2_CONTEXT_TYPE
400+
typedef enum COREWEBVIEW2_CONTEXT_KIND
401401
{
402402
/// Indicates that the context menu was created for the page without any additional content.
403-
COREWEBVIEW2_CONTEXT_TYPE_PAGE,
403+
COREWEBVIEW2_CONTEXT_KIND_PAGE,
404404

405405
/// Indicates that the context menu was created for a selection.
406-
COREWEBVIEW2_CONTEXT_TYPE_SELECTION,
406+
COREWEBVIEW2_CONTEXT_KIND_SELECTION,
407407

408408
/// Indicates that the context menu was created for a link.
409-
COREWEBVIEW2_CONTEXT_TYPE_LINK,
409+
COREWEBVIEW2_CONTEXT_KIND_LINK,
410410

411411
/// Indicates that the context menu was created for an editable component.
412-
COREWEBVIEW2_CONTEXT_TYPE_EDITABLE,
412+
COREWEBVIEW2_CONTEXT_KIND_EDITABLE,
413413
414414
/// Indicates that the context menu was created for an audio element.
415-
COREWEBVIEW2_CONTEXT_TYPE_AUDIO,
415+
COREWEBVIEW2_CONTEXT_KIND_AUDIO,
416416

417417
/// Indicates that the context menu was created for an image element.
418-
COREWEBVIEW2_CONTEXT_TYPE_IMAGE,
418+
COREWEBVIEW2_CONTEXT_KIND_IMAGE,
419419
420420
/// Indicates that the context menu was created for a video element.
421-
COREWEBVIEW2_CONTEXT_TYPE_VIDEO,
422-
} COREWEBVIEW2_CONTEXT_TYPE;
421+
COREWEBVIEW2_CONTEXT_KIND_VIDEO,
422+
} COREWEBVIEW2_CONTEXT_KIND;
423423

424424
/// Specifies the menu item kind
425425
/// for the `ICoreWebView2StagingContextMenuItem::get_Kind` method
@@ -618,24 +618,24 @@ The developer can use the data provided in the Event arguments to display a cust
618618
/// Gets the coordinates where the context menu request occured in relation to the upper left corner of the webview bounds.
619619
[propget] HRESULT Location([out, retval] POINT* value);
620620

621-
/// Gets the type of context that the user selected.
622-
[propget] HRESULT ContextType([out, retval] COREWEBVIEW2_CONTEXT_TYPE* value);
621+
/// Gets the kind of context that the user selected.
622+
[propget] HRESULT ContextKind([out, retval] COREWEBVIEW2_CONTEXT_KIND* value);
623623

624624
/// Returns TRUE if the context menu was requested on the main frame and
625625
/// FALSE if invoked on another frame.
626626
[propget] HRESULT IsMainFrame([out, retval] BOOL* value);
627627

628-
/// Gets the url of the page.
629-
[propget] HRESULT PageUrl([out, retval] LPWSTR* value);
628+
/// Gets the uri of the page.
629+
[propget] HRESULT PageUri([out, retval] LPWSTR* value);
630630

631-
/// Gets the url of the frame. Will match the PageUrl is `get_IsMainFrame` is TRUE.
632-
[propget] HRESULT FrameUrl([out, retval] LPWSTR* value);
631+
/// Gets the uri of the frame. Will match the PageUri is `get_IsMainFrame` is TRUE.
632+
[propget] HRESULT FrameUri([out, retval] LPWSTR* value);
633633

634-
/// Gets the source url of element (if context menu requested on a media element, null otherwise).
635-
[propget] HRESULT SourceUrl([out, retval] LPWSTR* value);
634+
/// Gets the source uri of element (if context menu requested on a media element, null otherwise).
635+
[propget] HRESULT SourceUri([out, retval] LPWSTR* value);
636636

637-
/// Gets the url of the link (if context menu requested on a link, null otherwise).
638-
[propget] HRESULT LinkUrl([out, retval] LPWSTR* value);
637+
/// Gets the uri of the link (if context menu requested on a link, null otherwise).
638+
[propget] HRESULT LinkUri([out, retval] LPWSTR* value);
639639

640640
/// Gets the text of the link (if context menu requested on a link, null otherwise).
641641
[propget] HRESULT LinkText([out, retval] LPWSTR * value);
@@ -683,7 +683,7 @@ namespace Microsoft.Web.WebView2.Core
683683
Other = 31,
684684
};
685685
686-
enum CoreWebView2ContextType
686+
enum CoreWebView2ContextKind
687687
{
688688
Page = 0,
689689
Selection = 1,
@@ -708,18 +708,18 @@ namespace Microsoft.Web.WebView2.Core
708708
Boolean Handled { get; set; }
709709
CoreWebView2ContextMenuInfo ContextMenuInfo { get; }
710710
IVector<CoreWebView2ContextMenuItem> MenuItems { get; }
711-
CoreWebView2ContextMenuItem SelectedCommand { get; set; }
711+
Int32 SelectedCommandId { get; set; }
712712
Windows.Foundation.Deferral GetDeferral();
713713
};
714714
715715
runtimeclass CoreWebView2ContextMenuInfo
716716
{
717717
Point Location { get; }
718-
CoreWebView2ContextType ContextType { get; }
719-
String PageUrl { get; }
720-
String FrameUrl { get; }
721-
String SourceUrl { get; }
722-
String LinkUrl { get; }
718+
CoreWebView2ContextKind ContextKind { get; }
719+
String PageUri { get; }
720+
String FrameUri { get; }
721+
String SourceUri { get; }
722+
String LinkUri { get; }
723723
String LinkText { get; }
724724
String SelectionText { get; }
725725
};

0 commit comments

Comments
 (0)