OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 } | 56 } |
57 | 57 |
58 bool MediaConstraintsImpl::initialize(const Dictionary& constraints) | 58 bool MediaConstraintsImpl::initialize(const Dictionary& constraints) |
59 { | 59 { |
60 if (constraints.isUndefinedOrNull()) | 60 if (constraints.isUndefinedOrNull()) |
61 return true; | 61 return true; |
62 | 62 |
63 Vector<String> names; | 63 Vector<String> names; |
64 constraints.getOwnPropertyNames(names); | 64 constraints.getOwnPropertyNames(names); |
65 | 65 |
66 String mandatory = ASCIILiteral("mandatory"); | 66 String mandatory("mandatory"); |
67 String optional = ASCIILiteral("optional"); | 67 String optional("optional"); |
68 | 68 |
69 for (Vector<String>::iterator it = names.begin(); it != names.end(); ++it) { | 69 for (Vector<String>::iterator it = names.begin(); it != names.end(); ++it) { |
70 if (*it != mandatory && *it != optional) | 70 if (*it != mandatory && *it != optional) |
71 return false; | 71 return false; |
72 } | 72 } |
73 | 73 |
74 if (names.contains(mandatory)) { | 74 if (names.contains(mandatory)) { |
75 Dictionary mandatoryConstraints; | 75 Dictionary mandatoryConstraints; |
76 bool ok = constraints.get(mandatory, mandatoryConstraints); | 76 bool ok = constraints.get(mandatory, mandatoryConstraints); |
77 if (!ok || mandatoryConstraints.isUndefinedOrNull()) | 77 if (!ok || mandatoryConstraints.isUndefinedOrNull()) |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 if (i->m_name == name) { | 149 if (i->m_name == name) { |
150 value = i->m_value; | 150 value = i->m_value; |
151 return true; | 151 return true; |
152 } | 152 } |
153 } | 153 } |
154 | 154 |
155 return false; | 155 return false; |
156 } | 156 } |
157 | 157 |
158 } // namespace WebCore | 158 } // namespace WebCore |
OLD | NEW |