| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/mac/bundle_locations.h" | 10 #include "base/mac/bundle_locations.h" |
| 11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 13 #include "base/sys_info.h" | 13 #include "base/sys_info.h" |
| 14 #include "base/version.h" | 14 #include "base/version.h" |
| 15 #include "chrome/common/chrome_constants.h" | 15 #include "chrome/common/chrome_constants.h" |
| 16 #include "chrome/common/chrome_paths_internal.h" | 16 #include "chrome/common/chrome_paths_internal.h" |
| 17 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
| 18 #include "content/public/common/content_switches.h" |
| 18 | 19 |
| 19 #if defined(OS_MACOSX) | 20 #if defined(OS_MACOSX) |
| 20 #include "base/mac/mac_util.h" | 21 #include "base/mac/mac_util.h" |
| 21 #endif | 22 #endif |
| 22 | 23 |
| 23 namespace { | 24 namespace { |
| 24 | 25 |
| 25 // File name of the internal Flash plugin on different platforms. | 26 // File name of the internal Flash plugin on different platforms. |
| 26 const FilePath::CharType kInternalFlashPluginFileName[] = | 27 const FilePath::CharType kInternalFlashPluginFileName[] = |
| 27 #if defined(OS_MACOSX) | 28 #if defined(OS_MACOSX) |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 return PathService::Get(base::FILE_MODULE, result); | 138 return PathService::Get(base::FILE_MODULE, result); |
| 138 } | 139 } |
| 139 | 140 |
| 140 // Assume that we will not need to create the directory if it does not exist. | 141 // Assume that we will not need to create the directory if it does not exist. |
| 141 // This flag can be set to true for the cases where we want to create it. | 142 // This flag can be set to true for the cases where we want to create it. |
| 142 bool create_dir = false; | 143 bool create_dir = false; |
| 143 | 144 |
| 144 FilePath cur; | 145 FilePath cur; |
| 145 switch (key) { | 146 switch (key) { |
| 146 case chrome::DIR_USER_DATA: | 147 case chrome::DIR_USER_DATA: |
| 148 CHECK(ProcessNeedsProfileDir( |
| 149 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 150 switches::kProcessType))); |
| 147 if (!GetDefaultUserDataDirectory(&cur)) { | 151 if (!GetDefaultUserDataDirectory(&cur)) { |
| 148 NOTREACHED(); | 152 NOTREACHED(); |
| 149 return false; | 153 return false; |
| 150 } | 154 } |
| 151 create_dir = true; | 155 create_dir = true; |
| 152 break; | 156 break; |
| 153 case chrome::DIR_USER_DOCUMENTS: | 157 case chrome::DIR_USER_DOCUMENTS: |
| 154 if (!GetUserDocumentsDirectory(&cur)) | 158 if (!GetUserDocumentsDirectory(&cur)) |
| 155 return false; | 159 return false; |
| 156 create_dir = true; | 160 create_dir = true; |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 return true; | 424 return true; |
| 421 } | 425 } |
| 422 | 426 |
| 423 // This cannot be done as a static initializer sadly since Visual Studio will | 427 // This cannot be done as a static initializer sadly since Visual Studio will |
| 424 // eliminate this object file if there is no direct entry point into it. | 428 // eliminate this object file if there is no direct entry point into it. |
| 425 void RegisterPathProvider() { | 429 void RegisterPathProvider() { |
| 426 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); | 430 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); |
| 427 } | 431 } |
| 428 | 432 |
| 429 } // namespace chrome | 433 } // namespace chrome |
| OLD | NEW |