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

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

Issue 159165: Split NSSDecryptor out into platform specific files.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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_linux.cc ('k') | chrome/browser/importer/nss_decryptor_win.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.h
===================================================================
--- chrome/browser/importer/nss_decryptor_mac.h (revision 21221)
+++ chrome/browser/importer/nss_decryptor_mac.h (working copy)
@@ -2,83 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_IMPORTER_FIREFOX_IMPORTER_UTILS_H_
-#define CHROME_BROWSER_IMPORTER_FIREFOX_IMPORTER_UTILS_H_
+#ifndef CHROME_BROWSER_IMPORTER_NSS_DECRYPTOR_MAC_H_
+#define CHROME_BROWSER_IMPORTER_NSS_DECRYPTOR_MAC_H_
+#include <string>
#include <vector>
#include "base/basictypes.h"
-#include "base/file_path.h"
-#include "base/native_library.h"
-#include "build/build_config.h"
+#include "base/logging.h"
-class DictionaryValue;
-class GURL;
-class TemplateURL;
-
-namespace webkit_glue {
-struct PasswordForm;
-}
-
-#if defined(OS_WIN)
-// Detects which version of Firefox is installed from registry. Returns its
-// major version, and drops the minor version. Returns 0 if
-// failed. If there are indicators of both FF2 and FF3 it is
-// biased to return the biggest version.
-int GetCurrentFirefoxMajorVersionFromRegistry();
-
-// Detects where Firefox lives. Returns a empty string if Firefox
-// is not installed.
-std::wstring GetFirefoxInstallPathFromRegistry();
-#endif
-
-// Detects version of Firefox and installation path from given Firefox profile
-bool GetFirefoxVersionAndPathFromProfile(const std::wstring& profile_path,
- int* version,
- std::wstring* app_path);
-
-// Gets the full path of the profiles.ini file. This file records
-// the profiles that can be used by Firefox. Returns an empty
-// string if failed.
-FilePath GetProfilesINI();
-
-// Parses the profile.ini file, and stores its information in |root|.
-// This file is a plain-text file. Key/value pairs are stored one per
-// line, and they are separeated in different sections. For example:
-// [General]
-// StartWithLastProfile=1
-//
-// [Profile0]
-// Name=default
-// IsRelative=1
-// Path=Profiles/abcdefeg.default
-// We set "[value]" in path "<Section>.<Key>". For example, the path
-// "Genenral.StartWithLastProfile" has the value "1".
-void ParseProfileINI(std::wstring file, DictionaryValue* root);
-
-// Returns true if we want to add the URL to the history. We filter
-// out the URL with a unsupported scheme.
-bool CanImportURL(const GURL& url);
-
-// Parses the OpenSearch XML files in |xml_files| and populates |search_engines|
-// with the resulting TemplateURLs.
-void ParseSearchEnginesFromXMLFiles(const std::vector<std::wstring>& xml_files,
- std::vector<TemplateURL*>* search_engines);
-
-// Returns the index of the default search engine in the |search_engines| list.
-// If none is found, -1 is returned.
-int GetFirefoxDefaultSearchEngineIndex(
- const std::vector<TemplateURL*>& search_engines,
- const std::wstring& profile_path);
-
-// Returns the home page set in Firefox in a particular profile.
-GURL GetHomepage(const std::wstring& profile_path);
-
-// Checks to see if this home page is a default home page, as specified by
-// the resource file browserconfig.properties in the Firefox application
-// directory.
-bool IsDefaultHomepage(const GURL& homepage, const std::wstring& app_path);
-
// The following declarations of functions and types are from Firefox
// NSS library.
// source code:
@@ -170,21 +102,30 @@
typedef void (*SECITEMFreeItemFunc)(SECItem *item, PRBool free_it);
typedef void (*PLArenaFinishFunc)(void);
typedef PRStatus (*PRCleanupFunc)(void);
+namespace webkit_glue {
+struct PasswordForm;
+}
// A wrapper for Firefox NSS decrypt component.
class NSSDecryptor {
public:
- NSSDecryptor();
- ~NSSDecryptor();
+ NSSDecryptor()
+ : NSS_Init(NULL), NSS_Shutdown(NULL), PK11_GetInternalKeySlot(NULL),
+ PK11_CheckUserPassword(NULL), PK11_FreeSlot(NULL),
+ PK11_Authenticate(NULL), PK11SDR_Decrypt(NULL), SECITEM_FreeItem(NULL),
+ PL_ArenaFinish(NULL), PR_Cleanup(NULL),
+ is_nss_initialized_(false) {}
+ ~NSSDecryptor() {}
- // Loads NSS3 library and returns true if successful.
- // |dll_path| indicates the location of NSS3 DLL files, and |db_path|
- // is the location of the database file that stores the keys.
- bool Init(const std::wstring& dll_path, const std::wstring& db_path);
+ // Initializes NSS if it hasn't already been initialized.
+ bool Init(const std::wstring& /* dll_path */,
+ const std::wstring& /* db_path */) {
+ // TODO(port): Load the NSS libraries and call InitNSS()
+ // http://code.google.com/p/chromium/issues/detail?id=15455
+ NOTIMPLEMENTED();
+ return false;
+ }
- // Frees the libraries.
- void Free();
-
// Decrypts Firefox stored passwords. Before using this method,
// make sure Init() returns true.
std::wstring Decrypt(const std::string& crypt) const;
@@ -196,11 +137,6 @@
std::vector<webkit_glue::PasswordForm>* forms);
private:
- // Performs tasks common across all platforms to initialize NSS.
- bool InitNSS(const std::wstring& db_path,
- base::NativeLibrary plds4_dll,
- base::NativeLibrary nspr4_dll);
-
// Methods in Firefox security components.
NSSInitFunc NSS_Init;
NSSShutdownFunc NSS_Shutdown;
@@ -213,20 +149,10 @@
PLArenaFinishFunc PL_ArenaFinish;
PRCleanupFunc PR_Cleanup;
- // Libraries necessary for decrypting the passwords.
- static const wchar_t kNSS3Library[];
- static const wchar_t kSoftokn3Library[];
- static const wchar_t kPLDS4Library[];
- static const wchar_t kNSPR4Library[];
-
- // NSS3 module handles.
- base::NativeLibrary nss3_dll_;
- base::NativeLibrary softokn3_dll_;
-
// True if NSS_Init() has been called
bool is_nss_initialized_;
DISALLOW_COPY_AND_ASSIGN(NSSDecryptor);
};
-#endif // CHROME_BROWSER_IMPORTER_FIREFOX_IMPORTER_UTILS_H_
+#endif // CHROME_BROWSER_IMPORTER_NSS_DECRYPTOR_MAC_H_
« no previous file with comments | « chrome/browser/importer/nss_decryptor_linux.cc ('k') | chrome/browser/importer/nss_decryptor_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698