mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-11 10:08:41 +00:00
Bug 1080463 - Patch1: [bluetooth2] Porting DOMFile/DOMBlob to WebIDL(Bug 1047483). r=shuang
This commit is contained in:
parent
42e921bd65
commit
9cc97e58af
@ -14,6 +14,7 @@
|
||||
#include "mozilla/dom/BluetoothAttributeEvent.h"
|
||||
#include "mozilla/dom/BluetoothStatusChangedEvent.h"
|
||||
#include "mozilla/dom/ContentChild.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
|
||||
#include "mozilla/dom/bluetooth/BluetoothAdapter.h"
|
||||
#include "mozilla/dom/bluetooth/BluetoothClassOfDevice.h"
|
||||
@ -1025,7 +1026,7 @@ BluetoothAdapter::Disconnect(BluetoothDevice& aDevice,
|
||||
|
||||
already_AddRefed<DOMRequest>
|
||||
BluetoothAdapter::SendFile(const nsAString& aDeviceAddress,
|
||||
nsIDOMBlob* aBlob, ErrorResult& aRv)
|
||||
File& aBlob, ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> win = GetOwner();
|
||||
if (!win) {
|
||||
@ -1045,7 +1046,7 @@ BluetoothAdapter::SendFile(const nsAString& aDeviceAddress,
|
||||
|
||||
if (XRE_GetProcessType() == GeckoProcessType_Default) {
|
||||
// In-process transfer
|
||||
bs->SendFile(aDeviceAddress, aBlob, results);
|
||||
bs->SendFile(aDeviceAddress, &aBlob, results);
|
||||
} else {
|
||||
ContentChild *cc = ContentChild::GetSingleton();
|
||||
if (!cc) {
|
||||
@ -1053,7 +1054,7 @@ BluetoothAdapter::SendFile(const nsAString& aDeviceAddress,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
BlobChild* actor = cc->GetOrCreateActorForBlob(aBlob);
|
||||
BlobChild* actor = cc->GetOrCreateActorForBlob(&aBlob);
|
||||
if (!actor) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
|
@ -18,6 +18,7 @@
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class DOMRequest;
|
||||
class File;
|
||||
struct MediaMetaData;
|
||||
struct MediaPlayStatus;
|
||||
}
|
||||
@ -124,7 +125,7 @@ public:
|
||||
|
||||
// OPP file transfer related methods
|
||||
already_AddRefed<DOMRequest> SendFile(const nsAString& aDeviceAddress,
|
||||
nsIDOMBlob* aBlob,
|
||||
File& aBlob,
|
||||
ErrorResult& aRv);
|
||||
already_AddRefed<DOMRequest> StopSendingFile(const nsAString& aDeviceAddress,
|
||||
ErrorResult& aRv);
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
#include "mozilla/dom/bluetooth/BluetoothTypes.h"
|
||||
#include "mozilla/dom/ipc/BlobParent.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
@ -22,7 +23,6 @@
|
||||
#include "nsCExternalHandlerService.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIDOMFile.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsIMIMEService.h"
|
||||
@ -35,6 +35,7 @@
|
||||
|
||||
USING_BLUETOOTH_NAMESPACE
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::ipc;
|
||||
|
||||
namespace {
|
||||
@ -349,7 +350,8 @@ BluetoothOppManager::SendFile(const nsAString& aDeviceAddress,
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
nsCOMPtr<nsIDOMBlob> blob = aActor->GetBlob();
|
||||
nsRefPtr<FileImpl> impl = aActor->GetBlobImpl();
|
||||
nsCOMPtr<nsIDOMBlob> blob = new File(nullptr, impl);
|
||||
|
||||
return SendFile(aDeviceAddress, blob.get());
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
#include "mozilla/dom/bluetooth/BluetoothTypes.h"
|
||||
#include "mozilla/dom/ipc/BlobParent.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
@ -22,7 +23,6 @@
|
||||
#include "nsCExternalHandlerService.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIDOMFile.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsIMIMEService.h"
|
||||
@ -35,6 +35,7 @@
|
||||
|
||||
USING_BLUETOOTH_NAMESPACE
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::ipc;
|
||||
using mozilla::TimeDuration;
|
||||
using mozilla::TimeStamp;
|
||||
@ -371,7 +372,8 @@ BluetoothOppManager::SendFile(const nsAString& aDeviceAddress,
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
nsCOMPtr<nsIDOMBlob> blob = aActor->GetBlob();
|
||||
nsRefPtr<FileImpl> impl = aActor->GetBlobImpl();
|
||||
nsCOMPtr<nsIDOMBlob> blob = new File(nullptr, impl);
|
||||
|
||||
return SendFile(aDeviceAddress, blob.get());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user