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
3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4 
5 #ifndef mozilla_dom_RemoteWebProgressRequest_h
6 #define mozilla_dom_RemoteWebProgressRequest_h
7 
8 #include "nsIChannel.h"
9 #include "nsIClassifiedChannel.h"
10 #include "nsIRemoteWebProgressRequest.h"
11 
12 namespace mozilla {
13 namespace dom {
14 
15 class RemoteWebProgressRequest final : public nsIRemoteWebProgressRequest,
16                                        public nsIChannel,
17                                        public nsIClassifiedChannel {
18  public:
19   NS_DECL_ISUPPORTS
20   NS_DECL_NSIREMOTEWEBPROGRESSREQUEST
21   NS_DECL_NSICHANNEL
22   NS_DECL_NSICLASSIFIEDCHANNEL
23   NS_DECL_NSIREQUEST
24 
RemoteWebProgressRequest()25   RemoteWebProgressRequest()
26       : mURI(nullptr), mOriginalURI(nullptr), mMatchedList(VoidCString()) {}
27 
RemoteWebProgressRequest(nsIURI * aURI,nsIURI * aOriginalURI,const nsACString & aMatchedList,const Maybe<uint64_t> & aMaybeElapsedLoadTimeMS)28   RemoteWebProgressRequest(nsIURI* aURI, nsIURI* aOriginalURI,
29                            const nsACString& aMatchedList,
30                            const Maybe<uint64_t>& aMaybeElapsedLoadTimeMS)
31       : mURI(aURI),
32         mOriginalURI(aOriginalURI),
33         mMatchedList(aMatchedList),
34         mMaybeElapsedLoadTimeMS(aMaybeElapsedLoadTimeMS) {}
35 
36  protected:
37   ~RemoteWebProgressRequest() = default;
38 
39  private:
40   nsCOMPtr<nsIURI> mURI;
41   nsCOMPtr<nsIURI> mOriginalURI;
42   nsCString mMatchedList;
43 
44   // This field is only Some(...) when the RemoteWebProgressRequest
45   // is created at a time that the document whose progress is being
46   // described by this request is top level and its status changes
47   // from loading to completely loaded.
48   // See BrowserChild::OnStateChange.
49   Maybe<uint64_t> mMaybeElapsedLoadTimeMS;
50 };
51 
52 }  // namespace dom
53 }  // namespace mozilla
54 
55 #endif  // mozilla_dom_RemoteWebProgressRequest_h
56