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" |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 case chrome::DIR_BOOKMARK_MANAGER: | 161 case chrome::DIR_BOOKMARK_MANAGER: |
162 if (!PathService::Get(chrome::DIR_RESOURCES, &cur)) | 162 if (!PathService::Get(chrome::DIR_RESOURCES, &cur)) |
163 return false; | 163 return false; |
164 cur = cur.Append(FILE_PATH_LITERAL("bookmark_manager")); | 164 cur = cur.Append(FILE_PATH_LITERAL("bookmark_manager")); |
165 break; | 165 break; |
166 case chrome::DIR_INSPECTOR: | 166 case chrome::DIR_INSPECTOR: |
167 if (!PathService::Get(chrome::DIR_RESOURCES, &cur)) | 167 if (!PathService::Get(chrome::DIR_RESOURCES, &cur)) |
168 return false; | 168 return false; |
169 cur = cur.Append(FILE_PATH_LITERAL("inspector")); | 169 cur = cur.Append(FILE_PATH_LITERAL("inspector")); |
170 break; | 170 break; |
171 case chrome::DIR_NET_INTERNALS: | |
172 if (!PathService::Get(chrome::DIR_RESOURCES, &cur)) | |
173 return false; | |
174 cur = cur.Append(FILE_PATH_LITERAL("net_internals")); | |
175 break; | |
176 case chrome::DIR_APP_DICTIONARIES: | 171 case chrome::DIR_APP_DICTIONARIES: |
177 #if defined(OS_LINUX) || defined(OS_MACOSX) | 172 #if defined(OS_LINUX) || defined(OS_MACOSX) |
178 // We can't write into the EXE dir on Linux, so keep dictionaries | 173 // We can't write into the EXE dir on Linux, so keep dictionaries |
179 // alongside the safe browsing database in the user data dir. | 174 // alongside the safe browsing database in the user data dir. |
180 // And we don't want to write into the bundle on the Mac, so push | 175 // And we don't want to write into the bundle on the Mac, so push |
181 // it to the user data dir there also. | 176 // it to the user data dir there also. |
182 if (!PathService::Get(chrome::DIR_USER_DATA, &cur)) | 177 if (!PathService::Get(chrome::DIR_USER_DATA, &cur)) |
183 return false; | 178 return false; |
184 #else | 179 #else |
185 if (!PathService::Get(base::DIR_EXE, &cur)) | 180 if (!PathService::Get(base::DIR_EXE, &cur)) |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 return false; | 238 return false; |
244 #if defined(OS_WIN) | 239 #if defined(OS_WIN) |
245 cur = cur.Append(FILE_PATH_LITERAL("pdf.dll")); | 240 cur = cur.Append(FILE_PATH_LITERAL("pdf.dll")); |
246 #elif defined(OS_MACOSX) | 241 #elif defined(OS_MACOSX) |
247 cur = cur.Append(FILE_PATH_LITERAL("PDF.plugin")); | 242 cur = cur.Append(FILE_PATH_LITERAL("PDF.plugin")); |
248 #else // Linux and Chrome OS | 243 #else // Linux and Chrome OS |
249 cur = cur.Append(FILE_PATH_LITERAL("libpdf.so")); | 244 cur = cur.Append(FILE_PATH_LITERAL("libpdf.so")); |
250 #endif | 245 #endif |
251 break; | 246 break; |
252 case chrome::FILE_RESOURCES_PACK: | 247 case chrome::FILE_RESOURCES_PACK: |
| 248 #if defined(OS_MACOSX) |
| 249 if (mac_util::AmIBundled()) { |
| 250 cur = mac_util::MainAppBundlePath(); |
| 251 cur = cur.Append(FILE_PATH_LITERAL("Resources")) |
| 252 .Append(FILE_PATH_LITERAL("resources.pak")); |
| 253 break; |
| 254 } |
| 255 // If we're not bundled on mac, resources.pak should be next to the |
| 256 // binary (e.g., for unit tests). |
| 257 #endif |
253 if (!PathService::Get(base::DIR_EXE, &cur)) | 258 if (!PathService::Get(base::DIR_EXE, &cur)) |
254 return false; | 259 return false; |
255 cur = cur.Append(FILE_PATH_LITERAL("resources.pak")); | 260 cur = cur.Append(FILE_PATH_LITERAL("resources.pak")); |
256 break; | 261 break; |
257 #if defined(OS_CHROMEOS) | 262 #if defined(OS_CHROMEOS) |
258 case chrome::FILE_CHROMEOS_API: | 263 case chrome::FILE_CHROMEOS_API: |
259 if (!PathService::Get(base::DIR_MODULE, &cur)) | 264 if (!PathService::Get(base::DIR_MODULE, &cur)) |
260 return false; | 265 return false; |
261 cur = cur.Append(FILE_PATH_LITERAL("chromeos")); | 266 cur = cur.Append(FILE_PATH_LITERAL("chromeos")); |
262 cur = cur.Append(FILE_PATH_LITERAL("libcros.so")); | 267 cur = cur.Append(FILE_PATH_LITERAL("libcros.so")); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 return true; | 300 return true; |
296 } | 301 } |
297 | 302 |
298 // This cannot be done as a static initializer sadly since Visual Studio will | 303 // This cannot be done as a static initializer sadly since Visual Studio will |
299 // eliminate this object file if there is no direct entry point into it. | 304 // eliminate this object file if there is no direct entry point into it. |
300 void RegisterPathProvider() { | 305 void RegisterPathProvider() { |
301 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); | 306 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); |
302 } | 307 } |
303 | 308 |
304 } // namespace chrome | 309 } // namespace chrome |
OLD | NEW |