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

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

Issue 1989893004: media: Use platform specific folders for CDMs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: specify both paths in chrome.release 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 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 "chrome/browser/media/pepper_cdm_test_helper.h" 5 #include "chrome/browser/media/pepper_cdm_test_helper.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "content/public/common/content_switches.h" 11 #include "content/public/common/content_switches.h"
12 #include "media/cdm/cdm_paths.h"
12 13
13 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. 14 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
14 15
15 const char kClearKeyCdmDisplayName[] = "Clear Key CDM"; 16 const char kClearKeyCdmBaseDirectory[] = "ClearKeyCdm";
16 17
17 const char kClearKeyCdmAdapterFileName[] = 18 const char kClearKeyCdmAdapterFileName[] =
18 #if defined(OS_MACOSX) 19 #if defined(OS_MACOSX)
19 "clearkeycdmadapter.plugin"; 20 "clearkeycdmadapter.plugin";
20 #elif defined(OS_WIN) 21 #elif defined(OS_WIN)
21 "clearkeycdmadapter.dll"; 22 "clearkeycdmadapter.dll";
22 #elif defined(OS_POSIX) 23 #elif defined(OS_POSIX)
23 "libclearkeycdmadapter.so"; 24 "libclearkeycdmadapter.so";
24 #endif 25 #endif
25 26
27 const char kClearKeyCdmDisplayName[] = "Clear Key CDM";
28
26 const char kClearKeyCdmPepperMimeType[] = "application/x-ppapi-clearkey-cdm"; 29 const char kClearKeyCdmPepperMimeType[] = "application/x-ppapi-clearkey-cdm";
27 30
28 base::FilePath::StringType BuildPepperCdmRegistration( 31 base::FilePath::StringType BuildPepperCdmRegistration(
32 const std::string& adapter_base_dir,
29 const std::string& adapter_file_name, 33 const std::string& adapter_file_name,
30 const std::string& display_name, 34 const std::string& display_name,
31 const std::string& mime_type, 35 const std::string& mime_type,
32 bool expect_adapter_exists) { 36 bool expect_adapter_exists) {
33 base::FilePath adapter_path; 37 base::FilePath adapter_path;
34 PathService::Get(base::DIR_MODULE, &adapter_path); 38 PathService::Get(base::DIR_MODULE, &adapter_path);
39 adapter_path = adapter_path.Append(
40 media::GetPlatformSpecificDirectory(adapter_base_dir));
35 adapter_path = adapter_path.AppendASCII(adapter_file_name); 41 adapter_path = adapter_path.AppendASCII(adapter_file_name);
36 DCHECK_EQ(expect_adapter_exists, base::PathExists(adapter_path)); 42 DCHECK_EQ(expect_adapter_exists, base::PathExists(adapter_path))
43 << adapter_path.MaybeAsASCII();
37 44
38 base::FilePath::StringType pepper_cdm_registration = adapter_path.value(); 45 base::FilePath::StringType pepper_cdm_registration = adapter_path.value();
39 46
40 std::string string_to_append = "#"; 47 std::string string_to_append = "#";
41 string_to_append.append(display_name); 48 string_to_append.append(display_name);
42 string_to_append.append("#CDM#0.1.0.0;"); 49 string_to_append.append("#CDM#0.1.0.0;");
43 string_to_append.append(mime_type); 50 string_to_append.append(mime_type);
44 51
45 #if defined(OS_WIN) 52 #if defined(OS_WIN)
46 pepper_cdm_registration.append(base::ASCIIToUTF16(string_to_append)); 53 pepper_cdm_registration.append(base::ASCIIToUTF16(string_to_append));
47 #else 54 #else
48 pepper_cdm_registration.append(string_to_append); 55 pepper_cdm_registration.append(string_to_append);
49 #endif 56 #endif
50 57
51 return pepper_cdm_registration; 58 return pepper_cdm_registration;
52 } 59 }
53 60
54 void RegisterPepperCdm(base::CommandLine* command_line, 61 void RegisterPepperCdm(base::CommandLine* command_line,
62 const std::string& adapter_base_dir,
55 const std::string& adapter_file_name, 63 const std::string& adapter_file_name,
56 const std::string& display_name, 64 const std::string& display_name,
57 const std::string& mime_type, 65 const std::string& mime_type,
58 bool expect_adapter_exists) { 66 bool expect_adapter_exists) {
59 base::FilePath::StringType pepper_cdm_registration = 67 base::FilePath::StringType pepper_cdm_registration =
60 BuildPepperCdmRegistration(adapter_file_name, display_name, mime_type, 68 BuildPepperCdmRegistration(adapter_base_dir, adapter_file_name,
69 display_name, mime_type,
61 expect_adapter_exists); 70 expect_adapter_exists);
62 71
63 // Append the switch to register the CDM Adapter. 72 // Append the switch to register the CDM Adapter.
64 command_line->AppendSwitchNative(switches::kRegisterPepperPlugins, 73 command_line->AppendSwitchNative(switches::kRegisterPepperPlugins,
65 pepper_cdm_registration); 74 pepper_cdm_registration);
66 } 75 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698