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

Side by Side Diff: trunk/src/crypto/nss_util.cc

Issue 284333002: Revert 270872 "Move all callers of GetHomeDir() to PathService::..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 7 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
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"
25 #include "base/bind.h" 24 #include "base/bind.h"
26 #include "base/cpu.h" 25 #include "base/cpu.h"
27 #include "base/debug/alias.h" 26 #include "base/debug/alias.h"
28 #include "base/debug/stack_trace.h" 27 #include "base/debug/stack_trace.h"
29 #include "base/environment.h" 28 #include "base/environment.h"
30 #include "base/file_util.h" 29 #include "base/file_util.h"
31 #include "base/files/file_path.h" 30 #include "base/files/file_path.h"
32 #include "base/lazy_instance.h" 31 #include "base/lazy_instance.h"
33 #include "base/logging.h" 32 #include "base/logging.h"
34 #include "base/memory/scoped_ptr.h" 33 #include "base/memory/scoped_ptr.h"
35 #include "base/message_loop/message_loop.h" 34 #include "base/message_loop/message_loop.h"
36 #include "base/metrics/histogram.h" 35 #include "base/metrics/histogram.h"
37 #include "base/native_library.h" 36 #include "base/native_library.h"
38 #include "base/path_service.h"
39 #include "base/stl_util.h" 37 #include "base/stl_util.h"
40 #include "base/strings/stringprintf.h" 38 #include "base/strings/stringprintf.h"
41 #include "base/threading/thread_checker.h" 39 #include "base/threading/thread_checker.h"
42 #include "base/threading/thread_restrictions.h" 40 #include "base/threading/thread_restrictions.h"
43 #include "base/threading/worker_pool.h" 41 #include "base/threading/worker_pool.h"
44 #include "build/build_config.h" 42 #include "build/build_config.h"
45 43
46 // USE_NSS means we use NSS for everything crypto-related. If USE_NSS is not 44 // USE_NSS means we use NSS for everything crypto-related. If USE_NSS is not
47 // defined, such as on Mac and Windows, we use NSS for SSL only -- we don't 45 // defined, such as on Mac and Windows, we use NSS for SSL only -- we don't
48 // use NSS for crypto or certificate verification, and we don't use the NSS 46 // use NSS for crypto or certificate verification, and we don't use the NSS
(...skipping 26 matching lines...) Expand all
75 PRInt32 copied = PR_GetErrorText(error_text.get()); 73 PRInt32 copied = PR_GetErrorText(error_text.get());
76 result = std::string(error_text.get(), copied); 74 result = std::string(error_text.get(), copied);
77 } else { 75 } else {
78 result = base::StringPrintf("NSS error code: %d", PR_GetError()); 76 result = base::StringPrintf("NSS error code: %d", PR_GetError());
79 } 77 }
80 return result; 78 return result;
81 } 79 }
82 80
83 #if defined(USE_NSS) 81 #if defined(USE_NSS)
84 base::FilePath GetDefaultConfigDirectory() { 82 base::FilePath GetDefaultConfigDirectory() {
85 base::FilePath dir; 83 base::FilePath dir = base::GetHomeDir();
86 PathService::Get(base::DIR_HOME, &dir);
87 if (dir.empty()) { 84 if (dir.empty()) {
88 LOG(ERROR) << "Failed to get home directory."; 85 LOG(ERROR) << "Failed to get home directory.";
89 return dir; 86 return dir;
90 } 87 }
91 dir = dir.AppendASCII(".pki").AppendASCII("nssdb"); 88 dir = dir.AppendASCII(".pki").AppendASCII("nssdb");
92 if (!base::CreateDirectory(dir)) { 89 if (!base::CreateDirectory(dir)) {
93 LOG(ERROR) << "Failed to create " << dir.value() << " directory."; 90 LOG(ERROR) << "Failed to create " << dir.value() << " directory.";
94 dir.clear(); 91 dir.clear();
95 } 92 }
96 DVLOG(2) << "DefaultConfigDirectory: " << dir.value(); 93 DVLOG(2) << "DefaultConfigDirectory: " << dir.value();
(...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after
1152 1149
1153 PK11SlotInfo* GetPublicNSSKeySlot() { 1150 PK11SlotInfo* GetPublicNSSKeySlot() {
1154 return g_nss_singleton.Get().GetPublicNSSKeySlot(); 1151 return g_nss_singleton.Get().GetPublicNSSKeySlot();
1155 } 1152 }
1156 1153
1157 PK11SlotInfo* GetPrivateNSSKeySlot() { 1154 PK11SlotInfo* GetPrivateNSSKeySlot() {
1158 return g_nss_singleton.Get().GetPrivateNSSKeySlot(); 1155 return g_nss_singleton.Get().GetPrivateNSSKeySlot();
1159 } 1156 }
1160 1157
1161 } // namespace crypto 1158 } // namespace crypto
OLDNEW
« no previous file with comments | « trunk/src/content/ppapi_plugin/ppapi_plugin_main.cc ('k') | trunk/src/printing/backend/cups_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698