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

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

Issue 2001953002: Revert of media: Use platform specific folders for CDMs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « chrome/browser/media/pepper_cdm_test_helper.h ('k') | chrome/browser_tests.isolate » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
13 12
14 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. 13 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
15 14
16 const char kClearKeyCdmBaseDirectory[] = "ClearKeyCdm"; 15 const char kClearKeyCdmDisplayName[] = "Clear Key CDM";
17 16
18 const char kClearKeyCdmAdapterFileName[] = 17 const char kClearKeyCdmAdapterFileName[] =
19 #if defined(OS_MACOSX) 18 #if defined(OS_MACOSX)
20 "clearkeycdmadapter.plugin"; 19 "clearkeycdmadapter.plugin";
21 #elif defined(OS_WIN) 20 #elif defined(OS_WIN)
22 "clearkeycdmadapter.dll"; 21 "clearkeycdmadapter.dll";
23 #elif defined(OS_POSIX) 22 #elif defined(OS_POSIX)
24 "libclearkeycdmadapter.so"; 23 "libclearkeycdmadapter.so";
25 #endif 24 #endif
26 25
27 const char kClearKeyCdmDisplayName[] = "Clear Key CDM";
28
29 const char kClearKeyCdmPepperMimeType[] = "application/x-ppapi-clearkey-cdm"; 26 const char kClearKeyCdmPepperMimeType[] = "application/x-ppapi-clearkey-cdm";
30 27
31 base::FilePath::StringType BuildPepperCdmRegistration( 28 base::FilePath::StringType BuildPepperCdmRegistration(
32 const std::string& adapter_base_dir,
33 const std::string& adapter_file_name, 29 const std::string& adapter_file_name,
34 const std::string& display_name, 30 const std::string& display_name,
35 const std::string& mime_type, 31 const std::string& mime_type,
36 bool expect_adapter_exists) { 32 bool expect_adapter_exists) {
37 base::FilePath adapter_path; 33 base::FilePath adapter_path;
38 PathService::Get(base::DIR_MODULE, &adapter_path); 34 PathService::Get(base::DIR_MODULE, &adapter_path);
39 adapter_path = adapter_path.Append(
40 media::GetPlatformSpecificDirectory(adapter_base_dir));
41 adapter_path = adapter_path.AppendASCII(adapter_file_name); 35 adapter_path = adapter_path.AppendASCII(adapter_file_name);
42 DCHECK_EQ(expect_adapter_exists, base::PathExists(adapter_path)) 36 DCHECK_EQ(expect_adapter_exists, base::PathExists(adapter_path));
43 << adapter_path.MaybeAsASCII();
44 37
45 base::FilePath::StringType pepper_cdm_registration = adapter_path.value(); 38 base::FilePath::StringType pepper_cdm_registration = adapter_path.value();
46 39
47 std::string string_to_append = "#"; 40 std::string string_to_append = "#";
48 string_to_append.append(display_name); 41 string_to_append.append(display_name);
49 string_to_append.append("#CDM#0.1.0.0;"); 42 string_to_append.append("#CDM#0.1.0.0;");
50 string_to_append.append(mime_type); 43 string_to_append.append(mime_type);
51 44
52 #if defined(OS_WIN) 45 #if defined(OS_WIN)
53 pepper_cdm_registration.append(base::ASCIIToUTF16(string_to_append)); 46 pepper_cdm_registration.append(base::ASCIIToUTF16(string_to_append));
54 #else 47 #else
55 pepper_cdm_registration.append(string_to_append); 48 pepper_cdm_registration.append(string_to_append);
56 #endif 49 #endif
57 50
58 return pepper_cdm_registration; 51 return pepper_cdm_registration;
59 } 52 }
60 53
61 void RegisterPepperCdm(base::CommandLine* command_line, 54 void RegisterPepperCdm(base::CommandLine* command_line,
62 const std::string& adapter_base_dir,
63 const std::string& adapter_file_name, 55 const std::string& adapter_file_name,
64 const std::string& display_name, 56 const std::string& display_name,
65 const std::string& mime_type, 57 const std::string& mime_type,
66 bool expect_adapter_exists) { 58 bool expect_adapter_exists) {
67 base::FilePath::StringType pepper_cdm_registration = 59 base::FilePath::StringType pepper_cdm_registration =
68 BuildPepperCdmRegistration(adapter_base_dir, adapter_file_name, 60 BuildPepperCdmRegistration(adapter_file_name, display_name, mime_type,
69 display_name, mime_type,
70 expect_adapter_exists); 61 expect_adapter_exists);
71 62
72 // Append the switch to register the CDM Adapter. 63 // Append the switch to register the CDM Adapter.
73 command_line->AppendSwitchNative(switches::kRegisterPepperPlugins, 64 command_line->AppendSwitchNative(switches::kRegisterPepperPlugins,
74 pepper_cdm_registration); 65 pepper_cdm_registration);
75 } 66 }
OLDNEW
« no previous file with comments | « chrome/browser/media/pepper_cdm_test_helper.h ('k') | chrome/browser_tests.isolate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698