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

Unified 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 side-by-side diff with in-line comments
Download patch
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
new file mode 100644
index 0000000000000000000000000000000000000000..62f484b6afc2c0b6da1967567cb1ebfeffea0bef
--- /dev/null
+++ b/components/component_updater/component_updater_paths.cc
@@ -0,0 +1,50 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/component_updater/component_updater_paths.h"
+
+#include "base/lazy_instance.h"
+#include "base/path_service.h"
+
+namespace component_updater {
+
+namespace {
+
+static base::LazyInstance<base::FilePath> g_components_root =
+ LAZY_INSTANCE_INITIALIZER;
+
+} // namespace
+
+bool PathProvider(int key, base::FilePath* result) {
+ DCHECK(!g_components_root.Get().empty());
+ base::FilePath cur = g_components_root.Get();
+ switch (key) {
+ case DIR_COMPONENT_CLD2:
+ cur = cur.Append(FILE_PATH_LITERAL("CLD"));
+ break;
+ case DIR_RECOVERY_BASE:
+ cur = cur.Append(FILE_PATH_LITERAL("recovery"));
+ break;
+ case DIR_SWIFT_SHADER:
+ cur = cur.Append(FILE_PATH_LITERAL("SwiftShader"));
+ break;
+ default:
+ return false;
+ }
+
+ *result = cur;
+ return true;
+}
+
+// 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(const base::FilePath& components_root) {
+ DCHECK(g_components_root.Get().empty());
+ DCHECK(!components_root.empty());
+ g_components_root.Get() = components_root;
+
+ PathService::RegisterProvider(PathProvider, PATH_START, PATH_END);
+}
+
+} // namespace component_updater
« 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