| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/public/common/content_paths.h" | 5 #include "content/public/common/content_paths.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/mac/bundle_locations.h" |
| 8 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 9 | 10 |
| 10 namespace content { | 11 namespace content { |
| 11 | 12 |
| 12 bool PathProvider(int key, FilePath* result) { | 13 bool PathProvider(int key, FilePath* result) { |
| 13 switch (key) { | 14 switch (key) { |
| 14 case CHILD_PROCESS_EXE: | 15 case CHILD_PROCESS_EXE: |
| 15 return PathService::Get(base::FILE_EXE, result); | 16 return PathService::Get(base::FILE_EXE, result); |
| 16 case DIR_TEST_DATA: { | 17 case DIR_TEST_DATA: { |
| 17 FilePath cur; | 18 FilePath cur; |
| 18 if (!PathService::Get(base::DIR_SOURCE_ROOT, &cur)) | 19 if (!PathService::Get(base::DIR_SOURCE_ROOT, &cur)) |
| 19 return false; | 20 return false; |
| 20 cur = cur.Append(FILE_PATH_LITERAL("content")); | 21 cur = cur.Append(FILE_PATH_LITERAL("content")); |
| 21 cur = cur.Append(FILE_PATH_LITERAL("test")); | 22 cur = cur.Append(FILE_PATH_LITERAL("test")); |
| 22 cur = cur.Append(FILE_PATH_LITERAL("data")); | 23 cur = cur.Append(FILE_PATH_LITERAL("data")); |
| 23 if (!file_util::PathExists(cur)) // we don't want to create this | 24 if (!file_util::PathExists(cur)) // we don't want to create this |
| 24 return false; | 25 return false; |
| 25 | 26 |
| 26 *result = cur; | 27 *result = cur; |
| 27 return true; | 28 return true; |
| 28 break; | 29 break; |
| 29 } | 30 } |
| 31 case DIR_MEDIA_LIBS: { |
| 32 #if defined(OS_MACOSX) |
| 33 *result = base::mac::FrameworkBundlePath(); |
| 34 *result = result->Append("Libraries"); |
| 35 return true; |
| 36 #else |
| 37 return PathService::Get(base::DIR_MODULE, result); |
| 38 #endif |
| 39 } |
| 30 default: | 40 default: |
| 31 return false; | 41 return false; |
| 32 } | 42 } |
| 33 | 43 |
| 34 return false; | 44 return false; |
| 35 } | 45 } |
| 36 | 46 |
| 37 // This cannot be done as a static initializer sadly since Visual Studio will | 47 // This cannot be done as a static initializer sadly since Visual Studio will |
| 38 // eliminate this object file if there is no direct entry point into it. | 48 // eliminate this object file if there is no direct entry point into it. |
| 39 void RegisterPathProvider() { | 49 void RegisterPathProvider() { |
| 40 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); | 50 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); |
| 41 } | 51 } |
| 42 | 52 |
| 43 } // namespace content | 53 } // namespace content |
| OLD | NEW |