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

Side by Side Diff: components/component_updater/component_updater_paths.cc

Issue 334783002: Componentize component_updater: Move some paths/constants to component. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add component updater to common dependency list Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "components/component_updater/component_updater_paths.h"
6
7 #include "base/lazy_instance.h"
8 #include "base/path_service.h"
9
10 namespace component_updater {
11
12 namespace {
13
14 static base::LazyInstance<base::FilePath> g_components_root =
15 LAZY_INSTANCE_INITIALIZER;
16
17 } // namespace
18
19 bool PathProvider(int key, base::FilePath* result) {
20 DCHECK(!g_components_root.Get().empty());
21 base::FilePath cur = g_components_root.Get();
22 switch (key) {
23 case DIR_COMPONENT_CLD2:
24 cur = cur.Append(FILE_PATH_LITERAL("CLD"));
25 break;
26 case DIR_RECOVERY_BASE:
27 cur = cur.Append(FILE_PATH_LITERAL("recovery"));
28 break;
29 case DIR_SWIFT_SHADER:
30 cur = cur.Append(FILE_PATH_LITERAL("SwiftShader"));
31 break;
32 default:
33 return false;
34 }
35
36 *result = cur;
37 return true;
38 }
39
40 // This cannot be done as a static initializer sadly since Visual Studio will
41 // eliminate this object file if there is no direct entry point into it.
42 void RegisterPathProvider(const base::FilePath& components_root) {
43 DCHECK(g_components_root.Get().empty());
44 DCHECK(!components_root.empty());
45 g_components_root.Get() = components_root;
46
47 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END);
48 }
49
50 } // namespace component_updater
OLDNEW
« no previous file with comments | « components/component_updater/component_updater_paths.h ('k') | components/component_updater/component_updater_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698