Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo.moya@xamarin.com>2019-09-06 14:11:24 +0300
committerRodrigo Moya <rodrigo.moya@xamarin.com>2019-09-06 15:04:11 +0300
commitf6aef5fd4112412e8ab1e7791383473c202bec80 (patch)
tree4b5f2927d4cfd77a48a4bcf3252f779d0e9ab124 /main/src/addins/MacPlatform/MacPlatform.cs
parent7641d9e4e92fda18a399afc573ce3ff863f08c3c (diff)
[AspNet*] Filter HTTP handlers to viewer role
Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/970420
Diffstat (limited to 'main/src/addins/MacPlatform/MacPlatform.cs')
-rw-r--r--main/src/addins/MacPlatform/MacPlatform.cs24
1 files changed, 23 insertions, 1 deletions
diff --git a/main/src/addins/MacPlatform/MacPlatform.cs b/main/src/addins/MacPlatform/MacPlatform.cs
index 85439ec946..954c597a4a 100644
--- a/main/src/addins/MacPlatform/MacPlatform.cs
+++ b/main/src/addins/MacPlatform/MacPlatform.cs
@@ -942,6 +942,28 @@ namespace MonoDevelop.MacIntegration
public override IEnumerable<DesktopApplication> GetApplications (string filename)
{
+ return GetApplications (filename, DesktopApplicationRole.All);
+ }
+
+ public override IEnumerable<DesktopApplication> GetApplications (string filename, DesktopApplicationRole role)
+ {
+ static global::CoreServices.LSRoles ToLSRoles (DesktopApplicationRole role)
+ {
+ var lsRole = global::CoreServices.LSRoles.None;
+
+ if (role == DesktopApplicationRole.All)
+ return global::CoreServices.LSRoles.All;
+
+ if (role.HasFlag (DesktopApplicationRole.Viewer))
+ lsRole |= global::CoreServices.LSRoles.Viewer;
+ if (role.HasFlag (DesktopApplicationRole.Editor))
+ lsRole |= global::CoreServices.LSRoles.Editor;
+ if (role.HasFlag (DesktopApplicationRole.Shell))
+ lsRole |= global::CoreServices.LSRoles.Shell;
+
+ return lsRole;
+ }
+
//FIXME: we should disambiguate dupliacte apps in different locations and display both
//for now, just filter out the duplicates
var checkUniqueName = new HashSet<string> ();
@@ -960,7 +982,7 @@ namespace MonoDevelop.MacIntegration
var apps = new List<DesktopApplication> ();
- var retrievedApps = global::CoreServices.LaunchServices.GetApplicationUrlsForUrl (url, global::CoreServices.LSRoles.All);
+ var retrievedApps = global::CoreServices.LaunchServices.GetApplicationUrlsForUrl (url, ToLSRoles (role));
if (retrievedApps != null) {
foreach (var app in retrievedApps) {
if (string.IsNullOrEmpty (app.Path) || !checkUniquePath.Add (app.Path))