| 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 "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 "base/version.h" | 13 #include "base/version.h" |
| 14 #include "chrome/common/chrome_constants.h" | 14 #include "chrome/common/chrome_constants.h" |
| 15 #include "chrome/common/chrome_paths_internal.h" | 15 #include "chrome/common/chrome_paths_internal.h" |
| 16 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
| 17 #include "content/public/common/content_switches.h" |
| 17 | 18 |
| 18 #if defined(OS_MACOSX) | 19 #if defined(OS_MACOSX) |
| 19 #include "base/mac/mac_util.h" | 20 #include "base/mac/mac_util.h" |
| 20 #endif | 21 #endif |
| 21 | 22 |
| 22 namespace { | 23 namespace { |
| 23 | 24 |
| 24 // File name of the internal Flash plugin on different platforms. | 25 // File name of the internal Flash plugin on different platforms. |
| 25 const FilePath::CharType kInternalFlashPluginFileName[] = | 26 const FilePath::CharType kInternalFlashPluginFileName[] = |
| 26 #if defined(OS_MACOSX) | 27 #if defined(OS_MACOSX) |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 return PathService::Get(base::FILE_MODULE, result); | 125 return PathService::Get(base::FILE_MODULE, result); |
| 125 } | 126 } |
| 126 | 127 |
| 127 // Assume that we will not need to create the directory if it does not exist. | 128 // Assume that we will not need to create the directory if it does not exist. |
| 128 // This flag can be set to true for the cases where we want to create it. | 129 // This flag can be set to true for the cases where we want to create it. |
| 129 bool create_dir = false; | 130 bool create_dir = false; |
| 130 | 131 |
| 131 FilePath cur; | 132 FilePath cur; |
| 132 switch (key) { | 133 switch (key) { |
| 133 case chrome::DIR_USER_DATA: | 134 case chrome::DIR_USER_DATA: |
| 135 CHECK(ProcessNeedsProfileDir( |
| 136 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 137 switches::kProcessType))); |
| 134 if (!GetDefaultUserDataDirectory(&cur)) { | 138 if (!GetDefaultUserDataDirectory(&cur)) { |
| 135 NOTREACHED(); | 139 NOTREACHED(); |
| 136 return false; | 140 return false; |
| 137 } | 141 } |
| 138 create_dir = true; | 142 create_dir = true; |
| 139 break; | 143 break; |
| 140 case chrome::DIR_USER_DOCUMENTS: | 144 case chrome::DIR_USER_DOCUMENTS: |
| 141 if (!GetUserDocumentsDirectory(&cur)) | 145 if (!GetUserDocumentsDirectory(&cur)) |
| 142 return false; | 146 return false; |
| 143 create_dir = true; | 147 create_dir = true; |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 return true; | 434 return true; |
| 431 } | 435 } |
| 432 | 436 |
| 433 // This cannot be done as a static initializer sadly since Visual Studio will | 437 // This cannot be done as a static initializer sadly since Visual Studio will |
| 434 // eliminate this object file if there is no direct entry point into it. | 438 // eliminate this object file if there is no direct entry point into it. |
| 435 void RegisterPathProvider() { | 439 void RegisterPathProvider() { |
| 436 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); | 440 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); |
| 437 } | 441 } |
| 438 | 442 |
| 439 } // namespace chrome | 443 } // namespace chrome |
| OLD | NEW |