Bumping manifests a=b2g-bump
[gecko.git] / dom / mobileconnection / MobileConnectionCallback.h
blob33f5eedcfd2670cd5e854cdea71aa8b4bb1d7280
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef mozilla_dom_mobileconnection_MobileConnectionCallback_h
6 #define mozilla_dom_mobileconnection_MobileConnectionCallback_h
8 #include "mozilla/dom/DOMRequest.h"
9 #include "mozilla/dom/mobileconnection/MobileConnectionIPCSerializer.h"
10 #include "nsCOMPtr.h"
11 #include "nsIMobileConnectionService.h"
13 namespace mozilla {
14 namespace dom {
15 namespace mobileconnection {
17 /**
18 * A callback object for handling asynchronous request/response. This object is
19 * created when an asynchronous request is made and should be destroyed after
20 * Notify*Success/Error is called.
21 * The modules hold the reference of MobileConnectionCallback in OOP mode and
22 * non-OOP mode are different.
23 * - OOP mode: MobileConnectionRequestChild
24 * - non-OOP mode: MobileConnectionService
25 * The reference should be released after Notify*Success/Error is called.
27 class MobileConnectionCallback MOZ_FINAL : public nsIMobileConnectionCallback
29 public:
30 NS_DECL_ISUPPORTS
31 NS_DECL_NSIMOBILECONNECTIONCALLBACK
33 MobileConnectionCallback(nsPIDOMWindow* aWindow, DOMRequest* aRequest);
35 private:
36 ~MobileConnectionCallback() {}
38 nsresult
39 NotifySuccess(JS::Handle<JS::Value> aResult);
41 nsresult
42 NotifySuccessWithString(const nsAString& aResult);
44 nsCOMPtr<nsPIDOMWindow> mWindow;
45 nsRefPtr<DOMRequest> mRequest;
48 } // namespace mobileconnection
49 } // namespace dom
50 } // namespace mozilla
52 #endif // mozilla_dom_mobileconnection_MobileConnectionCallback_h