source: trunk/Source/WebCore/platform/network/blackberry/SocketStreamHandle.h @ 101328

Revision 101328, 3.3 KB checked in by leo.yang@torchmobile.com.cn, 3 years ago (diff)

Upstream the BlackBerry porting of SocketStream
https://bugs.webkit.org/show_bug.cgi?id=73283

Reviewed by Daniel Bates.

Other main contributors:
Joe Mason <jmason@rim.com>
Lyon Chen <liachen@rim.com>

Initial upstream, can't be built yet, no new tests.

  • platform/network/blackberry/SocketStreamError.h: Added.

(WebCore::SocketStreamError::SocketStreamError):

  • platform/network/blackberry/SocketStreamHandle.h: Added.

(WebCore::SocketStreamHandle::create):

  • platform/network/blackberry/SocketStreamHandleBlackBerry.cpp: Added.

(WebCore::SocketStreamHandle::SocketStreamHandle):
(WebCore::SocketStreamHandle::~SocketStreamHandle):
(WebCore::SocketStreamHandle::platformSend):
(WebCore::SocketStreamHandle::platformClose):
(WebCore::SocketStreamHandle::didReceiveAuthenticationChallenge):
(WebCore::SocketStreamHandle::receivedCredential):
(WebCore::SocketStreamHandle::receivedRequestToContinueWithoutCredential):
(WebCore::SocketStreamHandle::receivedCancellation):
(WebCore::SocketStreamHandle::notifyStatusReceived):
(WebCore::SocketStreamHandle::notifyDataReceived):
(WebCore::SocketStreamHandle::notifyReadyToSendData):
(WebCore::SocketStreamHandle::notifyClose):

Line 
1/*
2 * Copyright (C) 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2009 Google Inc.  All rights reserved.
4 * Copyright (C) 2010 Research In Motion Limited. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met:
9 *
10 *     * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 *     * Redistributions in binary form must reproduce the above
13 * copyright notice, this list of conditions and the following disclaimer
14 * in the documentation and/or other materials provided with the
15 * distribution.
16 *     * Neither the name of Google Inc. nor the names of its
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#ifndef SocketStreamHandle_h
34#define SocketStreamHandle_h
35
36#include "SocketStreamHandleBase.h"
37
38#include <network/FilterStream.h>
39#include <wtf/OwnPtr.h>
40#include <wtf/PassRefPtr.h>
41#include <wtf/RefCounted.h>
42
43namespace WebCore {
44
45class AuthenticationChallenge;
46class Credential;
47class SocketStreamHandleClient;
48
49class SocketStreamHandle : public RefCounted<SocketStreamHandle>, public BlackBerry::Platform::FilterStream, public SocketStreamHandleBase {
50public:
51    static PassRefPtr<SocketStreamHandle> create(const String& groupName, const KURL& url, SocketStreamHandleClient* client) { return adoptRef(new SocketStreamHandle(groupName, url, client)); }
52
53    virtual ~SocketStreamHandle();
54
55    // FilterStream interface
56    virtual void notifyStatusReceived(int status, const char* message);
57    virtual void notifyDataReceived(BlackBerry::Platform::NetworkBuffer*);
58    virtual void notifyReadyToSendData();
59    virtual void notifyClose(int status);
60
61protected:
62    virtual int platformSend(const char* data, int length);
63    virtual void platformClose();
64
65private:
66    SocketStreamHandle(const String& groupName, const KURL&, SocketStreamHandleClient*);
67
68    // No authentication for streams per se, but proxy may ask for credentials.
69    void didReceiveAuthenticationChallenge(const AuthenticationChallenge&);
70    void receivedCredential(const AuthenticationChallenge&, const Credential&);
71    void receivedRequestToContinueWithoutCredential(const AuthenticationChallenge&);
72    void receivedCancellation(const AuthenticationChallenge&);
73
74    OwnPtr<BlackBerry::Platform::FilterStream> m_socketStream;
75};
76
77} // namespace WebCore
78
79#endif // SocketStreamHandle_h
Note: See TracBrowser for help on using the repository browser.