Source code

Revision control

Other Tools

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/. */
6
7
#ifndef NSDEFAULTURIFIXUP_H
8
#define NSDEFAULTURIFIXUP_H
9
10
#include "nsIURIFixup.h"
11
12
class nsDefaultURIFixupInfo;
13
14
/* Header file */
15
class nsDefaultURIFixup : public nsIURIFixup {
16
public:
17
NS_DECL_ISUPPORTS
18
NS_DECL_NSIURIFIXUP
19
20
nsDefaultURIFixup();
21
22
protected:
23
virtual ~nsDefaultURIFixup();
24
25
private:
26
/* additional members */
27
nsresult FileURIFixup(const nsACString& aStringURI, nsIURI** aURI);
28
nsresult ConvertFileToStringURI(const nsACString& aIn, nsCString& aResult);
29
nsresult FixupURIProtocol(const nsACString& aIn,
30
nsDefaultURIFixupInfo* aFixupInfo, nsIURI** aURI);
31
nsresult KeywordURIFixup(const nsACString& aStringURI,
32
nsDefaultURIFixupInfo* aFixupInfo,
33
bool aIsPrivateContext, nsIInputStream** aPostData);
34
nsresult TryKeywordFixupForURIInfo(const nsACString& aStringURI,
35
nsDefaultURIFixupInfo* aFixupInfo,
36
bool aIsPrivateContext,
37
nsIInputStream** aPostData);
38
bool PossiblyHostPortUrl(const nsACString& aUrl);
39
bool MakeAlternateURI(nsCOMPtr<nsIURI>& aURI);
40
bool IsDomainWhitelisted(const nsACString& aAsciiHost,
41
const uint32_t aDotLoc);
42
};
43
44
class nsDefaultURIFixupInfo : public nsIURIFixupInfo {
45
public:
46
NS_DECL_ISUPPORTS
47
NS_DECL_NSIURIFIXUPINFO
48
49
explicit nsDefaultURIFixupInfo(const nsACString& aOriginalInput);
50
51
friend class nsDefaultURIFixup;
52
53
protected:
54
virtual ~nsDefaultURIFixupInfo();
55
56
private:
57
nsCOMPtr<nsISupports> mConsumer;
58
nsCOMPtr<nsIURI> mPreferredURI;
59
nsCOMPtr<nsIURI> mFixedURI;
60
bool mFixupChangedProtocol;
61
bool mFixupCreatedAlternateURI;
62
nsString mKeywordProviderName;
63
nsString mKeywordAsSent;
64
nsCString mOriginalInput;
65
};
66
#endif