Chromium Code Reviews| 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 <map> | |
| 9 #include <queue> | |
| 10 #include <string> | |
| 11 | |
| 12 #include "base/basictypes.h" | |
| 13 #include "base/time.h" | |
| 14 #include "content/browser/media/webrtc_identity_store.h" | |
| 15 #include "content/public/browser/browser_message_filter.h" | |
| 16 | |
| 17 class GURL; | |
| 18 | |
| 19 namespace content { | |
| 20 | |
| 21 // This class is the host for WebRTCIdentityService in the browser process. | |
| 22 // It converts the IPC messages for requesting a WebRTC DTLS identity and | |
| 23 // cancelling a pending request into calls of WebRTCIdentityStore. It also sends | |
| 24 // the request result back to the renderer through IPC. | |
| 25 // Only one outstanding request is allowed per renderer at a time. If a second | |
|
Ami GONE FROM CHROMIUM
2013/06/27 21:30:32
I wasn't part of the conversation that led to this
jiayl
2013/06/27 21:48:28
It's for the security concern that an evil rendere
| |
| 26 // request is made before the first one completes, an IPC with error | |
| 27 // ERR_INSUFFICIENT_RESOURCES will be sent back to the renderer. | |
| 28 class WebRTCIdentityServiceHost : public BrowserMessageFilter { | |
| 29 public: | |
| 30 explicit WebRTCIdentityServiceHost(WebRTCIdentityStore* identity_store); | |
| 31 | |
| 32 private: | |
| 33 virtual ~WebRTCIdentityServiceHost(); | |
| 34 | |
| 35 // content::BrowserMessageFilter override. | |
| 36 virtual bool OnMessageReceived(const IPC::Message& message, | |
| 37 bool* message_was_ok) OVERRIDE; | |
| 38 | |
| 39 void OnComplete(int request_id, | |
| 40 int error, | |
| 41 const std::string& certificate, | |
| 42 const std::string& private_key); | |
| 43 | |
| 44 // Requests a DTLS identity from the DTLS identity store for the given | |
| 45 // |origin| and |identity_name|. If no such identity exists, a new one will be | |
| 46 // generated using the given |common_name|. | |
| 47 // |request_id| is a unique id chosen by the client and used to cancel a | |
| 48 // pending request. | |
| 49 void OnRequestIdentity(int request_id, | |
| 50 const GURL& origin, | |
| 51 const std::string& identity_name, | |
| 52 const std::string& common_name); | |
| 53 | |
| 54 // Cancels a pending request by its id. If there is no pending request having | |
| 55 // the same id, the call is ignored. | |
| 56 void OnCancelRequest(int request_id); | |
| 57 | |
| 58 void SendErrorMessage(int request_id, int error); | |
| 59 | |
| 60 base::Closure cancel_callback_; | |
| 61 WebRTCIdentityStore* identity_store_; | |
| 62 | |
| 63 DISALLOW_COPY_AND_ASSIGN(WebRTCIdentityServiceHost); | |
| 64 }; | |
| 65 | |
| 66 } // namespace content | |
| 67 | |
| 68 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_WEBRTC_IDENTITY_SERVICE_HOST_H_ | |
| OLD | NEW |