Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(678)

Side by Side Diff: content/browser/renderer_host/websocket_host.cc

Issue 1459473003: Add a WebContents getter callback in ResourceRequestInfo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Nasko's comment Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/browser/renderer_host/websocket_host.h" 5 #include "content/browser/renderer_host/websocket_host.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "base/thread_task_runner_handle.h" 12 #include "base/thread_task_runner_handle.h"
13 #include "content/browser/renderer_host/websocket_dispatcher_host.h" 13 #include "content/browser/renderer_host/websocket_dispatcher_host.h"
14 #include "content/browser/ssl/ssl_error_handler.h" 14 #include "content/browser/ssl/ssl_error_handler.h"
15 #include "content/browser/ssl/ssl_manager.h" 15 #include "content/browser/ssl/ssl_manager.h"
16 #include "content/common/websocket_messages.h" 16 #include "content/common/websocket_messages.h"
17 #include "content/public/browser/render_frame_host.h"
17 #include "ipc/ipc_message_macros.h" 18 #include "ipc/ipc_message_macros.h"
18 #include "net/http/http_request_headers.h" 19 #include "net/http/http_request_headers.h"
19 #include "net/http/http_response_headers.h" 20 #include "net/http/http_response_headers.h"
20 #include "net/http/http_util.h" 21 #include "net/http/http_util.h"
21 #include "net/ssl/ssl_info.h" 22 #include "net/ssl/ssl_info.h"
22 #include "net/websockets/websocket_channel.h" 23 #include "net/websockets/websocket_channel.h"
23 #include "net/websockets/websocket_errors.h" 24 #include "net/websockets/websocket_errors.h"
24 #include "net/websockets/websocket_event_interface.h" 25 #include "net/websockets/websocket_event_interface.h"
25 #include "net/websockets/websocket_frame.h" // for WebSocketFrameHeader::OpCode 26 #include "net/websockets/websocket_frame.h" // for WebSocketFrameHeader::OpCode
26 #include "net/websockets/websocket_handshake_request_info.h" 27 #include "net/websockets/websocket_handshake_request_info.h"
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 ChannelState WebSocketEventHandler::OnSSLCertificateError( 268 ChannelState WebSocketEventHandler::OnSSLCertificateError(
268 scoped_ptr<net::WebSocketEventInterface::SSLErrorCallbacks> callbacks, 269 scoped_ptr<net::WebSocketEventInterface::SSLErrorCallbacks> callbacks,
269 const GURL& url, 270 const GURL& url,
270 const net::SSLInfo& ssl_info, 271 const net::SSLInfo& ssl_info,
271 bool fatal) { 272 bool fatal) {
272 DVLOG(3) << "WebSocketEventHandler::OnSSLCertificateError" 273 DVLOG(3) << "WebSocketEventHandler::OnSSLCertificateError"
273 << " routing_id=" << routing_id_ << " url=" << url.spec() 274 << " routing_id=" << routing_id_ << " url=" << url.spec()
274 << " cert_status=" << ssl_info.cert_status << " fatal=" << fatal; 275 << " cert_status=" << ssl_info.cert_status << " fatal=" << fatal;
275 ssl_error_handler_delegate_.reset( 276 ssl_error_handler_delegate_.reset(
276 new SSLErrorHandlerDelegate(callbacks.Pass())); 277 new SSLErrorHandlerDelegate(callbacks.Pass()));
277 SSLManager::OnSSLCertificateError(ssl_error_handler_delegate_->GetWeakPtr(), 278 SSLManager::OnSSLCertificateSubresourceError(
278 RESOURCE_TYPE_SUB_RESOURCE, 279 ssl_error_handler_delegate_->GetWeakPtr(), url,
279 url, 280 dispatcher_->render_process_id(), render_frame_id_, ssl_info, fatal);
280 dispatcher_->render_process_id(),
281 render_frame_id_,
282 ssl_info,
283 fatal);
284 // The above method is always asynchronous. 281 // The above method is always asynchronous.
285 return WebSocketEventInterface::CHANNEL_ALIVE; 282 return WebSocketEventInterface::CHANNEL_ALIVE;
286 } 283 }
287 284
288 WebSocketEventHandler::SSLErrorHandlerDelegate::SSLErrorHandlerDelegate( 285 WebSocketEventHandler::SSLErrorHandlerDelegate::SSLErrorHandlerDelegate(
289 scoped_ptr<net::WebSocketEventInterface::SSLErrorCallbacks> callbacks) 286 scoped_ptr<net::WebSocketEventInterface::SSLErrorCallbacks> callbacks)
290 : callbacks_(callbacks.Pass()), weak_ptr_factory_(this) {} 287 : callbacks_(callbacks.Pass()), weak_ptr_factory_(this) {}
291 288
292 WebSocketEventHandler::SSLErrorHandlerDelegate::~SSLErrorHandlerDelegate() {} 289 WebSocketEventHandler::SSLErrorHandlerDelegate::~SSLErrorHandlerDelegate() {}
293 290
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 ""); 444 "");
448 DCHECK_EQ(WebSocketDispatcherHost::WEBSOCKET_HOST_DELETED, result); 445 DCHECK_EQ(WebSocketDispatcherHost::WEBSOCKET_HOST_DELETED, result);
449 return; 446 return;
450 } 447 }
451 448
452 // TODO(yhirano): Handle |was_clean| appropriately. 449 // TODO(yhirano): Handle |was_clean| appropriately.
453 channel_->StartClosingHandshake(code, reason); 450 channel_->StartClosingHandshake(code, reason);
454 } 451 }
455 452
456 } // namespace content 453 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/resource_request_info_impl.cc ('k') | content/browser/ssl/ssl_cert_error_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698