Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(488)

Side by Side Diff: crypto/nss_util.cc

Issue 200473002: Move all callers of GetHomeDir() to PathService::Get(base::DIR_HOME). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/ppapi_plugin/ppapi_plugin_main.cc ('k') | printing/backend/cups_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "crypto/nss_util.h" 5 #include "crypto/nss_util.h"
6 #include "crypto/nss_util_internal.h" 6 #include "crypto/nss_util_internal.h"
7 7
8 #include <nss.h> 8 #include <nss.h>
9 #include <pk11pub.h> 9 #include <pk11pub.h>
10 #include <plarena.h> 10 #include <plarena.h>
11 #include <prerror.h> 11 #include <prerror.h>
12 #include <prinit.h> 12 #include <prinit.h>
13 #include <prtime.h> 13 #include <prtime.h>
14 #include <secmod.h> 14 #include <secmod.h>
15 15
16 #if defined(OS_OPENBSD) 16 #if defined(OS_OPENBSD)
17 #include <sys/mount.h> 17 #include <sys/mount.h>
18 #include <sys/param.h> 18 #include <sys/param.h>
19 #endif 19 #endif
20 20
21 #include <map> 21 #include <map>
22 #include <vector> 22 #include <vector>
23 23
24 #include "base/base_paths.h"
24 #include "base/bind.h" 25 #include "base/bind.h"
25 #include "base/cpu.h" 26 #include "base/cpu.h"
26 #include "base/debug/alias.h" 27 #include "base/debug/alias.h"
27 #include "base/debug/stack_trace.h" 28 #include "base/debug/stack_trace.h"
28 #include "base/environment.h" 29 #include "base/environment.h"
29 #include "base/file_util.h" 30 #include "base/file_util.h"
30 #include "base/files/file_path.h" 31 #include "base/files/file_path.h"
31 #include "base/lazy_instance.h" 32 #include "base/lazy_instance.h"
32 #include "base/logging.h" 33 #include "base/logging.h"
33 #include "base/memory/scoped_ptr.h" 34 #include "base/memory/scoped_ptr.h"
34 #include "base/message_loop/message_loop.h" 35 #include "base/message_loop/message_loop.h"
35 #include "base/metrics/histogram.h" 36 #include "base/metrics/histogram.h"
36 #include "base/native_library.h" 37 #include "base/native_library.h"
38 #include "base/path_service.h"
37 #include "base/stl_util.h" 39 #include "base/stl_util.h"
38 #include "base/strings/stringprintf.h" 40 #include "base/strings/stringprintf.h"
39 #include "base/threading/thread_checker.h" 41 #include "base/threading/thread_checker.h"
40 #include "base/threading/thread_restrictions.h" 42 #include "base/threading/thread_restrictions.h"
41 #include "base/threading/worker_pool.h" 43 #include "base/threading/worker_pool.h"
42 #include "build/build_config.h" 44 #include "build/build_config.h"
43 45
44 // USE_NSS means we use NSS for everything crypto-related. If USE_NSS is not 46 // USE_NSS means we use NSS for everything crypto-related. If USE_NSS is not
45 // defined, such as on Mac and Windows, we use NSS for SSL only -- we don't 47 // defined, such as on Mac and Windows, we use NSS for SSL only -- we don't
46 // use NSS for crypto or certificate verification, and we don't use the NSS 48 // use NSS for crypto or certificate verification, and we don't use the NSS
(...skipping 26 matching lines...) Expand all
73 PRInt32 copied = PR_GetErrorText(error_text.get()); 75 PRInt32 copied = PR_GetErrorText(error_text.get());
74 result = std::string(error_text.get(), copied); 76 result = std::string(error_text.get(), copied);
75 } else { 77 } else {
76 result = base::StringPrintf("NSS error code: %d", PR_GetError()); 78 result = base::StringPrintf("NSS error code: %d", PR_GetError());
77 } 79 }
78 return result; 80 return result;
79 } 81 }
80 82
81 #if defined(USE_NSS) 83 #if defined(USE_NSS)
82 base::FilePath GetDefaultConfigDirectory() { 84 base::FilePath GetDefaultConfigDirectory() {
83 base::FilePath dir = base::GetHomeDir(); 85 base::FilePath dir;
86 PathService::Get(base::DIR_HOME, &dir);
84 if (dir.empty()) { 87 if (dir.empty()) {
85 LOG(ERROR) << "Failed to get home directory."; 88 LOG(ERROR) << "Failed to get home directory.";
86 return dir; 89 return dir;
87 } 90 }
88 dir = dir.AppendASCII(".pki").AppendASCII("nssdb"); 91 dir = dir.AppendASCII(".pki").AppendASCII("nssdb");
89 if (!base::CreateDirectory(dir)) { 92 if (!base::CreateDirectory(dir)) {
90 LOG(ERROR) << "Failed to create " << dir.value() << " directory."; 93 LOG(ERROR) << "Failed to create " << dir.value() << " directory.";
91 dir.clear(); 94 dir.clear();
92 } 95 }
93 DVLOG(2) << "DefaultConfigDirectory: " << dir.value(); 96 DVLOG(2) << "DefaultConfigDirectory: " << dir.value();
(...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 1152
1150 PK11SlotInfo* GetPublicNSSKeySlot() { 1153 PK11SlotInfo* GetPublicNSSKeySlot() {
1151 return g_nss_singleton.Get().GetPublicNSSKeySlot(); 1154 return g_nss_singleton.Get().GetPublicNSSKeySlot();
1152 } 1155 }
1153 1156
1154 PK11SlotInfo* GetPrivateNSSKeySlot() { 1157 PK11SlotInfo* GetPrivateNSSKeySlot() {
1155 return g_nss_singleton.Get().GetPrivateNSSKeySlot(); 1158 return g_nss_singleton.Get().GetPrivateNSSKeySlot();
1156 } 1159 }
1157 1160
1158 } // namespace crypto 1161 } // namespace crypto
OLDNEW
« no previous file with comments | « content/ppapi_plugin/ppapi_plugin_main.cc ('k') | printing/backend/cups_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698