| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 m_url = url; | 167 m_url = url; |
| 168 Vector<String> protocols; | 168 Vector<String> protocols; |
| 169 // Avoid placing an empty token in the Vector when the protocol string is | 169 // Avoid placing an empty token in the Vector when the protocol string is |
| 170 // empty. | 170 // empty. |
| 171 if (!protocol.isEmpty()) { | 171 if (!protocol.isEmpty()) { |
| 172 // Since protocol is already verified and escaped, we can simply split | 172 // Since protocol is already verified and escaped, we can simply split |
| 173 // it. | 173 // it. |
| 174 protocol.split(", ", true, protocols); | 174 protocol.split(", ", true, protocols); |
| 175 } | 175 } |
| 176 | 176 |
| 177 if (document()->frame()) { | 177 m_handle->initialize(Platform::current()->interfaceProvider()); |
| 178 // Initialize the WebSocketHandle with the frame's InterfaceProvider to | |
| 179 // provide the WebSocket implementation with context about this frame. | |
| 180 // This is important so that the browser can show UI associated with | |
| 181 // the WebSocket (e.g., for certificate errors). | |
| 182 m_handle->initialize(document()->frame()->interfaceProvider()); | |
| 183 } else { | |
| 184 m_handle->initialize(Platform::current()->interfaceProvider()); | |
| 185 } | |
| 186 m_handle->connect(url, protocols, document()->getSecurityOrigin(), | 178 m_handle->connect(url, protocols, document()->getSecurityOrigin(), |
| 187 document()->firstPartyForCookies(), document()->userAgent(), | 179 document()->firstPartyForCookies(), document()->userAgent(), |
| 188 this); | 180 this); |
| 189 | 181 |
| 190 flowControlIfNecessary(); | 182 flowControlIfNecessary(); |
| 191 TRACE_EVENT_INSTANT1("devtools.timeline", "WebSocketCreate", | 183 TRACE_EVENT_INSTANT1("devtools.timeline", "WebSocketCreate", |
| 192 TRACE_EVENT_SCOPE_THREAD, "data", | 184 TRACE_EVENT_SCOPE_THREAD, "data", |
| 193 InspectorWebSocketCreateEvent::data( | 185 InspectorWebSocketCreateEvent::data( |
| 194 document(), m_identifier, url, protocol)); | 186 document(), m_identifier, url, protocol)); |
| 195 InspectorInstrumentation::didCreateWebSocket(document(), m_identifier, url, | 187 InspectorInstrumentation::didCreateWebSocket(document(), m_identifier, url, |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 WebSocketChannel::trace(visitor); | 645 WebSocketChannel::trace(visitor); |
| 654 } | 646 } |
| 655 | 647 |
| 656 std::ostream& operator<<(std::ostream& ostream, | 648 std::ostream& operator<<(std::ostream& ostream, |
| 657 const DocumentWebSocketChannel* channel) { | 649 const DocumentWebSocketChannel* channel) { |
| 658 return ostream << "DocumentWebSocketChannel " | 650 return ostream << "DocumentWebSocketChannel " |
| 659 << static_cast<const void*>(channel); | 651 << static_cast<const void*>(channel); |
| 660 } | 652 } |
| 661 | 653 |
| 662 } // namespace blink | 654 } // namespace blink |
| OLD | NEW |