OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/component_updater/component_updater_paths.h" | 5 #include "components/component_updater/component_updater_paths.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 | 9 |
10 namespace component_updater { | 10 namespace component_updater { |
11 | 11 |
12 namespace { | 12 namespace { |
13 | 13 |
14 static base::LazyInstance<base::FilePath> g_components_root = | 14 static base::LazyInstance<base::FilePath> g_components_root = |
15 LAZY_INSTANCE_INITIALIZER; | 15 LAZY_INSTANCE_INITIALIZER; |
16 | 16 |
17 } // namespace | 17 } // namespace |
18 | 18 |
19 bool PathProvider(int key, base::FilePath* result) { | 19 bool PathProvider(int key, base::FilePath* result) { |
20 DCHECK(!g_components_root.Get().empty()); | 20 DCHECK(!g_components_root.Get().empty()); |
| 21 if (key == DIR_SECURE_RECOVERY_BASE) { |
| 22 base::FilePath cur; |
| 23 if (!PathService::Get(base::DIR_MODULE, &cur)) |
| 24 return false; |
| 25 *result = cur.Append(FILE_PATH_LITERAL("recovery")); |
| 26 return true; |
| 27 } |
| 28 |
21 base::FilePath cur = g_components_root.Get(); | 29 base::FilePath cur = g_components_root.Get(); |
22 switch (key) { | 30 switch (key) { |
23 case DIR_COMPONENT_CLD2: | 31 case DIR_COMPONENT_CLD2: |
24 cur = cur.Append(FILE_PATH_LITERAL("CLD")); | 32 cur = cur.Append(FILE_PATH_LITERAL("CLD")); |
25 break; | 33 break; |
26 case DIR_RECOVERY_BASE: | 34 case DIR_RECOVERY_BASE: |
27 cur = cur.Append(FILE_PATH_LITERAL("recovery")); | 35 cur = cur.Append(FILE_PATH_LITERAL("recovery")); |
28 break; | 36 break; |
29 case DIR_SWIFT_SHADER: | 37 case DIR_SWIFT_SHADER: |
30 cur = cur.Append(FILE_PATH_LITERAL("SwiftShader")); | 38 cur = cur.Append(FILE_PATH_LITERAL("SwiftShader")); |
(...skipping 13 matching lines...) Expand all Loading... |
44 // eliminate this object file if there is no direct entry point into it. | 52 // eliminate this object file if there is no direct entry point into it. |
45 void RegisterPathProvider(const base::FilePath& components_root) { | 53 void RegisterPathProvider(const base::FilePath& components_root) { |
46 DCHECK(g_components_root.Get().empty()); | 54 DCHECK(g_components_root.Get().empty()); |
47 DCHECK(!components_root.empty()); | 55 DCHECK(!components_root.empty()); |
48 g_components_root.Get() = components_root; | 56 g_components_root.Get() = components_root; |
49 | 57 |
50 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); | 58 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); |
51 } | 59 } |
52 | 60 |
53 } // namespace component_updater | 61 } // namespace component_updater |
OLD | NEW |