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

Side by Side Diff: chrome/browser/media/pepper_cdm_test_helper.cc

Issue 1983563002: media: Add helper function to register pepper CDMs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more cleanup Created 4 years, 7 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/media/pepper_cdm_test_helper.h"
6
7 #include "base/command_line.h"
8 #include "base/files/file_util.h"
9 #include "base/path_service.h"
10 #include "base/strings/utf_string_conversions.h"
11 #include "content/public/common/content_switches.h"
12
13 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
14
15 #if defined(ENABLE_PEPPER_CDMS)
ddorwin 2016/05/16 21:37:55 Do we even build this if not defined? I believe th
xhwang 2016/05/18 00:38:29 Done.
16
17 const char kClearKeyCdmBaseDirectory[] = "ClearKeyCdm";
18
19 const char kClearKeyCdmAdapterFileName[] =
20 #if defined(OS_MACOSX)
21 "clearkeycdmadapter.plugin";
22 #elif defined(OS_WIN)
23 "clearkeycdmadapter.dll";
24 #elif defined(OS_POSIX)
25 "libclearkeycdmadapter.so";
26 #endif
27
28 const char kClearKeyCdmPluginMimeType[] = "application/x-ppapi-clearkey-cdm";
29
30 base::FilePath::StringType BuildPepperCdmRegistration(
31 const std::string& adapter_base_dir,
32 const std::string& adapter_file_name,
33 const std::string& mime_type,
34 bool expect_adapter_exists) {
35 base::FilePath adapter_path;
36 DCHECK(PathService::Get(base::DIR_MODULE, &adapter_path));
37 adapter_path = adapter_path.AppendASCII(adapter_base_dir);
38 adapter_path = adapter_path.AppendASCII(adapter_file_name);
39 DCHECK_EQ(expect_adapter_exists, base::PathExists(adapter_path));
40
41 base::FilePath::StringType pepper_cdm_registration = adapter_path.value();
42 pepper_cdm_registration.append(FILE_PATH_LITERAL("#CDM#0.1.0.0;"));
43
44 #if defined(OS_WIN)
45 pepper_cdm_registration.append(base::ASCIIToUTF16(mime_type));
46 #else
47 pepper_cdm_registration.append(mime_type);
48 #endif
49
50 return pepper_cdm_registration;
51 }
52
53 void RegisterPepperCdm(base::CommandLine* command_line,
54 const std::string& adapter_base_dir,
55 const std::string& adapter_file_name,
56 const std::string& mime_type,
57 bool expect_adapter_exists) {
58 base::FilePath::StringType pepper_cdm_registration =
59 BuildPepperCdmRegistration(adapter_base_dir, adapter_file_name, mime_type,
60 expect_adapter_exists);
61
62 // Append the switch to register the CDM Adapter.
63 command_line->AppendSwitchNative(switches::kRegisterPepperPlugins,
64 pepper_cdm_registration);
65 }
66
67 #endif // defined(ENABLE_PEPPER_CDMS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698