aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/nixpkgs/pkgs/applications/networking/browsers/ungoogled-chromium/patches/nix_plugin_paths_68.patch
blob: da6a4c92b46024759951a47875c5e027d9efc7c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
diff --git a/chrome/common/chrome_paths.cc b/chrome/common/chrome_paths.cc
index f4e119d..d9775bd 100644
--- a/chrome/common/chrome_paths.cc
+++ b/chrome/common/chrome_paths.cc
@@ -68,21 +68,14 @@ static base::LazyInstance<base::FilePath>
     g_invalid_specified_user_data_dir = LAZY_INSTANCE_INITIALIZER;
 
 // Gets the path for internal plugins.
-bool GetInternalPluginsDirectory(base::FilePath* result) {
-#if defined(OS_MACOSX)
-  // If called from Chrome, get internal plugins from a subdirectory of the
-  // framework.
-  if (base::mac::AmIBundled()) {
-    *result = chrome::GetFrameworkBundlePath();
-    DCHECK(!result->empty());
-    *result = result->Append("Internet Plug-Ins");
-    return true;
-  }
-  // In tests, just look in the module directory (below).
-#endif
-
-  // The rest of the world expects plugins in the module directory.
-  return base::PathService::Get(base::DIR_MODULE, result);
+bool GetInternalPluginsDirectory(base::FilePath* result,
+                                 const std::string& ident) {
+  std::string full_env = std::string("NIX_CHROMIUM_PLUGIN_PATH_") + ident;
+  const char* value = getenv(full_env.c_str());
+  if (value == NULL)
+      return base::PathService::Get(base::DIR_MODULE, result);
+  else
+      *result = base::FilePath(value);
 }
 
 // Gets the path for bundled implementations of components. Note that these
@@ -272,7 +265,7 @@ bool PathProvider(int key, base::FilePath* result) {
       create_dir = true;
       break;
     case chrome::DIR_INTERNAL_PLUGINS:
-      if (!GetInternalPluginsDirectory(&cur))
+      if (!GetInternalPluginsDirectory(&cur, "ALL"))
         return false;
       break;
     case chrome::DIR_COMPONENTS:
@@ -280,7 +273,7 @@ bool PathProvider(int key, base::FilePath* result) {
         return false;
       break;
     case chrome::DIR_PEPPER_FLASH_PLUGIN:
-      if (!GetInternalPluginsDirectory(&cur))
+      if (!GetInternalPluginsDirectory(&cur, "PEPPERFLASH"))
         return false;
       cur = cur.Append(kPepperFlashBaseDirectory);
       break;
@@ -358,7 +351,7 @@ bool PathProvider(int key, base::FilePath* result) {
         cur = cur.DirName();
       }
 #else
-      if (!GetInternalPluginsDirectory(&cur))
+      if (!GetInternalPluginsDirectory(&cur, "PNACL"))
         return false;
 #endif
       cur = cur.Append(FILE_PATH_LITERAL("pnacl"));