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

Unified Diff: chrome/common/chrome_paths.cc

Issue 1937683002: Implement support in DefaultComponentInstaller for picking up bundled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments through #35 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/chrome_paths.h ('k') | chrome/test/base/chrome_unit_test_suite.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/chrome_paths.cc
diff --git a/chrome/common/chrome_paths.cc b/chrome/common/chrome_paths.cc
index c7462488e883bde329b393b3701d8040e384813b..cde693133f2663d1b7b52c41ec22009b754e833b 100644
--- a/chrome/common/chrome_paths.cc
+++ b/chrome/common/chrome_paths.cc
@@ -85,6 +85,25 @@ bool GetInternalPluginsDirectory(base::FilePath* result) {
return PathService::Get(base::DIR_MODULE, result);
}
+// Gets the path for bundled implementations of components. Note that these
+// implementations should not be used if higher-versioned component-updated
+// implementations are available in DIR_USER_DATA.
+bool GetComponentDirectory(base::FilePath* result) {
+#if defined(OS_MACOSX)
+ // If called from Chrome, return the framework's Libraries directory.
+ if (base::mac::AmIBundled()) {
+ *result = chrome::GetFrameworkBundlePath();
+ DCHECK(!result->empty());
+ *result = result->Append("Libraries");
+ return true;
+ }
+// In tests, just look in the module directory (below).
+#endif
+
+ // The rest of the world expects components in the module directory.
+ return PathService::Get(base::DIR_MODULE, result);
+}
+
#if defined(OS_WIN)
// Gets the Pepper Flash path if installed on the system.
bool GetSystemFlashFilename(base::FilePath* out_path) {
@@ -256,6 +275,10 @@ bool PathProvider(int key, base::FilePath* result) {
if (!GetInternalPluginsDirectory(&cur))
return false;
break;
+ case chrome::DIR_COMPONENTS:
+ if (!GetComponentDirectory(&cur))
+ return false;
+ break;
case chrome::DIR_PEPPER_FLASH_PLUGIN:
if (!GetInternalPluginsDirectory(&cur))
return false;
« no previous file with comments | « chrome/common/chrome_paths.h ('k') | chrome/test/base/chrome_unit_test_suite.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698