1635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project/*
2231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * Copyright (C) 2009 Apple Inc. All rights reserved.
3231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block * Copyright (C) 2009 Google Inc.  All rights reserved.
48f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian *
5635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project * Redistribution and use in source and binary forms, with or without
6635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project * modification, are permitted provided that the following conditions are
7635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project * met:
88f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian *
9635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project *     * Redistributions of source code must retain the above copyright
10635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project * notice, this list of conditions and the following disclaimer.
11635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project *     * Redistributions in binary form must reproduce the above
12635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project * copyright notice, this list of conditions and the following disclaimer
13635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project * in the documentation and/or other materials provided with the
14635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project * distribution.
15635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project *     * Neither the name of Google Inc. nor the names of its
16635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project * contributors may be used to endorse or promote products derived from
17635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project * this software without specific prior written permission.
188f72e70a9fd78eec56623b3a62e68f16b7b27e28Feng Qian *
19635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project */
31635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project
32231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#ifndef SocketStreamHandle_h
33231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#define SocketStreamHandle_h
34635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project
35231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#include "SocketStreamHandleBase.h"
365f1ab04193ad0130ca8204aadaceae083aca9881Feng Qian
375f1ab04193ad0130ca8204aadaceae083aca9881Feng Qian#include <wtf/PassRefPtr.h>
38231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#include <wtf/RefCounted.h>
39635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project
40635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Projectnamespace WebCore {
41635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project
42231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block    class AuthenticationChallenge;
43231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block    class Credential;
44231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block    class SocketStreamHandleClient;
455f1ab04193ad0130ca8204aadaceae083aca9881Feng Qian
46231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block    class SocketStreamHandle : public RefCounted<SocketStreamHandle>, public SocketStreamHandleBase {
475f1ab04193ad0130ca8204aadaceae083aca9881Feng Qian    public:
48231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block        static PassRefPtr<SocketStreamHandle> create(const KURL& url, SocketStreamHandleClient* client) { return adoptRef(new SocketStreamHandle(url, client)); }
49231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block
50231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block        virtual ~SocketStreamHandle();
51231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block
52231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block    protected:
53231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block        virtual int platformSend(const char* data, int length);
54231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block        virtual void platformClose();
555f1ab04193ad0130ca8204aadaceae083aca9881Feng Qian
565f1ab04193ad0130ca8204aadaceae083aca9881Feng Qian    private:
57231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block        SocketStreamHandle(const KURL&, SocketStreamHandleClient*);
58635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project
59231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block        // No authentication for streams per se, but proxy may ask for credentials.
60231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block        void didReceiveAuthenticationChallenge(const AuthenticationChallenge&);
61231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block        void receivedCredential(const AuthenticationChallenge&, const Credential&);
62231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block        void receivedRequestToContinueWithoutCredential(const AuthenticationChallenge&);
63231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block        void receivedCancellation(const AuthenticationChallenge&);
64231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block    };
65635860845790a19bf50bbc51ba8fb66a96dde068The Android Open Source Project
66231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block}  // namespace WebCore
675f1ab04193ad0130ca8204aadaceae083aca9881Feng Qian
68231d4e3152a9c27a73b6ac7badbe6be673aa3ddfSteve Block#endif  // SocketStreamHandle_h
69