OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_WEBRTC_IDENTITY_SERVICE_HOST_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_WEBRTC_IDENTITY_SERVICE_HOST_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "content/public/browser/browser_message_filter.h" |
| 12 |
| 13 class GURL; |
| 14 |
| 15 namespace content { |
| 16 |
| 17 class WebRTCIdentityStore; |
| 18 |
| 19 // This class is the host for WebRTCIdentityService in the browser process. |
| 20 // It converts the IPC messages for requesting a WebRTC DTLS identity and |
| 21 // cancelling a pending request into calls of WebRTCIdentityStore. It also sends |
| 22 // the request result back to the renderer through IPC. |
| 23 // Only one outstanding request is allowed per renderer at a time. If a second |
| 24 // request is made before the first one completes, an IPC with error |
| 25 // ERR_INSUFFICIENT_RESOURCES will be sent back to the renderer. |
| 26 class WebRTCIdentityServiceHost : public BrowserMessageFilter { |
| 27 public: |
| 28 explicit WebRTCIdentityServiceHost(WebRTCIdentityStore* identity_store); |
| 29 |
| 30 private: |
| 31 virtual ~WebRTCIdentityServiceHost(); |
| 32 |
| 33 // content::BrowserMessageFilter override. |
| 34 virtual bool OnMessageReceived(const IPC::Message& message, |
| 35 bool* message_was_ok) OVERRIDE; |
| 36 |
| 37 void OnComplete(int request_id, |
| 38 int error, |
| 39 const std::string& certificate, |
| 40 const std::string& private_key); |
| 41 |
| 42 // Requests a DTLS identity from the DTLS identity store for the given |
| 43 // |origin| and |identity_name|. If no such identity exists, a new one will be |
| 44 // generated using the given |common_name|. |
| 45 // |request_id| is a unique id chosen by the client and used to cancel a |
| 46 // pending request. |
| 47 void OnRequestIdentity(int request_id, |
| 48 const GURL& origin, |
| 49 const std::string& identity_name, |
| 50 const std::string& common_name); |
| 51 |
| 52 // Cancels a pending request by its id. If there is no pending request having |
| 53 // the same id, the call is ignored. |
| 54 void OnCancelRequest(int request_id); |
| 55 |
| 56 void SendErrorMessage(int request_id, int error); |
| 57 |
| 58 base::Closure cancel_callback_; |
| 59 WebRTCIdentityStore* identity_store_; |
| 60 |
| 61 DISALLOW_COPY_AND_ASSIGN(WebRTCIdentityServiceHost); |
| 62 }; |
| 63 |
| 64 } // namespace content |
| 65 |
| 66 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_WEBRTC_IDENTITY_SERVICE_HOST_H_ |
OLD | NEW |