OLD | NEW |
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/media/webrtc_identity_service_host.h" | 5 #include "content/browser/renderer_host/media/webrtc_identity_service_host.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "content/browser/child_process_security_policy_impl.h" | 9 #include "content/browser/child_process_security_policy_impl.h" |
10 #include "content/browser/media/webrtc_identity_store.h" | 10 #include "content/browser/media/webrtc_identity_store.h" |
11 #include "content/common/media/webrtc_identity_messages.h" | 11 #include "content/common/media/webrtc_identity_messages.h" |
12 #include "net/base/net_errors.h" | 12 #include "net/base/net_errors.h" |
13 | 13 |
14 namespace content { | 14 namespace content { |
15 | 15 |
16 WebRTCIdentityServiceHost::WebRTCIdentityServiceHost( | 16 WebRTCIdentityServiceHost::WebRTCIdentityServiceHost( |
17 int renderer_process_id, | 17 int renderer_process_id, |
18 scoped_refptr<WebRTCIdentityStore> identity_store) | 18 scoped_refptr<WebRTCIdentityStore> identity_store) |
19 : BrowserMessageFilter(WebRTCIdentityMsgStart), | 19 : BrowserMessageFilter(WebRTCIdentityMsgStart), |
20 renderer_process_id_(renderer_process_id), | 20 renderer_process_id_(renderer_process_id), |
21 identity_store_(identity_store), | 21 identity_store_(identity_store), |
22 weak_factory_(this) {} | 22 weak_factory_(this) {} |
23 | 23 |
24 WebRTCIdentityServiceHost::~WebRTCIdentityServiceHost() { | 24 WebRTCIdentityServiceHost::~WebRTCIdentityServiceHost() { |
25 if (!cancel_callback_.is_null()) | 25 if (!cancel_callback_.is_null()) |
26 cancel_callback_.Run(); | 26 cancel_callback_.Run(); |
27 } | 27 } |
28 | 28 |
29 bool WebRTCIdentityServiceHost::OnMessageReceived(const IPC::Message& message, | 29 bool WebRTCIdentityServiceHost::OnMessageReceived(const IPC::Message& message) { |
30 bool* message_was_ok) { | |
31 bool handled = true; | 30 bool handled = true; |
32 IPC_BEGIN_MESSAGE_MAP_EX(WebRTCIdentityServiceHost, message, *message_was_ok) | 31 IPC_BEGIN_MESSAGE_MAP(WebRTCIdentityServiceHost, message) |
33 IPC_MESSAGE_HANDLER(WebRTCIdentityMsg_RequestIdentity, OnRequestIdentity) | 32 IPC_MESSAGE_HANDLER(WebRTCIdentityMsg_RequestIdentity, OnRequestIdentity) |
34 IPC_MESSAGE_HANDLER(WebRTCIdentityMsg_CancelRequest, OnCancelRequest) | 33 IPC_MESSAGE_HANDLER(WebRTCIdentityMsg_CancelRequest, OnCancelRequest) |
35 IPC_MESSAGE_UNHANDLED(handled = false) | 34 IPC_MESSAGE_UNHANDLED(handled = false) |
36 IPC_END_MESSAGE_MAP_EX() | 35 IPC_END_MESSAGE_MAP() |
37 return handled; | 36 return handled; |
38 } | 37 } |
39 | 38 |
40 void WebRTCIdentityServiceHost::OnRequestIdentity( | 39 void WebRTCIdentityServiceHost::OnRequestIdentity( |
41 int sequence_number, | 40 int sequence_number, |
42 const GURL& origin, | 41 const GURL& origin, |
43 const std::string& identity_name, | 42 const std::string& identity_name, |
44 const std::string& common_name) { | 43 const std::string& common_name) { |
45 if (!cancel_callback_.is_null()) { | 44 if (!cancel_callback_.is_null()) { |
46 DLOG(WARNING) | 45 DLOG(WARNING) |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 SendErrorMessage(sequence_number, status); | 87 SendErrorMessage(sequence_number, status); |
89 } | 88 } |
90 } | 89 } |
91 | 90 |
92 void WebRTCIdentityServiceHost::SendErrorMessage(int sequence_number, | 91 void WebRTCIdentityServiceHost::SendErrorMessage(int sequence_number, |
93 int error) { | 92 int error) { |
94 Send(new WebRTCIdentityHostMsg_RequestFailed(sequence_number, error)); | 93 Send(new WebRTCIdentityHostMsg_RequestFailed(sequence_number, error)); |
95 } | 94 } |
96 | 95 |
97 } // namespace content | 96 } // namespace content |
OLD | NEW |