Index: chrome/common/chrome_paths.cc |
diff --git a/chrome/common/chrome_paths.cc b/chrome/common/chrome_paths.cc |
index 1b3061f4cd69476453930a79e2b8ed61db1c2ab9..868ea9efd786d57ed280358ad13a35972637a868 100644 |
--- a/chrome/common/chrome_paths.cc |
+++ b/chrome/common/chrome_paths.cc |
@@ -7,6 +7,7 @@ |
#include "base/command_line.h" |
#include "base/file_util.h" |
#include "base/logging.h" |
+#include "base/memory/singleton.h" |
#include "base/path_service.h" |
#include "base/string_util.h" |
#include "base/sys_info.h" |
@@ -18,6 +19,12 @@ |
#include "base/mac/mac_util.h" |
#endif |
+namespace chrome { |
+ |
+bool PathProvider(int key, FilePath* result); |
+ |
+} // namespace chrome |
+ |
namespace { |
// File name of the internal Flash plugin on different platforms. |
@@ -51,6 +58,28 @@ const FilePath::CharType kInternalNaClPluginFileName[] = |
FILE_PATH_LITERAL("libppGoogleNaClPluginChrome.so"); |
#endif |
+// web_ui_browsertest needs this service at linker initialization time so we |
+// provide ability to register and unregister base on Singleton |
+// construction/destruction. |
+class RegistryHelper { |
+ public: |
+ RegistryHelper() { |
+ PathService::RegisterProvider(&chrome::PathProvider, |
+ chrome::PATH_START, chrome::PATH_END); |
+ } |
+ |
+ ~RegistryHelper() { |
+ PathService::UnregisterProvider(&chrome::PathProvider); |
+ } |
+ |
+ static RegistryHelper* GetInstance() { |
+ return Singleton<RegistryHelper>::get(); |
+ } |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(RegistryHelper); |
+}; |
+ |
} // namespace |
namespace chrome { |
@@ -323,7 +352,7 @@ bool PathProvider(int key, 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() { |
- PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); |
+ RegistryHelper::GetInstance(); |
} |
} // namespace chrome |