| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 #include "wtf/PassOwnPtr.h" | 39 #include "wtf/PassOwnPtr.h" |
| 40 #include "wtf/text/WTFString.h" | 40 #include "wtf/text/WTFString.h" |
| 41 | 41 |
| 42 namespace WebCore { | 42 namespace WebCore { |
| 43 | 43 |
| 44 class ScriptExecutionContext; | 44 class ScriptExecutionContext; |
| 45 | 45 |
| 46 class WebSocketHandshake { | 46 class WebSocketHandshake { |
| 47 WTF_MAKE_NONCOPYABLE(WebSocketHandshake); WTF_MAKE_FAST_ALLOCATED; | 47 WTF_MAKE_NONCOPYABLE(WebSocketHandshake); WTF_MAKE_FAST_ALLOCATED; |
| 48 public: | 48 public: |
| 49 // This enum is reused for histogram. When this needs to be modified, add a |
| 50 // new enum for histogram and convert mode values into values in the new |
| 51 // enum to keep new data consistent with old one. |
| 49 enum Mode { | 52 enum Mode { |
| 50 Incomplete, Normal, Failed, Connected | 53 Incomplete, Normal, Failed, Connected, ModeMax |
| 51 }; | 54 }; |
| 52 WebSocketHandshake(const KURL&, const String& protocol, ScriptExecutionConte
xt*); | 55 WebSocketHandshake(const KURL&, const String& protocol, ScriptExecutionConte
xt*); |
| 53 ~WebSocketHandshake(); | 56 ~WebSocketHandshake(); |
| 54 | 57 |
| 55 const KURL& url() const; | 58 const KURL& url() const; |
| 56 void setURL(const KURL&); | 59 void setURL(const KURL&); |
| 57 const String host() const; | 60 const String host() const; |
| 58 | 61 |
| 59 const String& clientProtocol() const; | 62 const String& clientProtocol() const; |
| 60 void setClientProtocol(const String&); | 63 void setClientProtocol(const String&); |
| 61 | 64 |
| 62 bool secure() const; | 65 bool secure() const; |
| 63 | 66 |
| 64 String clientOrigin() const; | 67 String clientOrigin() const; |
| 65 String clientLocation() const; | 68 String clientLocation() const; |
| 66 | 69 |
| 67 CString clientHandshakeMessage() const; | 70 CString clientHandshakeMessage() const; |
| 68 PassRefPtr<WebSocketHandshakeRequest> clientHandshakeRequest() const; | 71 PassRefPtr<WebSocketHandshakeRequest> clientHandshakeRequest() const; |
| 69 | 72 |
| 73 // We're collecting data for histogram in the destructor. Note that calling |
| 74 // this method affects that. |
| 70 void reset(); | 75 void reset(); |
| 71 void clearScriptExecutionContext(); | 76 void clearScriptExecutionContext(); |
| 72 | 77 |
| 73 int readServerHandshake(const char* header, size_t len); | 78 int readServerHandshake(const char* header, size_t len); |
| 74 Mode mode() const; | 79 Mode mode() const; |
| 75 String failureReason() const; // Returns a string indicating the reason of f
ailure if mode() == Failed. | 80 String failureReason() const; // Returns a string indicating the reason of f
ailure if mode() == Failed. |
| 76 | 81 |
| 77 String serverWebSocketProtocol() const; | 82 String serverWebSocketProtocol() const; |
| 78 String serverSetCookie() const; | 83 String serverSetCookie() const; |
| 79 String serverSetCookie2() const; | 84 String serverSetCookie2() const; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 | 116 |
| 112 String m_secWebSocketKey; | 117 String m_secWebSocketKey; |
| 113 String m_expectedAccept; | 118 String m_expectedAccept; |
| 114 | 119 |
| 115 WebSocketExtensionDispatcher m_extensionDispatcher; | 120 WebSocketExtensionDispatcher m_extensionDispatcher; |
| 116 }; | 121 }; |
| 117 | 122 |
| 118 } // namespace WebCore | 123 } // namespace WebCore |
| 119 | 124 |
| 120 #endif // WebSocketHandshake_h | 125 #endif // WebSocketHandshake_h |
| OLD | NEW |