| 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 "media/blink/key_system_config_selector.h" | 5 #include "media/blink/key_system_config_selector.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 requested_media_capabilities[i]; | 393 requested_media_capabilities[i]; |
| 394 // 3.3. If contentType is the empty string, return null. | 394 // 3.3. If contentType is the empty string, return null. |
| 395 if (capability.mimeType.isEmpty()) { | 395 if (capability.mimeType.isEmpty()) { |
| 396 DVLOG(2) << "Rejecting requested configuration because " | 396 DVLOG(2) << "Rejecting requested configuration because " |
| 397 << "a capability contentType was empty."; | 397 << "a capability contentType was empty."; |
| 398 return false; | 398 return false; |
| 399 } | 399 } |
| 400 | 400 |
| 401 // 3.4-3.11. (Implemented by IsSupportedContentType().) | 401 // 3.4-3.11. (Implemented by IsSupportedContentType().) |
| 402 ConfigState proposed_config_state = *config_state; | 402 ConfigState proposed_config_state = *config_state; |
| 403 if (!base::IsStringASCII(capability.mimeType) || | 403 if (!capability.mimeType.containsOnlyASCII() || |
| 404 !base::IsStringASCII(capability.codecs) || | 404 !capability.codecs.containsOnlyASCII() || |
| 405 !IsSupportedContentType( | 405 !IsSupportedContentType( |
| 406 key_system, media_type, capability.mimeType.ascii(), | 406 key_system, media_type, capability.mimeType.ascii(), |
| 407 capability.codecs.ascii(), &proposed_config_state)) { | 407 capability.codecs.ascii(), &proposed_config_state)) { |
| 408 continue; | 408 continue; |
| 409 } | 409 } |
| 410 // 3.12. If robustness is not the empty string, run the following steps: | 410 // 3.12. If robustness is not the empty string, run the following steps: |
| 411 if (!capability.robustness.isEmpty()) { | 411 if (!capability.robustness.isEmpty()) { |
| 412 // 3.12.1. If robustness is an unrecognized value or not supported by | 412 // 3.12.1. If robustness is an unrecognized value or not supported by |
| 413 // implementation, continue to the next iteration. String | 413 // implementation, continue to the next iteration. String |
| 414 // comparison is case-sensitive. | 414 // comparison is case-sensitive. |
| 415 if (!base::IsStringASCII(capability.robustness)) | 415 if (!capability.robustness.containsOnlyASCII()) |
| 416 continue; | 416 continue; |
| 417 EmeConfigRule robustness_rule = key_systems_->GetRobustnessConfigRule( | 417 EmeConfigRule robustness_rule = key_systems_->GetRobustnessConfigRule( |
| 418 key_system, media_type, capability.robustness.ascii()); | 418 key_system, media_type, capability.robustness.ascii()); |
| 419 if (!proposed_config_state.IsRuleSupported(robustness_rule)) | 419 if (!proposed_config_state.IsRuleSupported(robustness_rule)) |
| 420 continue; | 420 continue; |
| 421 proposed_config_state.AddRule(robustness_rule); | 421 proposed_config_state.AddRule(robustness_rule); |
| 422 // 3.12.2. Add robustness to configuration. | 422 // 3.12.2. Add robustness to configuration. |
| 423 // (It's already added, we use capability as configuration.) | 423 // (It's already added, we use capability as configuration.) |
| 424 } | 424 } |
| 425 // 3.13. If the user agent and implementation do not support playback of | 425 // 3.13. If the user agent and implementation do not support playback of |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 923 | 923 |
| 924 void KeySystemConfigSelector::OnPermissionResult( | 924 void KeySystemConfigSelector::OnPermissionResult( |
| 925 std::unique_ptr<SelectionRequest> request, | 925 std::unique_ptr<SelectionRequest> request, |
| 926 bool is_permission_granted) { | 926 bool is_permission_granted) { |
| 927 request->was_permission_requested = true; | 927 request->was_permission_requested = true; |
| 928 request->is_permission_granted = is_permission_granted; | 928 request->is_permission_granted = is_permission_granted; |
| 929 SelectConfigInternal(std::move(request)); | 929 SelectConfigInternal(std::move(request)); |
| 930 } | 930 } |
| 931 | 931 |
| 932 } // namespace media | 932 } // namespace media |
| OLD | NEW |