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