1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set sw=2 ts=8 et tw=80 : */
3 :
4 : /* ***** BEGIN LICENSE BLOCK *****
5 : * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 : *
7 : * The contents of this file are subject to the Mozilla Public License Version
8 : * 1.1 (the "License"); you may not use this file except in compliance with
9 : * the License. You may obtain a copy of the License at
10 : * http://www.mozilla.org/MPL/
11 : *
12 : * Software distributed under the License is distributed on an "AS IS" basis,
13 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14 : * for the specific language governing rights and limitations under the
15 : * License.
16 : *
17 : * The Original Code is mozilla.org code.
18 : *
19 : * The Initial Developer of the Original Code is
20 : * The Mozilla Foundation
21 : * Portions created by the Initial Developer are Copyright (C) 2009
22 : * the Initial Developer. All Rights Reserved.
23 : *
24 : * Contributor(s):
25 : * Jason Duell <jduell.mcbugs@gmail.com>
26 : *
27 : * Alternatively, the contents of this file may be used under the terms of
28 : * either the GNU General Public License Version 2 or later (the "GPL"), or
29 : * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
30 : * in which case the provisions of the GPL or the LGPL are applicable instead
31 : * of those above. If you wish to allow use of your version of this file only
32 : * under the terms of either the GPL or the LGPL, and not to allow others to
33 : * use your version of this file under the terms of the MPL, indicate your
34 : * decision by deleting the provisions above and replace them with the notice
35 : * and other provisions required by the GPL or the LGPL. If you do not delete
36 : * the provisions above, a recipient may use your version of this file under
37 : * the terms of any one of the MPL, the GPL or the LGPL.
38 : *
39 : * ***** END LICENSE BLOCK ***** */
40 :
41 : #include "nsHttp.h"
42 : #include "mozilla/net/NeckoParent.h"
43 : #include "mozilla/net/HttpChannelParent.h"
44 : #include "mozilla/net/CookieServiceParent.h"
45 : #include "mozilla/net/WyciwygChannelParent.h"
46 : #include "mozilla/net/FTPChannelParent.h"
47 : #include "mozilla/net/WebSocketChannelParent.h"
48 : #include "mozilla/dom/TabParent.h"
49 :
50 : #include "nsHTMLDNSPrefetch.h"
51 :
52 : using mozilla::dom::TabParent;
53 :
54 : namespace mozilla {
55 : namespace net {
56 :
57 : // C++ file contents
58 0 : NeckoParent::NeckoParent()
59 : {
60 0 : }
61 :
62 0 : NeckoParent::~NeckoParent()
63 : {
64 0 : }
65 :
66 : PHttpChannelParent*
67 0 : NeckoParent::AllocPHttpChannel(PBrowserParent* browser)
68 : {
69 0 : HttpChannelParent *p = new HttpChannelParent(browser);
70 0 : p->AddRef();
71 0 : return p;
72 : }
73 :
74 : bool
75 0 : NeckoParent::DeallocPHttpChannel(PHttpChannelParent* channel)
76 : {
77 0 : HttpChannelParent *p = static_cast<HttpChannelParent *>(channel);
78 0 : p->Release();
79 0 : return true;
80 : }
81 :
82 : PFTPChannelParent*
83 0 : NeckoParent::AllocPFTPChannel()
84 : {
85 0 : FTPChannelParent *p = new FTPChannelParent();
86 0 : p->AddRef();
87 0 : return p;
88 : }
89 :
90 : bool
91 0 : NeckoParent::DeallocPFTPChannel(PFTPChannelParent* channel)
92 : {
93 0 : FTPChannelParent *p = static_cast<FTPChannelParent *>(channel);
94 0 : p->Release();
95 0 : return true;
96 : }
97 :
98 : PCookieServiceParent*
99 0 : NeckoParent::AllocPCookieService()
100 : {
101 0 : return new CookieServiceParent();
102 : }
103 :
104 : bool
105 0 : NeckoParent::DeallocPCookieService(PCookieServiceParent* cs)
106 : {
107 0 : delete cs;
108 0 : return true;
109 : }
110 :
111 : PWyciwygChannelParent*
112 0 : NeckoParent::AllocPWyciwygChannel()
113 : {
114 0 : WyciwygChannelParent *p = new WyciwygChannelParent();
115 0 : p->AddRef();
116 0 : return p;
117 : }
118 :
119 : bool
120 0 : NeckoParent::DeallocPWyciwygChannel(PWyciwygChannelParent* channel)
121 : {
122 0 : WyciwygChannelParent *p = static_cast<WyciwygChannelParent *>(channel);
123 0 : p->Release();
124 0 : return true;
125 : }
126 :
127 : PWebSocketParent*
128 0 : NeckoParent::AllocPWebSocket(PBrowserParent* browser)
129 : {
130 0 : TabParent* tabParent = static_cast<TabParent*>(browser);
131 0 : WebSocketChannelParent* p = new WebSocketChannelParent(tabParent);
132 0 : p->AddRef();
133 0 : return p;
134 : }
135 :
136 : bool
137 0 : NeckoParent::DeallocPWebSocket(PWebSocketParent* actor)
138 : {
139 0 : WebSocketChannelParent* p = static_cast<WebSocketChannelParent*>(actor);
140 0 : p->Release();
141 0 : return true;
142 : }
143 :
144 : bool
145 0 : NeckoParent::RecvHTMLDNSPrefetch(const nsString& hostname,
146 : const PRUint16& flags)
147 : {
148 0 : nsHTMLDNSPrefetch::Prefetch(hostname, flags);
149 0 : return true;
150 : }
151 :
152 : bool
153 0 : NeckoParent::RecvCancelHTMLDNSPrefetch(const nsString& hostname,
154 : const PRUint16& flags,
155 : const nsresult& reason)
156 : {
157 0 : nsHTMLDNSPrefetch::CancelPrefetch(hostname, flags, reason);
158 0 : return true;
159 : }
160 :
161 : }} // mozilla::net
162 :
|