Chromium Code Reviews| Index: components/component_updater/component_updater_paths.cc |
| diff --git a/components/component_updater/component_updater_paths.cc b/components/component_updater/component_updater_paths.cc |
| index 510725b35795fe5500d730a2421b010b424c30f4..4331c5f4392c3c39220eb06068efeee318b590ab 100644 |
| --- a/components/component_updater/component_updater_paths.cc |
| +++ b/components/component_updater/component_updater_paths.cc |
| @@ -12,20 +12,29 @@ namespace component_updater { |
| namespace { |
| // This key gives the root directory of all the component installations. |
| -static int g_components_root_key = -1; |
| +static int g_components_system_root_key = -1; |
| +static int g_components_user_root_key = -1; |
| } // namespace |
| bool PathProvider(int key, base::FilePath* result) { |
| - DCHECK_GT(g_components_root_key, 0); |
| + DCHECK_GT(g_components_user_root_key, 0); |
| + DCHECK_GT(g_components_system_root_key, 0); |
| // Early exit here to prevent a potential infinite loop when we retrieve |
| - // the path for g_components_root_key. |
| + // the path for g_components_*_root_key. |
| if (key < PATH_START || key > PATH_END) |
| return false; |
| + switch (key) { |
| + case DIR_COMPONENT_SYSTEM: |
| + return PathService::Get(g_components_system_root_key, result); |
| + case DIR_COMPONENT_USER: |
| + return PathService::Get(g_components_user_root_key, result); |
| + } |
| + |
| base::FilePath cur; |
| - if (!PathService::Get(g_components_root_key, &cur)) |
| + if (!PathService::Get(g_components_user_root_key, &cur)) |
| return false; |
| switch (key) { |
| @@ -38,21 +47,9 @@ bool PathProvider(int key, base::FilePath* result) { |
| case DIR_SWIFT_SHADER: |
| cur = cur.Append(FILE_PATH_LITERAL("SwiftShader")); |
| break; |
| - case DIR_SW_REPORTER: |
| - cur = cur.Append(FILE_PATH_LITERAL("SwReporter")); |
| - break; |
| - case DIR_COMPONENT_EV_WHITELIST: |
| - cur = cur.Append(FILE_PATH_LITERAL("EVWhitelist")); |
| - break; |
| case DIR_SUPERVISED_USER_WHITELISTS: |
|
Bernhard Bauer
2016/05/04 08:57:37
We should probably remove this value now.
waffles
2016/05/10 18:15:53
Yeah, I wasn't sure about this, because it require
Bernhard Bauer
2016/05/12 08:37:22
D'oh! I overlooked that occurrence. Hm, as it is r
waffles
2016/05/12 17:06:07
We can't depend directly on chrome_constants from
Bernhard Bauer
2016/05/12 17:28:58
In practice, probably not a big risk (this code is
waffles
2016/05/13 18:19:13
Added it in component_updater_paths; not sure this
|
| cur = cur.Append(FILE_PATH_LITERAL("SupervisedUserWhitelists")); |
| break; |
| - case DIR_CERT_TRANS_TREE_STATES: |
| - cur = cur.Append(FILE_PATH_LITERAL("CertificateTransparency")); |
| - break; |
| - case DIR_ORIGIN_TRIAL_KEYS: |
| - cur = cur.Append(FILE_PATH_LITERAL("OriginTrials")); |
| - break; |
| default: |
| return false; |
| } |
| @@ -63,12 +60,19 @@ bool PathProvider(int key, base::FilePath* result) { |
| // This cannot be done as a static initializer sadly since Visual Studio will |
| // eliminate this object file if there is no direct entry point into it. |
| -void RegisterPathProvider(int components_root_key) { |
| - DCHECK_EQ(g_components_root_key, -1); |
| - DCHECK_GT(components_root_key, 0); |
| - DCHECK(components_root_key < PATH_START || components_root_key > PATH_END); |
| +void RegisterPathProvider(int components_system_root_key, |
| + int components_user_root_key) { |
| + DCHECK_EQ(g_components_system_root_key, -1); |
| + DCHECK_EQ(g_components_user_root_key, -1); |
| + DCHECK_GT(components_system_root_key, 0); |
| + DCHECK_GT(components_user_root_key, 0); |
| + DCHECK(components_system_root_key < PATH_START || |
| + components_system_root_key > PATH_END); |
| + DCHECK(components_user_root_key < PATH_START || |
| + components_user_root_key > PATH_END); |
| - g_components_root_key = components_root_key; |
| + g_components_system_root_key = components_system_root_key; |
| + g_components_user_root_key = components_user_root_key; |
| PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); |
| } |