OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/common/chrome_paths.h" | 5 #include "chrome/common/chrome_paths.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/lazy_instance.h" | |
8 #include "base/logging.h" | 9 #include "base/logging.h" |
9 #include "base/mac/bundle_locations.h" | 10 #include "base/mac/bundle_locations.h" |
10 #include "base/path_service.h" | 11 #include "base/path_service.h" |
11 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
12 #include "base/sys_info.h" | 13 #include "base/sys_info.h" |
13 #include "base/threading/thread_restrictions.h" | 14 #include "base/threading/thread_restrictions.h" |
14 #include "base/version.h" | 15 #include "base/version.h" |
15 #include "chrome/common/chrome_constants.h" | 16 #include "chrome/common/chrome_constants.h" |
16 #include "chrome/common/chrome_paths_internal.h" | 17 #include "chrome/common/chrome_paths_internal.h" |
17 #include "chrome/common/widevine_cdm_constants.h" | 18 #include "chrome/common/widevine_cdm_constants.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
87 // The path to the external extension <id>.json files. | 88 // The path to the external extension <id>.json files. |
88 // /usr/share seems like a good choice, see: http://www.pathname.com/fhs/ | 89 // /usr/share seems like a good choice, see: http://www.pathname.com/fhs/ |
89 const base::FilePath::CharType kFilepathSinglePrefExtensions[] = | 90 const base::FilePath::CharType kFilepathSinglePrefExtensions[] = |
90 #if defined(GOOGLE_CHROME_BUILD) | 91 #if defined(GOOGLE_CHROME_BUILD) |
91 FILE_PATH_LITERAL("/usr/share/google-chrome/extensions"); | 92 FILE_PATH_LITERAL("/usr/share/google-chrome/extensions"); |
92 #else | 93 #else |
93 FILE_PATH_LITERAL("/usr/share/chromium/extensions"); | 94 FILE_PATH_LITERAL("/usr/share/chromium/extensions"); |
94 #endif // defined(GOOGLE_CHROME_BUILD) | 95 #endif // defined(GOOGLE_CHROME_BUILD) |
95 #endif // defined(OS_LINUX) | 96 #endif // defined(OS_LINUX) |
96 | 97 |
97 } // namespace | 98 static base::LazyInstance<base::FilePath> |
Vitaly Buka (NO REVIEWS)
2014/02/26 01:50:24
Needs
'../base/third_party/dynamic_annotations/dy
msw
2014/02/26 20:34:28
src/base/base.gyp already lists 'dynamic_annotatio
| |
98 | 99 g_invalid_specified_user_data_dir = LAZY_INSTANCE_INITIALIZER; |
99 namespace chrome { | |
100 | 100 |
101 // Gets the path for internal plugins. | 101 // Gets the path for internal plugins. |
102 bool GetInternalPluginsDirectory(base::FilePath* result) { | 102 bool GetInternalPluginsDirectory(base::FilePath* result) { |
103 #if defined(OS_MACOSX) && !defined(OS_IOS) | 103 #if defined(OS_MACOSX) && !defined(OS_IOS) |
104 // If called from Chrome, get internal plugins from a subdirectory of the | 104 // If called from Chrome, get internal plugins from a subdirectory of the |
105 // framework. | 105 // framework. |
106 if (base::mac::AmIBundled()) { | 106 if (base::mac::AmIBundled()) { |
107 *result = chrome::GetFrameworkBundlePath(); | 107 *result = chrome::GetFrameworkBundlePath(); |
108 DCHECK(!result->empty()); | 108 DCHECK(!result->empty()); |
109 *result = result->Append("Internet Plug-Ins"); | 109 *result = result->Append("Internet Plug-Ins"); |
110 return true; | 110 return true; |
111 } | 111 } |
112 // In tests, just look in the module directory (below). | 112 // In tests, just look in the module directory (below). |
113 #endif | 113 #endif |
114 | 114 |
115 // The rest of the world expects plugins in the module directory. | 115 // The rest of the world expects plugins in the module directory. |
116 return PathService::Get(base::DIR_MODULE, result); | 116 return PathService::Get(base::DIR_MODULE, result); |
117 } | 117 } |
118 | 118 |
119 } // namespace | |
120 | |
121 namespace chrome { | |
122 | |
119 bool PathProvider(int key, base::FilePath* result) { | 123 bool PathProvider(int key, base::FilePath* result) { |
120 // Some keys are just aliases... | 124 // Some keys are just aliases... |
121 switch (key) { | 125 switch (key) { |
122 case chrome::DIR_APP: | 126 case chrome::DIR_APP: |
123 return PathService::Get(base::DIR_MODULE, result); | 127 return PathService::Get(base::DIR_MODULE, result); |
124 case chrome::DIR_LOGS: | 128 case chrome::DIR_LOGS: |
125 #ifdef NDEBUG | 129 #ifdef NDEBUG |
126 // Release builds write to the data dir | 130 // Release builds write to the data dir |
127 return PathService::Get(chrome::DIR_USER_DATA, result); | 131 return PathService::Get(chrome::DIR_USER_DATA, result); |
128 #else | 132 #else |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
544 *result = cur; | 548 *result = cur; |
545 return true; | 549 return true; |
546 } | 550 } |
547 | 551 |
548 // This cannot be done as a static initializer sadly since Visual Studio will | 552 // This cannot be done as a static initializer sadly since Visual Studio will |
549 // eliminate this object file if there is no direct entry point into it. | 553 // eliminate this object file if there is no direct entry point into it. |
550 void RegisterPathProvider() { | 554 void RegisterPathProvider() { |
551 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); | 555 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); |
552 } | 556 } |
553 | 557 |
558 void SetInvalidSpecifiedUserDataDir(const base::FilePath& user_data_dir) { | |
559 g_invalid_specified_user_data_dir.Get() = user_data_dir; | |
560 } | |
561 | |
562 const base::FilePath& GetInvalidSpecifiedUserDataDir() { | |
563 return g_invalid_specified_user_data_dir.Get(); | |
564 } | |
565 | |
554 } // namespace chrome | 566 } // namespace chrome |
OLD | NEW |