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

Side by Side Diff: media/remoting/remoting_cdm_factory.cc

Issue 2643253003: Media Remoting Clean-up: Less-redundant naming, style consistency, etc. (Closed)
Patch Set: REBASE Created 3 years, 10 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
« no previous file with comments | « media/remoting/remoting_cdm_factory.h ('k') | media/remoting/remoting_interstitial_ui.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "media/remoting/remoting_cdm_factory.h" 5 #include "media/remoting/remoting_cdm_factory.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "media/base/cdm_config.h" 10 #include "media/base/cdm_config.h"
11 #include "media/remoting/remoting_cdm.h" 11 #include "media/remoting/remoting_cdm.h"
12 12
13 namespace media { 13 namespace media {
14 namespace remoting {
14 15
15 RemotingCdmFactory::RemotingCdmFactory( 16 RemotingCdmFactory::RemotingCdmFactory(
16 std::unique_ptr<CdmFactory> default_cdm_factory, 17 std::unique_ptr<CdmFactory> default_cdm_factory,
17 mojom::RemoterFactory* remoter_factory, 18 mojom::RemoterFactory* remoter_factory,
18 std::unique_ptr<RemotingSinkObserver> sink_observer) 19 std::unique_ptr<SinkAvailabilityObserver> sink_observer)
19 : default_cdm_factory_(std::move(default_cdm_factory)), 20 : default_cdm_factory_(std::move(default_cdm_factory)),
20 remoter_factory_(remoter_factory), 21 remoter_factory_(remoter_factory),
21 sink_observer_(std::move(sink_observer)), 22 sink_observer_(std::move(sink_observer)),
22 weak_factory_(this) { 23 weak_factory_(this) {
23 DCHECK(default_cdm_factory_); 24 DCHECK(default_cdm_factory_);
24 DCHECK(remoter_factory_); 25 DCHECK(remoter_factory_);
25 DCHECK(sink_observer_); 26 DCHECK(sink_observer_);
26 } 27 }
27 28
28 RemotingCdmFactory::~RemotingCdmFactory() {} 29 RemotingCdmFactory::~RemotingCdmFactory() {}
29 30
30 std::unique_ptr<RemotingCdmController> 31 std::unique_ptr<RemotingCdmController>
31 RemotingCdmFactory::CreateRemotingCdmController() { 32 RemotingCdmFactory::CreateRemotingCdmController() {
32 mojom::RemotingSourcePtr remoting_source; 33 mojom::RemotingSourcePtr remoting_source;
33 mojom::RemotingSourceRequest remoting_source_request(&remoting_source); 34 mojom::RemotingSourceRequest remoting_source_request(&remoting_source);
34 mojom::RemoterPtr remoter; 35 mojom::RemoterPtr remoter;
35 remoter_factory_->Create(std::move(remoting_source), 36 remoter_factory_->Create(std::move(remoting_source),
36 mojo::MakeRequest(&remoter)); 37 mojo::MakeRequest(&remoter));
37 scoped_refptr<RemotingSourceImpl> remoting_source_impl = 38 scoped_refptr<SharedSession> session =
38 new RemotingSourceImpl(std::move(remoting_source_request), 39 new SharedSession(std::move(remoting_source_request), std::move(remoter));
39 std::move(remoter));
40 // HACK: Copy-over the sink availability status from |sink_observer_| before 40 // HACK: Copy-over the sink availability status from |sink_observer_| before
41 // the RemotingCdmController would naturally get the notification. This is to 41 // the RemotingCdmController would naturally get the notification. This is to
42 // avoid the possible delay on OnSinkAvailable() call from browser. 42 // avoid the possible delay on OnSinkAvailable() call from browser.
43 if (sink_observer_->is_remote_decryption_available()) 43 if (sink_observer_->is_remote_decryption_available())
44 remoting_source_impl->OnSinkAvailable(sink_observer_->sink_capabilities()); 44 session->OnSinkAvailable(sink_observer_->sink_capabilities());
45 return base::MakeUnique<RemotingCdmController>(remoting_source_impl); 45 return base::MakeUnique<RemotingCdmController>(std::move(session));
46 } 46 }
47 47
48 // TODO(xjz): Replace the callbacks with an interface. http://crbug.com/657940. 48 // TODO(xjz): Replace the callbacks with an interface. http://crbug.com/657940.
49 void RemotingCdmFactory::Create( 49 void RemotingCdmFactory::Create(
50 const std::string& key_system, 50 const std::string& key_system,
51 const GURL& security_origin, 51 const GURL& security_origin,
52 const CdmConfig& cdm_config, 52 const CdmConfig& cdm_config,
53 const SessionMessageCB& session_message_cb, 53 const SessionMessageCB& session_message_cb,
54 const SessionClosedCB& session_closed_cb, 54 const SessionClosedCB& session_closed_cb,
55 const SessionKeysChangeCB& session_keys_change_cb, 55 const SessionKeysChangeCB& session_keys_change_cb,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 NOTIMPLEMENTED(); 93 NOTIMPLEMENTED();
94 } else { 94 } else {
95 VLOG(1) << "Create default CDM."; 95 VLOG(1) << "Create default CDM.";
96 default_cdm_factory_->Create(key_system, security_origin, cdm_config, 96 default_cdm_factory_->Create(key_system, security_origin, cdm_config,
97 session_message_cb, session_closed_cb, 97 session_message_cb, session_closed_cb,
98 session_keys_change_cb, 98 session_keys_change_cb,
99 session_expiration_update_cb, cdm_created_cb); 99 session_expiration_update_cb, cdm_created_cb);
100 } 100 }
101 } 101 }
102 102
103 } // namespace remoting
103 } // namespace media 104 } // namespace media
OLDNEW
« no previous file with comments | « media/remoting/remoting_cdm_factory.h ('k') | media/remoting/remoting_interstitial_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698