summaryrefslogtreecommitdiffstats
path: root/embedding/components/printingui/ipc/PrintProgressDialogParent.cpp
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /embedding/components/printingui/ipc/PrintProgressDialogParent.cpp
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'embedding/components/printingui/ipc/PrintProgressDialogParent.cpp')
-rw-r--r--embedding/components/printingui/ipc/PrintProgressDialogParent.cpp113
1 files changed, 113 insertions, 0 deletions
diff --git a/embedding/components/printingui/ipc/PrintProgressDialogParent.cpp b/embedding/components/printingui/ipc/PrintProgressDialogParent.cpp
new file mode 100644
index 000000000..6e34704ff
--- /dev/null
+++ b/embedding/components/printingui/ipc/PrintProgressDialogParent.cpp
@@ -0,0 +1,113 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "mozilla/Unused.h"
+#include "nsIPrintProgressParams.h"
+#include "nsIWebProgressListener.h"
+#include "PrintProgressDialogParent.h"
+
+using mozilla::Unused;
+
+namespace mozilla {
+namespace embedding {
+
+NS_IMPL_ISUPPORTS(PrintProgressDialogParent, nsIObserver)
+
+PrintProgressDialogParent::PrintProgressDialogParent() :
+ mActive(true)
+{
+ MOZ_COUNT_CTOR(PrintProgressDialogParent);
+}
+
+PrintProgressDialogParent::~PrintProgressDialogParent()
+{
+ MOZ_COUNT_DTOR(PrintProgressDialogParent);
+}
+
+void
+PrintProgressDialogParent::SetWebProgressListener(nsIWebProgressListener* aListener)
+{
+ mWebProgressListener = aListener;
+}
+
+void
+PrintProgressDialogParent::SetPrintProgressParams(nsIPrintProgressParams* aParams)
+{
+ mPrintProgressParams = aParams;
+}
+
+bool
+PrintProgressDialogParent::RecvStateChange(const long& stateFlags,
+ const nsresult& status)
+{
+ if (mWebProgressListener) {
+ mWebProgressListener->OnStateChange(nullptr, nullptr, stateFlags, status);
+ }
+ return true;
+}
+
+bool
+PrintProgressDialogParent::RecvProgressChange(const long& curSelfProgress,
+ const long& maxSelfProgress,
+ const long& curTotalProgress,
+ const long& maxTotalProgress)
+{
+ if (mWebProgressListener) {
+ mWebProgressListener->OnProgressChange(nullptr, nullptr, curSelfProgress,
+ maxSelfProgress, curTotalProgress,
+ maxTotalProgress);
+ }
+ return true;
+}
+
+bool
+PrintProgressDialogParent::RecvDocTitleChange(const nsString& newTitle)
+{
+ if (mPrintProgressParams) {
+ mPrintProgressParams->SetDocTitle(newTitle.get());
+ }
+ return true;
+}
+
+bool
+PrintProgressDialogParent::RecvDocURLChange(const nsString& newURL)
+{
+ if (mPrintProgressParams) {
+ mPrintProgressParams->SetDocURL(newURL.get());
+ }
+ return true;
+}
+
+void
+PrintProgressDialogParent::ActorDestroy(ActorDestroyReason aWhy)
+{
+}
+
+bool
+PrintProgressDialogParent::Recv__delete__()
+{
+ // The child has requested that we tear down the connection, so we set a
+ // member to make sure we don't try to contact it after the fact.
+ mActive = false;
+ return true;
+}
+
+// nsIObserver
+NS_IMETHODIMP
+PrintProgressDialogParent::Observe(nsISupports *aSubject, const char *aTopic,
+ const char16_t *aData)
+{
+ if (mActive) {
+ Unused << SendDialogOpened();
+ } else {
+ NS_WARNING("The print progress dialog finished opening, but communications "
+ "with the child have been closed.");
+ }
+
+ return NS_OK;
+}
+
+
+} // namespace embedding
+} // namespace mozilla