Commit 26e4998e authored by Jonathan Watt's avatar Jonathan Watt
Browse files

Bug 1601589. Stop requiring MockWebBrowserPrint to store a PrintData object. r=bobowen

Differential Revision: https://phabricator.services.mozilla.com/D55942

--HG--
extra : moz-landing-system : lando
parent 032f34ca
......@@ -21,8 +21,12 @@ namespace embedding {
NS_IMPL_ISUPPORTS(MockWebBrowserPrint, nsIWebBrowserPrint);
MockWebBrowserPrint::MockWebBrowserPrint(const PrintData& aData)
: mData(aData) {}
MockWebBrowserPrint::MockWebBrowserPrint(const nsAString& aDocName,
bool aIsIFrameSelected,
bool aIsRangeSelection)
: mDocName(aDocName),
mIsIFrameSelected(aIsIFrameSelected),
mIsRangeSelection(aIsRangeSelection) {}
MockWebBrowserPrint::~MockWebBrowserPrint() {}
......@@ -41,7 +45,7 @@ MockWebBrowserPrint::GetCurrentPrintSettings(
NS_IMETHODIMP
MockWebBrowserPrint::GetDocumentName(nsAString& aDocName) {
// The only consumer that cares about this is the OS X printing dialog.
aDocName = mData.printJobName();
aDocName = mDocName;
return NS_OK;
}
......@@ -57,13 +61,13 @@ MockWebBrowserPrint::GetDoingPrintPreview(bool* aDoingPrintPreview) {
NS_IMETHODIMP
MockWebBrowserPrint::GetIsIFrameSelected(bool* aIsIFrameSelected) {
*aIsIFrameSelected = mData.isIFrameSelected();
*aIsIFrameSelected = mIsIFrameSelected;
return NS_OK;
}
NS_IMETHODIMP
MockWebBrowserPrint::GetIsRangeSelection(bool* aIsRangeSelection) {
*aIsRangeSelection = mData.isRangeSelection();
*aIsRangeSelection = mIsRangeSelection;
return NS_OK;
}
......
......@@ -22,14 +22,18 @@ namespace embedding {
class MockWebBrowserPrint final : public nsIWebBrowserPrint {
public:
explicit MockWebBrowserPrint(const PrintData& aData);
explicit MockWebBrowserPrint(const nsAString& aDocName,
bool aIsIFrameSelected, bool aIsRangeSelection);
NS_DECL_ISUPPORTS
NS_DECL_NSIWEBBROWSERPRINT
private:
~MockWebBrowserPrint();
PrintData mData;
nsAutoString mDocName;
bool mIsIFrameSelected;
bool mIsRangeSelection;
};
} // namespace embedding
......
......@@ -105,7 +105,8 @@ nsresult PrintingParent::ShowPrintDialog(PBrowserParent* aParent,
// The initSettings we got can be wrapped using
// PrintDataUtils' MockWebBrowserPrint, which implements enough of
// nsIWebBrowserPrint to keep the dialogs happy.
nsCOMPtr<nsIWebBrowserPrint> wbp = new MockWebBrowserPrint(aData);
nsCOMPtr<nsIWebBrowserPrint> wbp = new MockWebBrowserPrint(
aData.printJobName(), aData.isIFrameSelected(), aData.isRangeSelection());
// Use the existing RemotePrintJob and its settings, if we have one, to make
// sure they stay current.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment