Created
May 11, 2018 15:54
-
-
Save daleharvey/147f1ff56f2a5114708c3c859a4ba470 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
daleharvey@DESKTOP-UELI0OF ~/src/gecko-dev | |
$ ./mach build | |
0:03.58 Clobber not needed. | |
0:03.58 Adding make options from c:\Users\daleharvey\src\gecko-dev\.mozconfig | |
MOZ_OBJDIR=c:/Users/daleharvey/src/gecko-dev/obj-i686-pc-mingw32 | |
OBJDIR=c:/Users/daleharvey/src/gecko-dev/obj-i686-pc-mingw32 | |
FOUND_MOZCONFIG=c:/Users/daleharvey/src/gecko-dev/.mozconfig | |
export FOUND_MOZCONFIG | |
0:03.94 c:\mozilla-build\mozmake\mozmake.EXE -f client.mk -s | |
0:07.47 Elapsed: 0.48s; From dist/idl: Kept 0 existing; Added/updated 891; Removed 0 files and 0 directories. | |
0:07.86 Elapsed: 0.00s; From dist/public: Kept 0 existing; Added/updated 0; Removed 0 files and 0 directories. | |
0:08.33 Elapsed: 0.03s; From dist/private: Kept 0 existing; Added/updated 0; Removed 0 files and 0 directories. | |
0:09.30 Elapsed: 0.08s; From dist/xpi-stage: Kept 9 existing; Added/updated 0; Removed 0 files and 0 directories. | |
0:10.31 Elapsed: 3.34s; From dist/include: Kept 0 existing; Added/updated 5438; Removed 0 files and 0 directories. | |
0:11.31 Elapsed: 1.05s; From _tests: Kept 0 existing; Added/updated 1013; Removed 0 files and 0 directories. | |
0:12.42 Elapsed: 1.59s; From dist/bin: Kept 0 existing; Added/updated 2084; Removed 0 files and 0 directories. | |
0:20.78 Elapsed: 0.34s; From ../../dist/idl: Kept 0 existing; Added/updated 891; Removed 0 files and 0 directories. | |
0:32.19 force-cargo-library-build | |
0:35.12 [m[m[32m[1m Finished[m release [optimized] target(s) in 0.39 secs | |
0:59.17 WindowsUIUtils.cpp | |
0:59.25 c:/Users/daleharvey/src/gecko-dev/widget/windows/WindowsUIUtils.cpp(221): error C2039: 'IDataTransferManagerInterop': is not a member of 'ABI::Windows::ApplicationModel::DataTransfer' | |
0:59.31 C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\winrt\windows.applicationmodel.datatransfer.h(4755): note: see declaration of 'ABI::Windows::ApplicationModel::DataTransfer' | |
0:59.36 c:/Users/daleharvey/src/gecko-dev/widget/windows/WindowsUIUtils.cpp(224): error C2039: 'ShowShareUIForWindow': is not a member of 'Microsoft::WRL::ComPtr<IDataTransferManagerInterop>' | |
0:59.42 c:/Users/daleharvey/src/gecko-dev/widget/windows/WindowsUIUtils.cpp(221): note: see declaration of 'Microsoft::WRL::ComPtr<IDataTransferManagerInterop>' | |
0:59.48 mozmake.EXE[4]: *** [c:/Users/daleharvey/src/gecko-dev/config/rules.mk:1026: WindowsUIUtils.obj] Error 2 | |
0:59.56 mozmake.EXE[3]: *** [c:/Users/daleharvey/src/gecko-dev/config/recurse.mk:73: widget/windows/target] Error 2 | |
0:59.65 mozmake.EXE[3]: *** Waiting for unfinished jobs.... | |
0:59.73 mozmake.EXE[2]: *** [c:/Users/daleharvey/src/gecko-dev/config/recurse.mk:33: compile] Error 2 | |
0:59.83 mozmake.EXE[1]: *** [c:/Users/daleharvey/src/gecko-dev/config/rules.mk:418: default] Error 2 | |
0:59.87 mozmake.EXE: *** [client.mk:168: build] Error 2 | |
0:59.94 123 compiler warnings present. | |
daleharvey@DESKTOP-UELI0OF ~/src/gecko-dev | |
$ git diff | |
diff --git a/browser/base/content/browser-pageActions.js b/browser/base/content/browser-pageActions.js | |
index 47beadd53c..846d39cc3b 100644 | |
--- a/browser/base/content/browser-pageActions.js | |
+++ b/browser/base/content/browser-pageActions.js | |
@@ -1271,6 +1271,12 @@ BrowserPageActions.shareURL = { | |
.getService(Ci.nsIMacSharingService); | |
}, | |
+ onCommand(event, buttonNode) { | |
+ let windowsUIUtils = Cc["@mozilla.org/windows-ui-utils;1"] | |
+ .getService(Ci.nsIWindowUIUtils); | |
+ windowsUIUtils.shareUrl(); | |
+ }, | |
+ | |
onShowingInPanel(buttonNode) { | |
this._cached = false; | |
}, | |
diff --git a/browser/modules/PageActions.jsm b/browser/modules/PageActions.jsm | |
index ff21ef45f4..f07466557f 100644 | |
--- a/browser/modules/PageActions.jsm | |
+++ b/browser/modules/PageActions.jsm | |
@@ -1187,6 +1187,21 @@ if (AppConstants.platform == "macosx") { | |
}); | |
} | |
+if (AppConstants.platform == "win") { | |
+ gBuiltInActions.push( | |
+ // Share URL | |
+ { | |
+ id: "shareURL", | |
+ title: "shareURL-title", | |
+ onPlacedInPanel(buttonNode) { | |
+ browserPageActions(buttonNode).shareURL.onPlacedInPanel(buttonNode); | |
+ }, | |
+ onCommand(event, buttonNode) { | |
+ browserPageActions(buttonNode).shareURL.onCommand(event, buttonNode); | |
+ }, | |
+ }); | |
+} | |
+ | |
/** | |
* Gets a BrowserPageActions object in a browser window. | |
* | |
diff --git a/browser/themes/windows/browser.css b/browser/themes/windows/browser.css | |
index 7b02e76b18..59bdb10fce 100644 | |
--- a/browser/themes/windows/browser.css | |
+++ b/browser/themes/windows/browser.css | |
@@ -582,6 +582,10 @@ html|*.urlbar-input:-moz-lwtheme::placeholder, | |
color: GrayText; | |
} | |
+#pageAction-panel-shareURL { | |
+ list-style-image: url("chrome://browser/skin/share.svg"); | |
+} | |
+ | |
%include ../shared/urlbarSearchSuggestionsNotification.inc.css | |
#search-container { | |
@@ -1114,4 +1118,3 @@ panel[touchmode] .PanelUI-subView #appMenu-zoom-controls > .subviewbutton-iconic | |
padding-top: .9167em; | |
padding-bottom: .9167em; | |
} | |
- | |
diff --git a/browser/themes/windows/jar.mn b/browser/themes/windows/jar.mn | |
index 150d922487..bbe1f7512e 100644 | |
--- a/browser/themes/windows/jar.mn | |
+++ b/browser/themes/windows/jar.mn | |
@@ -49,6 +49,7 @@ browser.jar: | |
* skin/classic/browser/preferences/in-content/preferences.css (preferences/in-content/preferences.css) | |
* skin/classic/browser/preferences/in-content/dialog.css (preferences/in-content/dialog.css) | |
skin/classic/browser/preferences/applications.css (preferences/applications.css) | |
+ skin/classic/browser/share.svg (share.svg) | |
skin/classic/browser/tabbrowser/tabDragIndicator.png (tabbrowser/tabDragIndicator.png) | |
skin/classic/browser/window-controls/close.svg (window-controls/close.svg) | |
skin/classic/browser/window-controls/close-highcontrast.svg (window-controls/close-highcontrast.svg) | |
diff --git a/widget/nsIWindowsUIUtils.idl b/widget/nsIWindowsUIUtils.idl | |
index 331562a672..353885caea 100644 | |
--- a/widget/nsIWindowsUIUtils.idl | |
+++ b/widget/nsIWindowsUIUtils.idl | |
@@ -6,6 +6,7 @@ | |
#include "nsISupports.idl" | |
+interface mozIDOMWindowProxy; | |
[scriptable, uuid(aa8a0ecf-96a1-418c-b80e-f24ae18bbedc)] | |
interface nsIWindowsUIUtils : nsISupports | |
@@ -20,5 +21,9 @@ interface nsIWindowsUIUtils : nsISupports | |
* Update the tablet mode state | |
*/ | |
void updateTabletModeState(); | |
-}; | |
+ /** | |
+ * Share URL | |
+ */ | |
+ void shareUrl(); | |
+}; | |
diff --git a/widget/windows/WindowsUIUtils.cpp b/widget/windows/WindowsUIUtils.cpp | |
index 4d916d25cf..1227ee10ce 100644 | |
--- a/widget/windows/WindowsUIUtils.cpp | |
+++ b/widget/windows/WindowsUIUtils.cpp | |
@@ -22,6 +22,19 @@ | |
#include "nsString.h" | |
#include "nsIWidget.h" | |
+#include <wrl/client.h> | |
+#include <wrl/wrappers/corewrappers.h> | |
+#include <windows.applicationmodel.datatransfer.h> | |
+#include <tchar.h> | |
+#include <roapi.h> | |
+#include "shlobj.h" | |
+#include "shobjidl.h" | |
+ | |
+namespace WRL = Microsoft::WRL; | |
+namespace dt = ABI::Windows::ApplicationModel::DataTransfer; | |
+ | |
+using Microsoft::WRL::Wrappers::HStringReference; | |
+ | |
/* mingw currently doesn't support windows.ui.viewmanagement.h, so we disable it until it's fixed. */ | |
#ifndef __MINGW32__ | |
@@ -78,6 +91,8 @@ namespace ABI { | |
} | |
#endif | |
+ | |
+ | |
#ifndef IUIViewSettingsInterop | |
typedef interface IUIViewSettingsInterop IUIViewSettingsInterop; | |
@@ -92,6 +107,25 @@ public: | |
#endif | |
+#ifndef IDataTransferManagerInterop | |
+ | |
+typedef interface IDataTransferManagerInterop IDataTransferManagerInterop; | |
+ | |
+MIDL_INTERFACE("3A3DCD6C-3EAB-43DC-BCDE-45671CE800C8") | |
+IDataTransferManagerInterop : public IUnknown | |
+{ | |
+public: | |
+ virtual HRESULT STDMETHODCALLTYPE GetForWindow( | |
+ /* [in] */ __RPC__in HWND appWindow, | |
+ /* [in] */ __RPC__in REFIID riid, | |
+ /* [iid_is][retval][out] */ __RPC__deref_out_opt void **dataTransferManager) = 0; | |
+ | |
+ virtual HRESULT STDMETHODCALLTYPE ShowShareUIForWindow( | |
+ /* [in] */ __RPC__in HWND appWindow) = 0; | |
+ | |
+}; | |
+#endif | |
+ | |
WindowsUIUtils::WindowsUIUtils() : | |
mInTabletMode(eTabletModeUnknown) | |
{ | |
@@ -178,3 +212,23 @@ WindowsUIUtils::UpdateTabletModeState() | |
return NS_OK; | |
} | |
+ | |
+NS_IMETHODIMP | |
+WindowsUIUtils::ShareUrl() | |
+{ | |
+#ifndef __MINGW32__ | |
+ if (!IsWin10OrLater()) { | |
+ return NS_OK; | |
+ } | |
+#endif | |
+ | |
+ HWND hwnd = GetForegroundWindow(); | |
+ | |
+ WRL::ComPtr<dt::IDataTransferManagerInterop> dtmInterop; | |
+ RoGetActivationFactory(HStringReference( | |
+ RuntimeClass_Windows_ApplicationModel_DataTransfer_DataTransferManager).Get(), IID_PPV_ARGS(&dtmInterop)); | |
+ dtmInterop.ShowShareUIForWindow(hwnd); | |
+ | |
+ //ABI::Windows::ApplicationModel::DataTransfer::DataTransferManager::ShowShareUI(); | |
+ return NS_OK; | |
+} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment