OLD | NEW |
1 // Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2010 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/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
12 #include "base/sys_info.h" | 12 #include "base/sys_info.h" |
13 #include "chrome/common/chrome_constants.h" | 13 #include "chrome/common/chrome_constants.h" |
14 #include "chrome/common/chrome_paths_internal.h" | 14 #include "chrome/common/chrome_paths_internal.h" |
15 #include "chrome/common/chrome_switches.h" | 15 #include "chrome/common/chrome_switches.h" |
16 | 16 |
17 #if defined(OS_MACOSX) | 17 #if defined(OS_MACOSX) |
18 #include "base/mac_util.h" | 18 #include "base/mac/mac_util.h" |
19 #endif | 19 #endif |
20 | 20 |
21 namespace { | 21 namespace { |
22 | 22 |
23 // File name of the internal Flash plugin on different platforms. | 23 // File name of the internal Flash plugin on different platforms. |
24 const FilePath::CharType kInternalFlashPluginFileName[] = | 24 const FilePath::CharType kInternalFlashPluginFileName[] = |
25 #if defined(OS_MACOSX) | 25 #if defined(OS_MACOSX) |
26 FILE_PATH_LITERAL("Flash Player Plugin for Chrome.plugin"); | 26 FILE_PATH_LITERAL("Flash Player Plugin for Chrome.plugin"); |
27 #elif defined(OS_WIN) | 27 #elif defined(OS_WIN) |
28 FILE_PATH_LITERAL("gcswf32.dll"); | 28 FILE_PATH_LITERAL("gcswf32.dll"); |
29 #else // OS_LINUX, etc. | 29 #else // OS_LINUX, etc. |
30 FILE_PATH_LITERAL("libgcflashplayer.so"); | 30 FILE_PATH_LITERAL("libgcflashplayer.so"); |
31 #endif | 31 #endif |
32 | 32 |
33 } // namespace | 33 } // namespace |
34 | 34 |
35 namespace chrome { | 35 namespace chrome { |
36 | 36 |
37 // Gets the path for internal plugins. | 37 // Gets the path for internal plugins. |
38 bool GetInternalPluginsDirectory(FilePath* result) { | 38 bool GetInternalPluginsDirectory(FilePath* result) { |
39 #if defined(OS_MACOSX) | 39 #if defined(OS_MACOSX) |
40 // If called from Chrome, get internal plugins from a subdirectory of the | 40 // If called from Chrome, get internal plugins from a subdirectory of the |
41 // framework. | 41 // framework. |
42 if (mac_util::AmIBundled()) { | 42 if (base::mac::AmIBundled()) { |
43 *result = chrome::GetFrameworkBundlePath(); | 43 *result = chrome::GetFrameworkBundlePath(); |
44 DCHECK(!result->empty()); | 44 DCHECK(!result->empty()); |
45 *result = result->Append("Internet Plug-Ins"); | 45 *result = result->Append("Internet Plug-Ins"); |
46 return true; | 46 return true; |
47 } | 47 } |
48 // In tests, just look in the module directory (below). | 48 // In tests, just look in the module directory (below). |
49 #endif | 49 #endif |
50 | 50 |
51 // The rest of the world expects plugins in the module directory. | 51 // The rest of the world expects plugins in the module directory. |
52 return PathService::Get(base::DIR_MODULE, result); | 52 return PathService::Get(base::DIR_MODULE, result); |
(...skipping 19 matching lines...) Expand all Loading... |
72 return PathService::Get(base::DIR_MODULE, result); | 72 return PathService::Get(base::DIR_MODULE, result); |
73 case chrome::DIR_LOGS: | 73 case chrome::DIR_LOGS: |
74 #ifdef NDEBUG | 74 #ifdef NDEBUG |
75 // Release builds write to the data dir | 75 // Release builds write to the data dir |
76 return PathService::Get(chrome::DIR_USER_DATA, result); | 76 return PathService::Get(chrome::DIR_USER_DATA, result); |
77 #else | 77 #else |
78 // Debug builds write next to the binary (in the build tree) | 78 // Debug builds write next to the binary (in the build tree) |
79 #if defined(OS_MACOSX) | 79 #if defined(OS_MACOSX) |
80 if (!PathService::Get(base::DIR_EXE, result)) | 80 if (!PathService::Get(base::DIR_EXE, result)) |
81 return false; | 81 return false; |
82 if (mac_util::AmIBundled()) { | 82 if (base::mac::AmIBundled()) { |
83 // If we're called from chrome, dump it beside the app (outside the | 83 // If we're called from chrome, dump it beside the app (outside the |
84 // app bundle), if we're called from a unittest, we'll already | 84 // app bundle), if we're called from a unittest, we'll already |
85 // outside the bundle so use the exe dir. | 85 // outside the bundle so use the exe dir. |
86 // exe_dir gave us .../Chromium.app/Contents/MacOS/Chromium. | 86 // exe_dir gave us .../Chromium.app/Contents/MacOS/Chromium. |
87 *result = result->DirName(); | 87 *result = result->DirName(); |
88 *result = result->DirName(); | 88 *result = result->DirName(); |
89 *result = result->DirName(); | 89 *result = result->DirName(); |
90 } | 90 } |
91 return true; | 91 return true; |
92 #else | 92 #else |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 return false; | 138 return false; |
139 cur = cur.Append(FILE_PATH_LITERAL("Crash Reports")); | 139 cur = cur.Append(FILE_PATH_LITERAL("Crash Reports")); |
140 create_dir = true; | 140 create_dir = true; |
141 break; | 141 break; |
142 case chrome::DIR_USER_DESKTOP: | 142 case chrome::DIR_USER_DESKTOP: |
143 if (!GetUserDesktop(&cur)) | 143 if (!GetUserDesktop(&cur)) |
144 return false; | 144 return false; |
145 break; | 145 break; |
146 case chrome::DIR_RESOURCES: | 146 case chrome::DIR_RESOURCES: |
147 #if defined(OS_MACOSX) | 147 #if defined(OS_MACOSX) |
148 cur = mac_util::MainAppBundlePath(); | 148 cur = base::mac::MainAppBundlePath(); |
149 cur = cur.Append(FILE_PATH_LITERAL("Resources")); | 149 cur = cur.Append(FILE_PATH_LITERAL("Resources")); |
150 #else | 150 #else |
151 if (!PathService::Get(chrome::DIR_APP, &cur)) | 151 if (!PathService::Get(chrome::DIR_APP, &cur)) |
152 return false; | 152 return false; |
153 cur = cur.Append(FILE_PATH_LITERAL("resources")); | 153 cur = cur.Append(FILE_PATH_LITERAL("resources")); |
154 #endif | 154 #endif |
155 break; | 155 break; |
156 case chrome::DIR_SHARED_RESOURCES: | 156 case chrome::DIR_SHARED_RESOURCES: |
157 if (!PathService::Get(chrome::DIR_RESOURCES, &cur)) | 157 if (!PathService::Get(chrome::DIR_RESOURCES, &cur)) |
158 return false; | 158 return false; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 cur = cur.Append(FILE_PATH_LITERAL("ppGoogleNaClPluginChrome.dll")); | 246 cur = cur.Append(FILE_PATH_LITERAL("ppGoogleNaClPluginChrome.dll")); |
247 #elif defined(OS_MACOSX) | 247 #elif defined(OS_MACOSX) |
248 // TODO(noelallen) Please verify this extention name is correct. | 248 // TODO(noelallen) Please verify this extention name is correct. |
249 cur = cur.Append(FILE_PATH_LITERAL("ppGoogleNaClPluginChrome.plugin")); | 249 cur = cur.Append(FILE_PATH_LITERAL("ppGoogleNaClPluginChrome.plugin")); |
250 #else // Linux and Chrome OS | 250 #else // Linux and Chrome OS |
251 cur = cur.Append(FILE_PATH_LITERAL("libppGoogleNaClPluginChrome.so")); | 251 cur = cur.Append(FILE_PATH_LITERAL("libppGoogleNaClPluginChrome.so")); |
252 #endif | 252 #endif |
253 break; | 253 break; |
254 case chrome::FILE_RESOURCES_PACK: | 254 case chrome::FILE_RESOURCES_PACK: |
255 #if defined(OS_MACOSX) | 255 #if defined(OS_MACOSX) |
256 if (mac_util::AmIBundled()) { | 256 if (base::mac::AmIBundled()) { |
257 cur = mac_util::MainAppBundlePath(); | 257 cur = base::mac::MainAppBundlePath(); |
258 cur = cur.Append(FILE_PATH_LITERAL("Resources")) | 258 cur = cur.Append(FILE_PATH_LITERAL("Resources")) |
259 .Append(FILE_PATH_LITERAL("resources.pak")); | 259 .Append(FILE_PATH_LITERAL("resources.pak")); |
260 break; | 260 break; |
261 } | 261 } |
262 // If we're not bundled on mac, resources.pak should be next to the | 262 // If we're not bundled on mac, resources.pak should be next to the |
263 // binary (e.g., for unit tests). | 263 // binary (e.g., for unit tests). |
264 #endif | 264 #endif |
265 if (!PathService::Get(base::DIR_MODULE, &cur)) | 265 if (!PathService::Get(base::DIR_MODULE, &cur)) |
266 return false; | 266 return false; |
267 cur = cur.Append(FILE_PATH_LITERAL("resources.pak")); | 267 cur = cur.Append(FILE_PATH_LITERAL("resources.pak")); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 return true; | 333 return true; |
334 } | 334 } |
335 | 335 |
336 // This cannot be done as a static initializer sadly since Visual Studio will | 336 // This cannot be done as a static initializer sadly since Visual Studio will |
337 // eliminate this object file if there is no direct entry point into it. | 337 // eliminate this object file if there is no direct entry point into it. |
338 void RegisterPathProvider() { | 338 void RegisterPathProvider() { |
339 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); | 339 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); |
340 } | 340 } |
341 | 341 |
342 } // namespace chrome | 342 } // namespace chrome |
OLD | NEW |