mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
48e91a819c
--HG-- extra : rebase_source : ad2b2f20219b42b192c313b6fa9da3383f904805
90 lines
2.8 KiB
C++
90 lines
2.8 KiB
C++
//* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-/
|
|
/* 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/. */
|
|
|
|
#ifndef nsUrlClassifierStreamUpdater_h_
|
|
#define nsUrlClassifierStreamUpdater_h_
|
|
|
|
#include <nsISupportsUtils.h>
|
|
|
|
#include "nsCOMPtr.h"
|
|
#include "nsIObserver.h"
|
|
#include "nsIUrlClassifierStreamUpdater.h"
|
|
#include "nsIStreamListener.h"
|
|
#include "nsNetUtil.h"
|
|
#include "nsTArray.h"
|
|
#include "nsITimer.h"
|
|
#include "mozilla/Attributes.h"
|
|
|
|
// Forward declare pointers
|
|
class nsIURI;
|
|
|
|
class nsUrlClassifierStreamUpdater MOZ_FINAL : public nsIUrlClassifierStreamUpdater,
|
|
public nsIUrlClassifierUpdateObserver,
|
|
public nsIStreamListener,
|
|
public nsIObserver,
|
|
public nsIInterfaceRequestor,
|
|
public nsITimerCallback
|
|
{
|
|
public:
|
|
nsUrlClassifierStreamUpdater();
|
|
|
|
NS_DECL_THREADSAFE_ISUPPORTS
|
|
NS_DECL_NSIURLCLASSIFIERSTREAMUPDATER
|
|
NS_DECL_NSIURLCLASSIFIERUPDATEOBSERVER
|
|
NS_DECL_NSIINTERFACEREQUESTOR
|
|
NS_DECL_NSIREQUESTOBSERVER
|
|
NS_DECL_NSISTREAMLISTENER
|
|
NS_DECL_NSIOBSERVER
|
|
NS_DECL_NSITIMERCALLBACK
|
|
|
|
private:
|
|
// No subclassing
|
|
~nsUrlClassifierStreamUpdater() {}
|
|
|
|
// When the dbservice sends an UpdateComplete or UpdateFailure, we call this
|
|
// to reset the stream updater.
|
|
void DownloadDone();
|
|
|
|
// Disallow copy constructor
|
|
nsUrlClassifierStreamUpdater(nsUrlClassifierStreamUpdater&);
|
|
|
|
nsresult AddRequestBody(const nsACString &aRequestBody);
|
|
|
|
nsresult FetchUpdate(nsIURI *aURI,
|
|
const nsACString &aRequestBody,
|
|
const nsACString &aTable,
|
|
const nsACString &aServerMAC);
|
|
nsresult FetchUpdate(const nsACString &aURI,
|
|
const nsACString &aRequestBody,
|
|
const nsACString &aTable,
|
|
const nsACString &aServerMAC);
|
|
|
|
nsresult FetchNext();
|
|
|
|
bool mIsUpdating;
|
|
bool mInitialized;
|
|
bool mDownloadError;
|
|
bool mBeganStream;
|
|
nsCOMPtr<nsIURI> mUpdateUrl;
|
|
nsCString mStreamTable;
|
|
nsCString mServerMAC;
|
|
nsCOMPtr<nsIChannel> mChannel;
|
|
nsCOMPtr<nsIUrlClassifierDBService> mDBService;
|
|
nsCOMPtr<nsITimer> mTimer;
|
|
|
|
struct PendingUpdate {
|
|
nsCString mUrl;
|
|
nsCString mTable;
|
|
nsCString mServerMAC;
|
|
};
|
|
nsTArray<PendingUpdate> mPendingUpdates;
|
|
|
|
nsCOMPtr<nsIUrlClassifierCallback> mSuccessCallback;
|
|
nsCOMPtr<nsIUrlClassifierCallback> mUpdateErrorCallback;
|
|
nsCOMPtr<nsIUrlClassifierCallback> mDownloadErrorCallback;
|
|
};
|
|
|
|
#endif // nsUrlClassifierStreamUpdater_h_
|