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

Unified Diff: chrome/browser/importer/nss_decryptor_mac.mm

Issue 18501013: Move most importer code to chrome/utility/importer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: another gyp attempt Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/importer/nss_decryptor_mac.h ('k') | chrome/browser/importer/nss_decryptor_null.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/importer/nss_decryptor_mac.mm
diff --git a/chrome/browser/importer/nss_decryptor_mac.mm b/chrome/browser/importer/nss_decryptor_mac.mm
deleted file mode 100644
index 7b45a1271b9135764c5d8cd0f2c48de8b7f769bb..0000000000000000000000000000000000000000
--- a/chrome/browser/importer/nss_decryptor_mac.mm
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <Cocoa/Cocoa.h>
-
-#include <dlfcn.h>
-
-#include "base/files/file_path.h"
-#include "base/logging.h"
-#include "base/strings/sys_string_conversions.h"
-
-#include "chrome/browser/importer/firefox_importer_utils.h"
-#include "chrome/browser/importer/nss_decryptor_mac.h"
-
-// Important!! : On OS X the nss3 libraries are compiled with depedencies
-// on one another, referenced using dyld's @executable_path directive.
-// To make a long story short in order to get the libraries to load, dyld's
-// fallback path needs to be set to the directory containing the libraries.
-// To do so, the process this function runs in must have the
-// DYLD_FALLBACK_LIBRARY_PATH set on startup to said directory.
-bool NSSDecryptor::Init(const base::FilePath& dll_path,
- const base::FilePath& db_path) {
- if (getenv("DYLD_FALLBACK_LIBRARY_PATH") == NULL) {
- LOG(ERROR) << "DYLD_FALLBACK_LIBRARY_PATH variable not set";
- return false;
- }
- base::FilePath nss3_path = dll_path.Append("libnss3.dylib");
-
- void* nss_3_lib = dlopen(nss3_path.value().c_str(), RTLD_LAZY);
- if (!nss_3_lib) {
- LOG(ERROR) << "Failed to load nss3 lib" << dlerror();
- return false;
- }
-
- NSS_Init = (NSSInitFunc)dlsym(nss_3_lib, "NSS_Init");
- NSS_Shutdown = (NSSShutdownFunc)dlsym(nss_3_lib, "NSS_Shutdown");
- PK11_GetInternalKeySlot =
- (PK11GetInternalKeySlotFunc)dlsym(nss_3_lib, "PK11_GetInternalKeySlot");
- PK11_CheckUserPassword =
- (PK11CheckUserPasswordFunc)dlsym(nss_3_lib, "PK11_CheckUserPassword");
- PK11_FreeSlot = (PK11FreeSlotFunc)dlsym(nss_3_lib, "PK11_FreeSlot");
- PK11_Authenticate =
- (PK11AuthenticateFunc)dlsym(nss_3_lib, "PK11_Authenticate");
- PK11SDR_Decrypt = (PK11SDRDecryptFunc)dlsym(nss_3_lib, "PK11SDR_Decrypt");
- SECITEM_FreeItem = (SECITEMFreeItemFunc)dlsym(nss_3_lib, "SECITEM_FreeItem");
-
- if (!NSS_Init || !NSS_Shutdown || !PK11_GetInternalKeySlot ||
- !PK11_CheckUserPassword || !PK11_FreeSlot || !PK11_Authenticate ||
- !PK11SDR_Decrypt || !SECITEM_FreeItem) {
- LOG(ERROR) << "NSS3 importer couldn't find entry points";
- return false;
- }
-
- SECStatus result = NSS_Init(db_path.value().c_str());
-
- if (result != SECSuccess) {
- LOG(ERROR) << "NSS_Init Failed returned: " << result;
- return false;
- }
-
- is_nss_initialized_ = true;
- return true;
-}
-
-NSSDecryptor::~NSSDecryptor() {
- if (NSS_Shutdown && is_nss_initialized_) {
- NSS_Shutdown();
- is_nss_initialized_ = false;
- }
-}
« no previous file with comments | « chrome/browser/importer/nss_decryptor_mac.h ('k') | chrome/browser/importer/nss_decryptor_null.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698