OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/renderer_host/media/audio_renderer_host.h" | 5 #include "content/browser/renderer_host/media/audio_renderer_host.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
75 std::make_pair(authorized, device_unique_id)); | 75 std::make_pair(authorized, device_unique_id)); |
76 } | 76 } |
77 | 77 |
78 GURL ConvertToGURL(const url::Origin& origin) { | 78 GURL ConvertToGURL(const url::Origin& origin) { |
79 return origin.unique() ? GURL() : GURL(origin.Serialize()); | 79 return origin.unique() ? GURL() : GURL(origin.Serialize()); |
80 } | 80 } |
81 | 81 |
82 bool IsValidDeviceId(const std::string& device_id) { | 82 bool IsValidDeviceId(const std::string& device_id) { |
83 static const std::string::size_type kValidLength = 64; | 83 static const std::string::size_type kValidLength = 64; |
84 | 84 |
85 if (device_id.empty()) | 85 if (device_id.empty() || |
86 device_id == media::AudioManagerBase::kDefaultDeviceId || | |
87 device_id == media::AudioManagerBase::kCommunicationsDeviceId) { | |
ajm
2015/09/28 22:47:18
Does it matter that ChromeOS is not using these ID
Guido Urdaneta
2015/09/29 10:36:12
No, it does not matter. This is a check for hashed
tommi (sloooow) - chröme
2015/09/29 11:59:51
Is it using any other "known-and-not-translated" I
ajm
2015/09/29 16:00:55
Great, thanks.
ajm
2015/09/29 16:00:55
No.
| |
86 return true; | 88 return true; |
89 } | |
87 | 90 |
88 if (device_id.length() != kValidLength) | 91 if (device_id.length() != kValidLength) |
89 return false; | 92 return false; |
90 | 93 |
91 for (const char& c : device_id) { | 94 for (const char& c : device_id) { |
92 if ((c < 'a' || c > 'f') && (c < '0' || c > '9')) | 95 if ((c < 'a' || c > 'f') && (c < '0' || c > '9')) |
93 return false; | 96 return false; |
94 } | 97 } |
95 | 98 |
96 return true; | 99 return true; |
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
895 callback.Run(success, *new_info); | 898 callback.Run(success, *new_info); |
896 } | 899 } |
897 | 900 |
898 bool AudioRendererHost::IsAuthorizationStarted(int stream_id) { | 901 bool AudioRendererHost::IsAuthorizationStarted(int stream_id) { |
899 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 902 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
900 const auto& i = authorizations_.find(stream_id); | 903 const auto& i = authorizations_.find(stream_id); |
901 return i != authorizations_.end(); | 904 return i != authorizations_.end(); |
902 } | 905 } |
903 | 906 |
904 } // namespace content | 907 } // namespace content |
OLD | NEW |