Chromium Code Reviews| OLD | NEW |
|---|---|
| 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_renderer_controller.h" | 5 #include "media/remoting/remoting_renderer_controller.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/threading/thread_checker.h" | 9 #include "base/threading/thread_checker.h" |
| 10 #include "media/remoting/remoting_cdm_context.h" | 10 #include "media/remoting/remoting_cdm_context.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 auto* remoting_cdm_context = RemotingCdmContext::From(cdm_context); | 66 auto* remoting_cdm_context = RemotingCdmContext::From(cdm_context); |
| 67 if (!remoting_cdm_context) | 67 if (!remoting_cdm_context) |
| 68 return; | 68 return; |
| 69 | 69 |
| 70 remoting_source_->RemoveClient(this); | 70 remoting_source_->RemoveClient(this); |
| 71 remoting_source_ = remoting_cdm_context->GetRemotingSource(); | 71 remoting_source_ = remoting_cdm_context->GetRemotingSource(); |
| 72 remoting_source_->AddClient(this); // Calls OnSessionStateChanged(). | 72 remoting_source_->AddClient(this); // Calls OnSessionStateChanged(). |
| 73 UpdateAndMaybeSwitch(); | 73 UpdateAndMaybeSwitch(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 void RemotingRendererController::OnSetPoster(const GURL& poster) { | |
| 77 DCHECK(thread_checker_.CalledOnValidThread()); | |
| 78 poster_ = poster; | |
|
miu
2016/11/29 22:56:08
See Model-View-Controller comment in header file.
xjz
2016/12/02 19:23:11
Done.
| |
| 79 } | |
| 80 | |
| 76 void RemotingRendererController::SetSwitchRendererCallback( | 81 void RemotingRendererController::SetSwitchRendererCallback( |
| 77 const base::Closure& cb) { | 82 const base::Closure& cb) { |
| 78 DCHECK(thread_checker_.CalledOnValidThread()); | 83 DCHECK(thread_checker_.CalledOnValidThread()); |
| 79 DCHECK(!cb.is_null()); | 84 DCHECK(!cb.is_null()); |
| 80 | 85 |
| 81 switch_renderer_cb_ = cb; | 86 switch_renderer_cb_ = cb; |
| 82 UpdateAndMaybeSwitch(); | 87 UpdateAndMaybeSwitch(); |
| 83 } | 88 } |
| 84 | 89 |
| 85 base::WeakPtr<remoting::RpcBroker> RemotingRendererController::GetRpcBroker() | 90 base::WeakPtr<remoting::RpcBroker> RemotingRendererController::GetRpcBroker() |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 236 // For encrypted content, it's only valid to switch to remoting renderer, | 241 // For encrypted content, it's only valid to switch to remoting renderer, |
| 237 // and never back to the local renderer. The RemotingCdmController will | 242 // and never back to the local renderer. The RemotingCdmController will |
| 238 // force-stop the session when remoting has ended; so no need to call | 243 // force-stop the session when remoting has ended; so no need to call |
| 239 // StopRemoting() from here. | 244 // StopRemoting() from here. |
| 240 DCHECK(!is_encrypted_); | 245 DCHECK(!is_encrypted_); |
| 241 switch_renderer_cb_.Run(); | 246 switch_renderer_cb_.Run(); |
| 242 remoting_source_->StopRemoting(this); | 247 remoting_source_->StopRemoting(this); |
| 243 } | 248 } |
| 244 } | 249 } |
| 245 | 250 |
| 251 void RemotingRendererController::SetDownloadPosterCallback( | |
| 252 const DownloadPosterCallback& cb) { | |
| 253 DCHECK(thread_checker_.CalledOnValidThread()); | |
| 254 DCHECK(download_poster_cb_.is_null()); | |
| 255 download_poster_cb_ = cb; | |
| 256 } | |
| 257 | |
| 246 } // namespace media | 258 } // namespace media |
| OLD | NEW |