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

Side by Side Diff: content/renderer/media/dtls_identity_service.cc

Issue 15969025: Generates the DTLS identity in browser process and returns it to render process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 7 years, 6 months 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
(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 #include "content/renderer/media/dtls_identity_service.h"
6
7 #include "content/common/media/dtls_identity_messages.h"
8 #include "content/public/renderer/render_thread.h"
9
10 namespace content {
11
12 DTLSIdentityService::DTLSIdentityService(
13 const GURL& origin,
14 scoped_ptr<DTLSIdentityObserver>& observer)
15 : origin_(origin) {
16 DCHECK(observer);
17 observer_.reset(observer.release());
18 RenderThread::Get()->AddObserver(this);
19 }
20
21 DTLSIdentityService::~DTLSIdentityService() {
22 RenderThread::Get()->RemoveObserver(this);
23 }
24
25 void DTLSIdentityService::RequestIdentity(
26 const std::string& identity_name,
27 const std::string& common_name) {
28 RenderThread::Get()->Send(
29 new DTLSIdentityMsg_RequestIdentity(origin_, identity_name, common_name));
30 DLOG(INFO) << "DTLSIdentityService::RequestIdentity";
31 }
32
33 bool DTLSIdentityService::OnControlMessageReceived(
34 const IPC::Message& message) {
35 bool handled = true;
36 IPC_BEGIN_MESSAGE_MAP(DTLSIdentityService, message)
37 IPC_MESSAGE_HANDLER(DTLSIdentityHostMsg_IdentityReady, OnIdentityReady)
38 IPC_MESSAGE_UNHANDLED(handled = false)
39 IPC_END_MESSAGE_MAP()
40 return handled;
41 }
42
43 void DTLSIdentityService::OnIdentityReady(const std::string& certificate,
44 const std::string& private_key) {
45 DLOG(INFO) << "DTLSIdentityService::OnIdentityReady";
46 observer_->OnCompleted(certificate, private_key);
47 }
48
49 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698