Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chromecast/media/cdm/browser_cdm_cast.h" | 5 #include "chromecast/media/cdm/browser_cdm_cast.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 119 session_message_cb_.Run(session_id, | 119 session_message_cb_.Run(session_id, |
| 120 message_type, | 120 message_type, |
| 121 message, | 121 message, |
| 122 destination_url); | 122 destination_url); |
| 123 } | 123 } |
| 124 | 124 |
| 125 void BrowserCdmCast::OnSessionClosed(const std::string& session_id) { | 125 void BrowserCdmCast::OnSessionClosed(const std::string& session_id) { |
| 126 session_closed_cb_.Run(session_id); | 126 session_closed_cb_.Run(session_id); |
| 127 } | 127 } |
| 128 | 128 |
| 129 void BrowserCdmCast::OnSessionKeysChange( | 129 void BrowserCdmCast::OnSessionKeysChange(const std::string& session_id, |
| 130 const std::string& session_id, | 130 bool newly_usable_keys, |
| 131 const ::media::KeyIdAndKeyPairs& keys) { | 131 ::media::CdmKeysInfo keys_info) { |
| 132 ::media::CdmKeysInfo cdm_keys_info; | 132 session_keys_change_cb_.Run(session_id, newly_usable_keys, keys_info.Pass()); |
| 133 | |
| 134 if (newly_usable_keys) | |
| 135 player_tracker_impl_->NotifyNewKey(); | |
| 136 } | |
| 137 | |
| 138 void BrowserCdmCast::KeyIdAndKeyPairsToInfo( | |
| 139 const ::media::KeyIdAndKeyPairs& keys, | |
| 140 ::media::CdmKeysInfo* keys_info) { | |
| 141 DCHECK(keys_info); | |
| 133 for (const std::pair<std::string, std::string>& key : keys) { | 142 for (const std::pair<std::string, std::string>& key : keys) { |
| 134 cdm_keys_info.push_back(new ::media::CdmKeyInformation( | 143 scoped_ptr<::media::CdmKeyInformation> cdm_key_information( |
| 135 key.first, ::media::CdmKeyInformation::USABLE, 0)); | 144 new ::media::CdmKeyInformation(key.first, |
|
yucliu1
2015/11/18 19:28:26
The constructor with arguments isn't available in
halliwell
2015/11/18 19:32:32
Correct, I have been working with local changes to
| |
| 145 ::media::CdmKeyInformation::USABLE, 0)); | |
| 146 keys_info->push_back(cdm_key_information.release()); | |
| 136 } | 147 } |
| 137 session_keys_change_cb_.Run(session_id, true, cdm_keys_info.Pass()); | |
| 138 | |
| 139 player_tracker_impl_->NotifyNewKey(); | |
| 140 } | 148 } |
| 141 | 149 |
| 142 // A macro runs current member function on |task_runner_| thread. | 150 // A macro runs current member function on |task_runner_| thread. |
| 143 #define FORWARD_ON_CDM_THREAD(param_fn, ...) \ | 151 #define FORWARD_ON_CDM_THREAD(param_fn, ...) \ |
| 144 task_runner_->PostTask( \ | 152 task_runner_->PostTask( \ |
| 145 FROM_HERE, \ | 153 FROM_HERE, \ |
| 146 base::Bind(&BrowserCdmCast::param_fn, \ | 154 base::Bind(&BrowserCdmCast::param_fn, \ |
| 147 base::Unretained(browser_cdm_cast_.get()), ##__VA_ARGS__)) | 155 base::Unretained(browser_cdm_cast_.get()), ##__VA_ARGS__)) |
| 148 | 156 |
| 149 BrowserCdmCastUi::BrowserCdmCastUi( | 157 BrowserCdmCastUi::BrowserCdmCastUi( |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 226 base::Passed(BindPromiseToCurrentLoop(promise.Pass()))); | 234 base::Passed(BindPromiseToCurrentLoop(promise.Pass()))); |
| 227 } | 235 } |
| 228 | 236 |
| 229 // A default empty implementation for subclasses that don't need to provide | 237 // A default empty implementation for subclasses that don't need to provide |
| 230 // any key system specific initialization. | 238 // any key system specific initialization. |
| 231 void BrowserCdmCast::InitializeInternal() { | 239 void BrowserCdmCast::InitializeInternal() { |
| 232 } | 240 } |
| 233 | 241 |
| 234 } // namespace media | 242 } // namespace media |
| 235 } // namespace chromecast | 243 } // namespace chromecast |
| OLD | NEW |