1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "GeckoViewContentChannel.h"
8 #include "GeckoViewInputStream.h"
9 #include "mozilla/java/ContentInputStreamWrappers.h"
11 using namespace mozilla
;
13 GeckoViewContentChannel::GeckoViewContentChannel(nsIURI
* aURI
) {
19 GeckoViewContentChannel::OpenContentStream(bool aAsync
,
20 nsIInputStream
** aResult
,
21 nsIChannel
** aChannel
) {
23 nsresult rv
= GetURI(getter_AddRefs(uri
));
24 NS_ENSURE_SUCCESS(rv
, NS_ERROR_MALFORMED_URI
);
27 rv
= uri
->GetSpec(spec
);
28 NS_ENSURE_SUCCESS(rv
, rv
);
30 bool isReadable
= GeckoViewContentInputStream::isReadable(spec
);
32 return NS_ERROR_FILE_NOT_FOUND
;
35 nsCOMPtr
<nsIInputStream
> inputStream
;
36 rv
= GeckoViewContentInputStream::getInstance(spec
,
37 getter_AddRefs(inputStream
));
38 NS_ENSURE_SUCCESS(rv
, rv
);
40 if (NS_WARN_IF(!inputStream
)) {
41 return NS_ERROR_MALFORMED_URI
;
44 inputStream
.forget(aResult
);