Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(891)

Side by Side Diff: webkit/tools/test_shell/test_shell_webmimeregistry_impl.cc

Issue 10020053: Initial implementation of Encrypted Media Extensions in Chrome. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "webkit/tools/test_shell/test_shell_webmimeregistry_impl.h" 5 #include "webkit/tools/test_shell/test_shell_webmimeregistry_impl.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "net/base/mime_util.h" 9 #include "net/base/mime_util.h"
10 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" 10 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
(...skipping 17 matching lines...) Expand all
28 net::GetProprietaryMediaCodecs(&blacklisted_media_codecs_); 28 net::GetProprietaryMediaCodecs(&blacklisted_media_codecs_);
29 } 29 }
30 30
31 TestShellWebMimeRegistryImpl::~TestShellWebMimeRegistryImpl() {} 31 TestShellWebMimeRegistryImpl::~TestShellWebMimeRegistryImpl() {}
32 32
33 // Returns IsNotSupported if mime_type or any of the codecs are not supported. 33 // Returns IsNotSupported if mime_type or any of the codecs are not supported.
34 // Otherwse, defers to the real registry. 34 // Otherwse, defers to the real registry.
35 WebMimeRegistry::SupportsType 35 WebMimeRegistry::SupportsType
36 TestShellWebMimeRegistryImpl::supportsMediaMIMEType( 36 TestShellWebMimeRegistryImpl::supportsMediaMIMEType(
37 const WebString& mime_type, 37 const WebString& mime_type,
38 const WebString& codecs) { 38 const WebString& codecs,
39 const WebKit::WebString& keySystem) {
scherkus (not reviewing) 2012/04/12 20:18:41 key_system
ddorwin 2012/04/12 23:41:23 Done.
39 if (IsBlacklistedMediaMimeType(ToASCIIOrEmpty(mime_type))) 40 if (IsBlacklistedMediaMimeType(ToASCIIOrEmpty(mime_type)))
40 return IsNotSupported; 41 return IsNotSupported;
41 42
42 std::vector<std::string> parsed_codecs; 43 std::vector<std::string> parsed_codecs;
43 net::ParseCodecString(ToASCIIOrEmpty(codecs), &parsed_codecs, true); 44 net::ParseCodecString(ToASCIIOrEmpty(codecs), &parsed_codecs, true);
44 if (HasBlacklistedMediaCodecs(parsed_codecs)) 45 if (HasBlacklistedMediaCodecs(parsed_codecs))
45 return IsNotSupported; 46 return IsNotSupported;
46 47
47 return SimpleWebMimeRegistryImpl::supportsMediaMIMEType(mime_type, codecs); 48 return SimpleWebMimeRegistryImpl::supportsMediaMIMEType(mime_type,
scherkus (not reviewing) 2012/04/12 20:18:41 nit: I'd just drop all args to next line + indent
ddorwin 2012/04/12 23:41:23 Done.
49 codecs,
50 keySystem);
48 } 51 }
49 52
50 bool TestShellWebMimeRegistryImpl::IsBlacklistedMediaMimeType( 53 bool TestShellWebMimeRegistryImpl::IsBlacklistedMediaMimeType(
51 const std::string& mime_type) { 54 const std::string& mime_type) {
52 for (size_t i = 0; i < blacklisted_media_types_.size(); ++i) { 55 for (size_t i = 0; i < blacklisted_media_types_.size(); ++i) {
53 if (blacklisted_media_types_[i] == mime_type) 56 if (blacklisted_media_types_[i] == mime_type)
54 return true; 57 return true;
55 } 58 }
56 return false; 59 return false;
57 } 60 }
58 61
59 bool TestShellWebMimeRegistryImpl::HasBlacklistedMediaCodecs( 62 bool TestShellWebMimeRegistryImpl::HasBlacklistedMediaCodecs(
60 const std::vector<std::string>& codecs) { 63 const std::vector<std::string>& codecs) {
61 for (size_t i = 0; i < codecs.size(); ++i) { 64 for (size_t i = 0; i < codecs.size(); ++i) {
62 for (size_t j = 0; j < blacklisted_media_codecs_.size(); ++j) { 65 for (size_t j = 0; j < blacklisted_media_codecs_.size(); ++j) {
63 if (blacklisted_media_codecs_[j] == codecs[i]) 66 if (blacklisted_media_codecs_[j] == codecs[i])
64 return true; 67 return true;
65 } 68 }
66 } 69 }
67 return false; 70 return false;
68 } 71 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698