Bug 1885565 - Part 1: Add mozac_ic_avatar_circle_24 to ui-icons r=android-reviewers...
[gecko.git] / netwerk / base / nsIBaseChannel.idl
blob5f2fe1517de49c70d2eea4ea4fd5ba9207abda75
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/. */
5 #include "nsISupports.idl"
7 %{C++
8 #include "mozilla/dom/MimeType.h"
9 #include "mozilla/net/ContentRange.h"
12 /**
13 * The nsIBaseChannel interface allows C++ code to query the interface
14 * of channels safely to gain access to content range functionality.
15 * This allows subclasses to optionally handle range-requests on their
16 * types using fetch/XMLHttpRequest even if they are not accessed via
17 * HTTP and therefore normally do not have support for headers.
20 native ContentRangeRef(RefPtr<mozilla::net::ContentRange>);
21 native MimeTypeRef(RefPtr<TMimeType<char>>);
23 [uuid(036d5cd7-9a53-40e3-9c72-c2ffaa15aa2b)]
24 interface nsIBaseChannel : nsISupports {
26 /**
27 * Used by fetch and XMLHttpRequest to get only the range specified in the
28 * Range request header (if given) for the response body (e.g, for blob URLs)
30 attribute ContentRangeRef contentRange;
32 /**
33 * Used by fetch and XMLHttpRequest to get the standards-compliant value they
34 * should set for the Content-Type header on response (if nullptr, they will
35 * use Firefox-specific values from nsIChannel::GetContentType and GetCharset).
37 attribute MimeTypeRef fullMimeType;
39 %{C++
40 RefPtr<mozilla::net::ContentRange> ContentRange() {
41 RefPtr<mozilla::net::ContentRange> range;
42 mozilla::Unused << GetContentRange(&range);
43 return range;
46 bool SetContentRangeFromHeader(const nsACString& aHeader, uint64_t aSize) {
47 RefPtr<mozilla::net::ContentRange> range =
48 new mozilla::net::ContentRange(aHeader, aSize);
49 if (!range->IsValid()) {
50 return false;
52 SetContentRange(range);
53 return true;
56 RefPtr<CMimeType> FullMimeType() {
57 RefPtr<CMimeType> type;
58 mozilla::Unused << GetFullMimeType(&type);
59 return type;