diff options
-rw-r--r-- | chrome/chrome_tests_unit.gypi | 4 | ||||
-rw-r--r-- | components/autofill.gypi | 2 | ||||
-rw-r--r-- | components/autofill/core/browser/DEPS | 3 | ||||
-rw-r--r-- | components/autofill/core/browser/autofill_ie_toolbar_import_win.cc | 4 | ||||
-rw-r--r-- | components/autofill/core/browser/autofill_ie_toolbar_import_win_unittest.cc | 4 | ||||
-rw-r--r-- | components/autofill/core/browser/data_encryption_win.cc (renamed from sync/util/data_encryption_win.cc) | 8 | ||||
-rw-r--r-- | components/autofill/core/browser/data_encryption_win.h | 20 | ||||
-rw-r--r-- | components/autofill/core/browser/data_encryption_win_unittest.cc (renamed from sync/util/data_encryption_win_unittest.cc) | 12 | ||||
-rw-r--r-- | components/components_tests.gypi | 4 | ||||
-rw-r--r-- | sync/sync_core.gypi | 6 | ||||
-rw-r--r-- | sync/sync_tests.gypi | 1 | ||||
-rw-r--r-- | sync/util/data_encryption_win.h | 22 |
12 files changed, 42 insertions, 48 deletions
diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi index 12efcd4..5b18094 100644 --- a/chrome/chrome_tests_unit.gypi +++ b/chrome/chrome_tests_unit.gypi @@ -1780,7 +1780,7 @@ # unit_tests than in base_unittests. '../base/path_service_unittest.cc', - # TODO(joi): Move to //components/components.gypi once + # TODO(joi): Move to //components/components_tests.gypi once # remaining dependencies back to //chrome are eliminated. '../components/autofill/content/browser/autocheckout/whitelist_manager_unittest.cc', '../components/autofill/content/browser/autocheckout_manager_unittest.cc', @@ -1826,7 +1826,7 @@ '../components/autofill/core/browser/phone_number_i18n_unittest.cc', '../components/autofill/core/browser/validation_unittest.cc', - # TODO(caitkp): Move to //components/components.gypi once + # TODO(caitkp): Move to //components/components_tests.gypi once # remaining dependencies back to //chrome are eliminated. '../components/autofill/core/browser/webdata/autofill_entry_unittest.cc', '../components/autofill/core/browser/webdata/autofill_table_unittest.cc', diff --git a/components/autofill.gypi b/components/autofill.gypi index ebd4cf0..a8a140b 100644 --- a/components/autofill.gypi +++ b/components/autofill.gypi @@ -163,6 +163,8 @@ 'autofill/core/browser/credit_card.h', 'autofill/core/browser/credit_card_field.cc', 'autofill/core/browser/credit_card_field.h', + 'autofill/core/browser/data_encryption_win.cc', + 'autofill/core/browser/data_encryption_win.h', 'autofill/core/browser/email_field.cc', 'autofill/core/browser/email_field.h', 'autofill/core/browser/field_types.h', diff --git a/components/autofill/core/browser/DEPS b/components/autofill/core/browser/DEPS index f10e304..af47ba2 100644 --- a/components/autofill/core/browser/DEPS +++ b/components/autofill/core/browser/DEPS @@ -33,9 +33,6 @@ include_rules = [ "!content/public/common/url_constants.h", "!third_party/WebKit/public/web/WebAutofillClient.h", "!third_party/WebKit/public/web/WebInputElement.h", - - # TODO(akalin): Remove this dependency. - "!sync/util/data_encryption_win.h", ] specific_include_rules = { diff --git a/components/autofill/core/browser/autofill_ie_toolbar_import_win.cc b/components/autofill/core/browser/autofill_ie_toolbar_import_win.cc index d34e362..c4c3cf0 100644 --- a/components/autofill/core/browser/autofill_ie_toolbar_import_win.cc +++ b/components/autofill/core/browser/autofill_ie_toolbar_import_win.cc @@ -18,13 +18,13 @@ #include "components/autofill/core/browser/autofill_profile.h" #include "components/autofill/core/browser/credit_card.h" #include "components/autofill/core/browser/crypto/rc4_decryptor.h" +#include "components/autofill/core/browser/data_encryption_win.h" #include "components/autofill/core/browser/field_types.h" #include "components/autofill/core/browser/form_group.h" #include "components/autofill/core/browser/personal_data_manager.h" #include "components/autofill/core/browser/personal_data_manager_observer.h" #include "components/autofill/core/browser/phone_number.h" #include "components/autofill/core/browser/phone_number_i18n.h" -#include "sync/util/data_encryption_win.h" using base::win::RegKey; @@ -86,7 +86,7 @@ base::string16 ReadAndDecryptValue(const RegKey& key, result = key.ReadValue(value_name, &(data[0]), &data_size, &data_type); if (result == ERROR_SUCCESS) { std::string out_data; - if (syncer::DecryptData(data, &out_data)) { + if (DecryptData(data, &out_data)) { // The actual data is in UTF16 already. if (!(out_data.size() & 1) && (out_data.size() > 2) && !out_data[out_data.size() - 1] && !out_data[out_data.size() - 2]) { diff --git a/components/autofill/core/browser/autofill_ie_toolbar_import_win_unittest.cc b/components/autofill/core/browser/autofill_ie_toolbar_import_win_unittest.cc index 13e1b03..48d57aa 100644 --- a/components/autofill/core/browser/autofill_ie_toolbar_import_win_unittest.cc +++ b/components/autofill/core/browser/autofill_ie_toolbar_import_win_unittest.cc @@ -9,8 +9,8 @@ #include "base/win/registry.h" #include "components/autofill/core/browser/autofill_profile.h" #include "components/autofill/core/browser/credit_card.h" +#include "components/autofill/core/browser/data_encryption_win.h" #include "components/autofill/core/browser/field_types.h" -#include "sync/util/data_encryption_win.h" #include "testing/gtest/include/gtest/gtest.h" using base::win::RegKey; @@ -91,7 +91,7 @@ void EncryptAndWrite(RegKey* key, const ValueDescription* value) { data.resize(data_size); memcpy(&data[0], value->value, data_size); - std::vector<uint8> encrypted_data = syncer::EncryptData(data); + std::vector<uint8> encrypted_data = EncryptData(data); EXPECT_EQ(ERROR_SUCCESS, key->WriteValue(value->value_name, &encrypted_data[0], encrypted_data.size(), REG_BINARY)); } diff --git a/sync/util/data_encryption_win.cc b/components/autofill/core/browser/data_encryption_win.cc index 5fec33b..0b4df97 100644 --- a/sync/util/data_encryption_win.cc +++ b/components/autofill/core/browser/data_encryption_win.cc @@ -1,8 +1,8 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright 2013 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 "sync/util/data_encryption_win.h" +#include "components/autofill/core/browser/data_encryption_win.h" #include <windows.h> #include <wincrypt.h> @@ -17,7 +17,7 @@ // components/webdata/encryptor/encryptor_win.cc. Preferably, all // this stuff would live in crypto/. -namespace syncer { +namespace autofill { std::vector<uint8> EncryptData(const std::string& data) { DATA_BLOB unencrypted_data = { 0 }; @@ -54,4 +54,4 @@ bool DecryptData(const std::vector<uint8>& in_data, std::string* out_data) { } } -} // namespace syncer +} // namespace autofill diff --git a/components/autofill/core/browser/data_encryption_win.h b/components/autofill/core/browser/data_encryption_win.h new file mode 100644 index 0000000..1ad1140 --- /dev/null +++ b/components/autofill/core/browser/data_encryption_win.h @@ -0,0 +1,20 @@ +// Copyright 2013 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. + +#ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_DATA_ENCRYPTION_WIN_H_ +#define COMPONENTS_AUTOFILL_CORE_BROWSER_DATA_ENCRYPTION_WIN_H_ + +#include <string> +#include <vector> + +#include "base/basictypes.h" + +namespace autofill { + +std::vector<uint8> EncryptData(const std::string& data); +bool DecryptData(const std::vector<uint8>& in_data, std::string* out_data); + +} // namespace autofill + +#endif // COMPONENTS_AUTOFILL_CORE_BROWSER_DATA_ENCRYPTION_WIN_H_ diff --git a/sync/util/data_encryption_win_unittest.cc b/components/autofill/core/browser/data_encryption_win_unittest.cc index 0510554..6e0fca9 100644 --- a/sync/util/data_encryption_win_unittest.cc +++ b/components/autofill/core/browser/data_encryption_win_unittest.cc @@ -1,15 +1,15 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright 2013 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 "sync/util/data_encryption_win.h" +#include "components/autofill/core/browser/data_encryption_win.h" #include "testing/gtest/include/gtest/gtest.h" -namespace syncer { +namespace autofill { namespace { -TEST(SyncDataEncryption, TestEncryptDecryptOfSampleString) { +TEST(DataEncryptionWinTest, TestEncryptDecryptOfSampleString) { std::vector<uint8> example(EncryptData("example")); ASSERT_FALSE(example.empty()); std::string result; @@ -17,11 +17,11 @@ TEST(SyncDataEncryption, TestEncryptDecryptOfSampleString) { ASSERT_TRUE(result == "example"); } -TEST(SyncDataEncryption, TestDecryptFailure) { +TEST(DataEncryptionWinTest, TestDecryptFailure) { std::vector<uint8> example(0, 0); std::string result; ASSERT_FALSE(DecryptData(example, &result)); } } // namespace -} // namespace syncer +} // namespace autofill diff --git a/components/components_tests.gypi b/components/components_tests.gypi index 2de146b..4325216 100644 --- a/components/components_tests.gypi +++ b/components/components_tests.gypi @@ -11,6 +11,7 @@ 'type': '<(gtest_target_type)', 'sources': [ 'auto_login_parser/auto_login_parser_unittest.cc', + 'autofill/core/browser/data_encryption_win_unittest.cc', 'browser_context_keyed_service/browser_context_dependency_manager_unittest.cc', 'browser_context_keyed_service/dependency_graph_unittest.cc', 'navigation_interception/intercept_navigation_resource_throttle_unittest.cc', @@ -32,6 +33,9 @@ # Dependencies of auto_login_parser 'auto_login_parser', + # Dependencies of autofill + 'autofill_core_browser', + # Dependencies of browser_context_keyed_service 'browser_context_keyed_service', diff --git a/sync/sync_core.gypi b/sync/sync_core.gypi index 5d0bac9..f61d622 100644 --- a/sync/sync_core.gypi +++ b/sync/sync_core.gypi @@ -167,12 +167,6 @@ 'syncable/write_transaction_info.h', 'util/cryptographer.cc', 'util/cryptographer.h', - - # TODO(akalin): Figure out a better place to put - # data_encryption_win*; it's also used by autofill. - 'util/data_encryption_win.cc', - 'util/data_encryption_win.h', - 'util/data_type_histogram.h', 'util/encryptor.h', 'util/extensions_activity_monitor.cc', diff --git a/sync/sync_tests.gypi b/sync/sync_tests.gypi index 7c56492..e2f7c9e 100644 --- a/sync/sync_tests.gypi +++ b/sync/sync_tests.gypi @@ -268,7 +268,6 @@ 'syncable/syncable_unittest.cc', 'syncable/syncable_util_unittest.cc', 'util/cryptographer_unittest.cc', - 'util/data_encryption_win_unittest.cc', 'util/data_type_histogram_unittest.cc', 'util/get_session_name_unittest.cc', 'util/nigori_unittest.cc', diff --git a/sync/util/data_encryption_win.h b/sync/util/data_encryption_win.h deleted file mode 100644 index 1b037c7..0000000 --- a/sync/util/data_encryption_win.h +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012 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. - -#ifndef SYNC_UTIL_DATA_ENCRYPTION_WIN_H_ -#define SYNC_UTIL_DATA_ENCRYPTION_WIN_H_ - -#include <string> -#include <vector> - -#include "base/basictypes.h" -#include "sync/base/sync_export.h" - -namespace syncer { - -SYNC_EXPORT_PRIVATE std::vector<uint8> EncryptData(const std::string& data); -SYNC_EXPORT bool DecryptData(const std::vector<uint8>& in_data, - std::string* out_data); - -} // namespace syncer - -#endif // SYNC_UTIL_DATA_ENCRYPTION_WIN_H_ |