| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/pepper/pepper_websocket_host.h" | 5 #include "content/renderer/pepper/pepper_websocket_host.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "content/public/renderer/renderer_ppapi_host.h" | 9 #include "content/public/renderer/renderer_ppapi_host.h" |
| 10 #include "net/base/net_util.h" | 10 #include "net/base/net_util.h" |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 const std::vector<std::string>& protocols) { | 206 const std::vector<std::string>& protocols) { |
| 207 // Validate url and convert it to WebURL. | 207 // Validate url and convert it to WebURL. |
| 208 GURL gurl(url); | 208 GURL gurl(url); |
| 209 url_ = gurl.spec(); | 209 url_ = gurl.spec(); |
| 210 if (!gurl.is_valid()) | 210 if (!gurl.is_valid()) |
| 211 return PP_ERROR_BADARGUMENT; | 211 return PP_ERROR_BADARGUMENT; |
| 212 if (!gurl.SchemeIs("ws") && !gurl.SchemeIs("wss")) | 212 if (!gurl.SchemeIs("ws") && !gurl.SchemeIs("wss")) |
| 213 return PP_ERROR_BADARGUMENT; | 213 return PP_ERROR_BADARGUMENT; |
| 214 if (gurl.has_ref()) | 214 if (gurl.has_ref()) |
| 215 return PP_ERROR_BADARGUMENT; | 215 return PP_ERROR_BADARGUMENT; |
| 216 if (!net::IsPortAllowedByDefault(gurl.IntPort())) | 216 if (!net::IsPortAllowedByDefault(gurl.EffectiveIntPort())) |
| 217 return PP_ERROR_BADARGUMENT; | 217 return PP_ERROR_BADARGUMENT; |
| 218 WebURL web_url(gurl); | 218 WebURL web_url(gurl); |
| 219 | 219 |
| 220 // Validate protocols. | 220 // Validate protocols. |
| 221 std::string protocol_string; | 221 std::string protocol_string; |
| 222 for (std::vector<std::string>::const_iterator vector_it = protocols.begin(); | 222 for (std::vector<std::string>::const_iterator vector_it = protocols.begin(); |
| 223 vector_it != protocols.end(); | 223 vector_it != protocols.end(); |
| 224 ++vector_it) { | 224 ++vector_it) { |
| 225 | 225 |
| 226 // Check containing characters. | 226 // Check containing characters. |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 | 319 |
| 320 int32_t PepperWebSocketHost::OnHostMsgFail( | 320 int32_t PepperWebSocketHost::OnHostMsgFail( |
| 321 ppapi::host::HostMessageContext* context, | 321 ppapi::host::HostMessageContext* context, |
| 322 const std::string& message) { | 322 const std::string& message) { |
| 323 if (websocket_) | 323 if (websocket_) |
| 324 websocket_->fail(WebString::fromUTF8(message)); | 324 websocket_->fail(WebString::fromUTF8(message)); |
| 325 return PP_OK; | 325 return PP_OK; |
| 326 } | 326 } |
| 327 | 327 |
| 328 } // namespace content | 328 } // namespace content |
| OLD | NEW |