diff options
author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-09 17:47:35 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-09 17:47:35 +0000 |
commit | 109ca1cf9b29865a0f99dc99f379784dc980ac46 (patch) | |
tree | 4c16d6b37502c63e06a39cebe065b48c26ced764 /chrome | |
parent | 15a9b5d62a88c344af81ca28a393dc5c954162c6 (diff) | |
download | chromium_src-109ca1cf9b29865a0f99dc99f379784dc980ac46.zip chromium_src-109ca1cf9b29865a0f99dc99f379784dc980ac46.tar.gz chromium_src-109ca1cf9b29865a0f99dc99f379784dc980ac46.tar.bz2 |
Add dummy encryptor implementations for mac and linux.
Review URL: http://codereview.chromium.org/43095
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13435 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/browser.vcproj | 2 | ||||
-rw-r--r-- | chrome/browser/password_manager/encryptor_linux.cc | 44 | ||||
-rw-r--r-- | chrome/browser/password_manager/encryptor_mac.mm | 42 | ||||
-rw-r--r-- | chrome/browser/password_manager/encryptor_win.cc (renamed from chrome/browser/password_manager/encryptor.cc) | 4 | ||||
-rw-r--r-- | chrome/browser/webdata/web_database.cc | 17 | ||||
-rw-r--r-- | chrome/chrome.gyp | 10 | ||||
-rw-r--r-- | chrome/common/temp_scaffolding_stubs.h | 15 |
7 files changed, 98 insertions, 36 deletions
diff --git a/chrome/browser/browser.vcproj b/chrome/browser/browser.vcproj index 08401f2..5e7cfbe 100644 --- a/chrome/browser/browser.vcproj +++ b/chrome/browser/browser.vcproj @@ -1422,7 +1422,7 @@ Name="Password Manager" > <File - RelativePath=".\password_manager\encryptor.cc" + RelativePath=".\password_manager\encryptor_win.cc" > </File> <File diff --git a/chrome/browser/password_manager/encryptor_linux.cc b/chrome/browser/password_manager/encryptor_linux.cc new file mode 100644 index 0000000..9c40c37 --- /dev/null +++ b/chrome/browser/password_manager/encryptor_linux.cc @@ -0,0 +1,44 @@ +// Copyright (c) 2006-2008 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 "chrome/browser/password_manager/encryptor.h" + +#include "base/logging.h" +#include "base/string_util.h" + +bool Encryptor::EncryptString16(const string16& plaintext, + std::string* ciphertext) { + return EncryptString(UTF16ToUTF8(plaintext), ciphertext); +} + +bool Encryptor::DecryptString16(const std::string& ciphertext, + string16* plaintext) { + std::string utf8; + if (!DecryptString(ciphertext, &utf8)) + return false; + + *plaintext = UTF8ToUTF16(utf8); + return true; +} + +bool Encryptor::EncryptString(const std::string& plaintext, + std::string* ciphertext) { + // This doesn't actually encrypt, we need to work on the Encryptor API. + // http://code.google.com/p/chromium/issues/detail?id=8205 + NOTIMPLEMENTED(); + + // this does a copy + ciphertext->assign(plaintext.data(), plaintext.length()); + return true; +} + +bool Encryptor::DecryptString(const std::string& ciphertext, + std::string* plaintext) { + // This doesn't actually decrypt, we need to work on the Encryptor API. + // http://code.google.com/p/chromium/issues/detail?id=8205 + NOTIMPLEMENTED(); + + plaintext->assign(ciphertext.data(), ciphertext.length()); + return true; +} diff --git a/chrome/browser/password_manager/encryptor_mac.mm b/chrome/browser/password_manager/encryptor_mac.mm new file mode 100644 index 0000000..435f08d --- /dev/null +++ b/chrome/browser/password_manager/encryptor_mac.mm @@ -0,0 +1,42 @@ +// Copyright (c) 2006-2008 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 "chrome/browser/password_manager/encryptor.h" + +#include "base/logging.h" +#include "base/string_util.h" + +bool Encryptor::EncryptString16(const string16& plaintext, + std::string* ciphertext) { + return EncryptString(UTF16ToUTF8(plaintext), ciphertext); +} + +bool Encryptor::DecryptString16(const std::string& ciphertext, + string16* plaintext) { + std::string utf8; + if (!DecryptString(ciphertext, &utf8)) + return false; + + *plaintext = UTF8ToUTF16(utf8); + return true; +} + +bool Encryptor::EncryptString(const std::string& plaintext, + std::string* ciphertext) { + // This doesn't actually encrypt, we need to work on the Encryptor API. + NOTIMPLEMENTED(); + + // this does a copy + ciphertext->assign(plaintext.data(), plaintext.length()); + return true; +} + +bool Encryptor::DecryptString(const std::string& ciphertext, + std::string* plaintext) { + // This doesn't actually decrypt, we need to work on the Encryptor API. + NOTIMPLEMENTED(); + + plaintext->assign(ciphertext.data(), ciphertext.length()); + return true; +} diff --git a/chrome/browser/password_manager/encryptor.cc b/chrome/browser/password_manager/encryptor_win.cc index 0f7ea1d..76a9d3d 100644 --- a/chrome/browser/password_manager/encryptor.cc +++ b/chrome/browser/password_manager/encryptor_win.cc @@ -29,7 +29,7 @@ bool Encryptor::EncryptString(const std::string& plaintext, std::string* ciphertext) { DATA_BLOB input; input.pbData = const_cast<BYTE*>( - reinterpret_cast<const BYTE*>(plaintext.data())); + reinterpret_cast<const BYTE*>(plaintext.data())); input.cbData = static_cast<DWORD>(plaintext.length()); DATA_BLOB output; @@ -50,7 +50,7 @@ bool Encryptor::DecryptString(const std::string& ciphertext, std::string* plaintext) { DATA_BLOB input; input.pbData = const_cast<BYTE*>( - reinterpret_cast<const BYTE*>(ciphertext.data())); + reinterpret_cast<const BYTE*>(ciphertext.data())); input.cbData = static_cast<DWORD>(ciphertext.length()); DATA_BLOB output; diff --git a/chrome/browser/webdata/web_database.cc b/chrome/browser/webdata/web_database.cc index fe9fb5f..9497885 100644 --- a/chrome/browser/webdata/web_database.cc +++ b/chrome/browser/webdata/web_database.cc @@ -12,26 +12,17 @@ #include "base/gfx/png_encoder.h" #include "base/string_util.h" #include "base/time.h" -#include "base/values.h" #include "chrome/browser/history/history_database.h" #include "chrome/browser/search_engines/template_url.h" #include "chrome/common/l10n_util.h" -#include "chrome/common/scoped_vector.h" #include "webkit/glue/password_form.h" -#if defined(OS_POSIX) -// TODO(port): get rid of this include. It's used just to provide declarations -// and stub definitions for classes we encouter during the porting effort. -#include "chrome/common/temp_scaffolding_stubs.h" -#endif - -// TODO(port): Get rid of this section and finish porting. -#if defined(OS_WIN) // Encryptor is the *wrong* way of doing things; we need to turn it into a -// bottleneck to use the platform methods (e.g. Keychain on the Mac). That's -// going to take a massive change in its API... +// bottleneck to use the platform methods (e.g. Keychain on the Mac, Gnome +// Keyring / KWallet on Linux). That's going to take a massive change in its +// API... see: +// http://code.google.com/p/chromium/issues/detail?id=8205 (Linux) #include "chrome/browser/password_manager/encryptor.h" -#endif //////////////////////////////////////////////////////////////////////////////// // diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 61096fe..6d1c473 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -845,7 +845,9 @@ 'browser/options_window.h', 'browser/page_state.cc', 'browser/page_state.h', - 'browser/password_manager/encryptor.cc', + 'browser/password_manager/encryptor_linux.cc', + 'browser/password_manager/encryptor_mac.mm', + 'browser/password_manager/encryptor_win.cc', 'browser/password_manager/encryptor.h', 'browser/password_manager/ie7_password.cc', 'browser/password_manager/ie7_password.h', @@ -1329,9 +1331,8 @@ # Exclude all of hang_monitor. ['exclude', '^browser/hang_monitor/'], - # Exclude most of password_manager. - ['exclude', '^browser/password_manager/'], - ['include', '^browser/password_manager/password(_form)?_manager\\.cc$'], + # Exclude parts of password_manager. + ['exclude', '^browser/password_manager/ie7_password\\.cc$'], # Exclude most of printing. ['exclude', '^browser/printing/'], @@ -2285,7 +2286,6 @@ 'browser/importer/firefox_importer_unittest.cc', 'browser/importer/importer_unittest.cc', 'browser/login_prompt_unittest.cc', - 'browser/password_manager/encryptor_unittest.cc', 'browser/password_manager/password_form_manager_unittest.cc', 'browser/printing/page_number_unittest.cc', 'browser/printing/page_overlays_unittest.cc', diff --git a/chrome/common/temp_scaffolding_stubs.h b/chrome/common/temp_scaffolding_stubs.h index 12c05a6..d5359a9 100644 --- a/chrome/common/temp_scaffolding_stubs.h +++ b/chrome/common/temp_scaffolding_stubs.h @@ -404,21 +404,6 @@ class WindowSizer { //--------------------------------------------------------------------------- // These stubs are for Profile -class Encryptor { - public: - static bool EncryptString16(const string16& plaintext, - std::string* ciphertext) { - NOTIMPLEMENTED(); - return false; - } - - static bool DecryptString16(const std::string& ciphertext, - string16* plaintext) { - NOTIMPLEMENTED(); - return false; - } -}; - class WebAppLauncher { public: static void Launch(Profile* profile, const GURL& url) { |