summaryrefslogtreecommitdiffstats
path: root/components/autofill
diff options
context:
space:
mode:
authorkkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-18 20:04:52 +0000
committerkkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-18 20:04:52 +0000
commit1edcc098ecccfe49927c9623be927ecd830e96b0 (patch)
tree22c9adaccc160660bf44edff2fa9fe9d6393440c /components/autofill
parented1688dcc59e99074a898ac592aedd66c8b3c4d8 (diff)
downloadchromium_src-1edcc098ecccfe49927c9623be927ecd830e96b0.zip
chromium_src-1edcc098ecccfe49927c9623be927ecd830e96b0.tar.gz
chromium_src-1edcc098ecccfe49927c9623be927ecd830e96b0.tar.bz2
Revert 223907 "[password generation] Upload possible account cre..."
including iostream adds some static intializers. Use ostream instead. > [password generation] Upload possible account creation forms via Autofill > > We consider that a form may be used for account creation if the first time > the saved credential is used it is on a different form, and the original form > has at least 3 text input fields. > > This change does not enable uploading for GNOME or KWallet users. > > BUG=240559 > > Review URL: https://chromiumcodereview.appspot.com/23580005 TBR=gcasto@chromium.org Review URL: https://codereview.chromium.org/24229002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@223923 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components/autofill')
-rw-r--r--components/autofill/content/renderer/password_form_conversion_utils.cc11
-rw-r--r--components/autofill/core/browser/autofill_manager.cc72
-rw-r--r--components/autofill/core/browser/autofill_manager.h13
-rw-r--r--components/autofill/core/browser/form_structure.h3
-rw-r--r--components/autofill/core/common/autofill_messages.h9
-rw-r--r--components/autofill/core/common/autofill_param_traits_macros.h10
-rw-r--r--components/autofill/core/common/form_data.cc14
-rw-r--r--components/autofill/core/common/form_data.h5
-rw-r--r--components/autofill/core/common/password_form.cc53
-rw-r--r--components/autofill/core/common/password_form.h16
10 files changed, 21 insertions, 185 deletions
diff --git a/components/autofill/content/renderer/password_form_conversion_utils.cc b/components/autofill/content/renderer/password_form_conversion_utils.cc
index 7dfd45d..3066373 100644
--- a/components/autofill/content/renderer/password_form_conversion_utils.cc
+++ b/components/autofill/content/renderer/password_form_conversion_utils.cc
@@ -4,9 +4,7 @@
#include "components/autofill/content/renderer/password_form_conversion_utils.h"
-#include "components/autofill/content/renderer/form_autofill_util.h"
#include "components/autofill/core/common/password_form.h"
-#include "third_party/WebKit/public/web/WebFormControlElement.h"
#include "third_party/WebKit/public/web/WebPasswordFormData.h"
using WebKit::WebFormElement;
@@ -16,7 +14,6 @@ namespace autofill {
namespace {
scoped_ptr<PasswordForm> InitPasswordFormFromWebPasswordForm(
- const WebFormElement& web_form,
const WebKit::WebPasswordFormData& web_password_form) {
PasswordForm* password_form = new PasswordForm();
password_form->signon_realm = web_password_form.signonRealm.utf8();
@@ -41,12 +38,6 @@ scoped_ptr<PasswordForm> InitPasswordFormFromWebPasswordForm(
password_form->preferred = false;
password_form->blacklisted_by_user = false;
password_form->type = PasswordForm::TYPE_MANUAL;
- WebFormElementToFormData(web_form,
- WebKit::WebFormControlElement(),
- REQUIRE_NONE,
- EXTRACT_NONE,
- &password_form->form_data,
- NULL /* FormFieldData */);
return scoped_ptr<PasswordForm>(password_form);
}
@@ -55,7 +46,7 @@ scoped_ptr<PasswordForm> InitPasswordFormFromWebPasswordForm(
scoped_ptr<PasswordForm> CreatePasswordForm(const WebFormElement& webform) {
WebPasswordFormData web_password_form(webform);
if (web_password_form.isValid())
- return InitPasswordFormFromWebPasswordForm(webform, web_password_form);
+ return InitPasswordFormFromWebPasswordForm(web_password_form);
return scoped_ptr<PasswordForm>();
}
diff --git a/components/autofill/core/browser/autofill_manager.cc b/components/autofill/core/browser/autofill_manager.cc
index 6f99772..0e2ee3a 100644
--- a/components/autofill/core/browser/autofill_manager.cc
+++ b/components/autofill/core/browser/autofill_manager.cc
@@ -253,16 +253,23 @@ bool AutofillManager::OnFormSubmitted(const FormData& form,
// Let Autocomplete know as well.
autocomplete_history_manager_->OnFormSubmitted(form);
- // Grab a copy of the form data.
- scoped_ptr<FormStructure> submitted_form(new FormStructure(form));
+ if (!IsAutofillEnabled())
+ return false;
- if (!ShouldUploadForm(*submitted_form))
+ if (driver_->GetWebContents()->GetBrowserContext()->IsOffTheRecord())
return false;
// Don't save data that was submitted through JavaScript.
if (!form.user_submitted)
return false;
+ // Grab a copy of the form data.
+ scoped_ptr<FormStructure> submitted_form(new FormStructure(form));
+
+ // Disregard forms that we wouldn't ever autofill in the first place.
+ if (!submitted_form->ShouldBeParsed(true))
+ return false;
+
// Ignore forms not present in our cache. These are typically forms with
// wonky JavaScript that also makes them not auto-fillable.
FormStructure* cached_submitted_form;
@@ -772,51 +779,6 @@ void AutofillManager::UploadFormData(const FormStructure& submitted_form) {
non_empty_types);
}
-bool AutofillManager::UploadPasswordGenerationForm(const FormData& form) {
- FormStructure form_structure(form);
-
- if (!ShouldUploadForm(form_structure))
- return false;
-
- if (!form_structure.ShouldBeCrowdsourced())
- return false;
-
- // TODO(gcasto): Check that PasswordGeneration is enabled?
-
- // Find the first password field to label. We don't try to label anything
- // else.
- bool found_password_field = false;
- for (size_t i = 0; i < form_structure.field_count(); ++i) {
- AutofillField* field = form_structure.field(i);
-
- ServerFieldTypeSet types;
- if (!found_password_field && field->form_control_type == "password") {
- types.insert(ACCOUNT_CREATION_PASSWORD);
- found_password_field = true;
- } else {
- types.insert(UNKNOWN_TYPE);
- }
- field->set_possible_types(types);
- }
- DCHECK(found_password_field);
-
- // Only one field type should be present.
- ServerFieldTypeSet available_field_types;
- available_field_types.insert(ACCOUNT_CREATION_PASSWORD);
-
- // Force uploading as these events are relatively rare and we want to make
- // sure to receive them. It also makes testing easier if these requests
- // always pass.
- form_structure.set_upload_required(UPLOAD_REQUIRED);
-
- if (!download_manager_)
- return false;
-
- return download_manager_->StartUploadRequest(form_structure,
- false /* was_autofilled */,
- available_field_types);
-}
-
void AutofillManager::Reset() {
form_structures_.clear();
has_logged_autofill_enabled_ = false;
@@ -1170,18 +1132,4 @@ void AutofillManager::UpdateInitialInteractionTimestamp(
}
}
-bool AutofillManager::ShouldUploadForm(const FormStructure& form) {
- if (!IsAutofillEnabled())
- return false;
-
- if (driver_->GetWebContents()->GetBrowserContext()->IsOffTheRecord())
- return false;
-
- // Disregard forms that we wouldn't ever autofill in the first place.
- if (!form.ShouldBeParsed(true))
- return false;
-
- return true;
-}
-
} // namespace autofill
diff --git a/components/autofill/core/browser/autofill_manager.h b/components/autofill/core/browser/autofill_manager.h
index a149e28..ec55abd3 100644
--- a/components/autofill/core/browser/autofill_manager.h
+++ b/components/autofill/core/browser/autofill_manager.h
@@ -157,16 +157,6 @@ class AutofillManager : public AutofillDownloadManager::Observer {
void OnRequestAutocomplete(const FormData& form,
const GURL& frame_url);
- // Try and upload |form|. This differs from OnFormSubmitted() in a few ways.
- // - This function will only label the first <input type="password"> field
- // as ACCOUNT_CREATION_PASSWORD. Other fields will stay unlabeled, as they
- // should have been labeled during the upload for OnFormSubmitted().
- // - This function does not assume that |form| is being uploaded during
- // the same browsing session as it was originally submitted (as we may
- // not have the necessary information to classify the form at that time)
- // so it bypasses the cache and doesn't log the same quality UMA metrics.
- bool UploadPasswordGenerationForm(const FormData& form);
-
// Resets cache.
virtual void Reset();
@@ -297,9 +287,6 @@ class AutofillManager : public AutofillDownloadManager::Observer {
void UpdateInitialInteractionTimestamp(
const base::TimeTicks& interaction_timestamp);
- // Shared code to determine if |form| should be uploaded.
- bool ShouldUploadForm(const FormStructure& form);
-
// Provides driver-level context to the shared code of the component. Must
// outlive this object.
AutofillDriver* driver_;
diff --git a/components/autofill/core/browser/form_structure.h b/components/autofill/core/browser/form_structure.h
index 6382c20..4ec8f9c 100644
--- a/components/autofill/core/browser/form_structure.h
+++ b/components/autofill/core/browser/form_structure.h
@@ -153,9 +153,6 @@ class FormStructure {
const GURL& source_url() const { return source_url_; }
- void set_upload_required(UploadRequired required) {
- upload_required_ = required;
- }
UploadRequired upload_required() const { return upload_required_; }
virtual std::string server_experiment_id() const;
diff --git a/components/autofill/core/common/autofill_messages.h b/components/autofill/core/common/autofill_messages.h
index 006744f..136329e 100644
--- a/components/autofill/core/common/autofill_messages.h
+++ b/components/autofill/core/common/autofill_messages.h
@@ -63,6 +63,15 @@ IPC_STRUCT_TRAITS_BEGIN(autofill::FormFieldDataPredictions)
IPC_STRUCT_TRAITS_MEMBER(overall_type)
IPC_STRUCT_TRAITS_END()
+IPC_STRUCT_TRAITS_BEGIN(autofill::FormData)
+ IPC_STRUCT_TRAITS_MEMBER(name)
+ IPC_STRUCT_TRAITS_MEMBER(method)
+ IPC_STRUCT_TRAITS_MEMBER(origin)
+ IPC_STRUCT_TRAITS_MEMBER(action)
+ IPC_STRUCT_TRAITS_MEMBER(user_submitted)
+ IPC_STRUCT_TRAITS_MEMBER(fields)
+IPC_STRUCT_TRAITS_END()
+
IPC_STRUCT_TRAITS_BEGIN(autofill::FormDataPredictions)
IPC_STRUCT_TRAITS_MEMBER(data)
IPC_STRUCT_TRAITS_MEMBER(signature)
diff --git a/components/autofill/core/common/autofill_param_traits_macros.h b/components/autofill/core/common/autofill_param_traits_macros.h
index 91d357a..b0a1ccf 100644
--- a/components/autofill/core/common/autofill_param_traits_macros.h
+++ b/components/autofill/core/common/autofill_param_traits_macros.h
@@ -13,15 +13,6 @@
IPC_ENUM_TRAITS(autofill::PasswordForm::Type)
-IPC_STRUCT_TRAITS_BEGIN(autofill::FormData)
- IPC_STRUCT_TRAITS_MEMBER(name)
- IPC_STRUCT_TRAITS_MEMBER(method)
- IPC_STRUCT_TRAITS_MEMBER(origin)
- IPC_STRUCT_TRAITS_MEMBER(action)
- IPC_STRUCT_TRAITS_MEMBER(user_submitted)
- IPC_STRUCT_TRAITS_MEMBER(fields)
-IPC_STRUCT_TRAITS_END()
-
IPC_STRUCT_TRAITS_BEGIN(autofill::PasswordForm)
IPC_STRUCT_TRAITS_MEMBER(signon_realm)
IPC_STRUCT_TRAITS_MEMBER(origin)
@@ -40,7 +31,6 @@ IPC_STRUCT_TRAITS_BEGIN(autofill::PasswordForm)
IPC_STRUCT_TRAITS_MEMBER(blacklisted_by_user)
IPC_STRUCT_TRAITS_MEMBER(type)
IPC_STRUCT_TRAITS_MEMBER(times_used)
- IPC_STRUCT_TRAITS_MEMBER(form_data)
IPC_STRUCT_TRAITS_END()
#endif // COMPONENTS_AUTOFILL_CORE_COMMON_AUTOFILL_PARAM_TRAITS_MACROS_H_
diff --git a/components/autofill/core/common/form_data.cc b/components/autofill/core/common/form_data.cc
index 050e2e5..078a58d 100644
--- a/components/autofill/core/common/form_data.cc
+++ b/components/autofill/core/common/form_data.cc
@@ -6,7 +6,6 @@
#include "base/pickle.h"
#include "base/strings/string_util.h"
-#include "base/strings/utf_string_conversions.h"
#include "components/autofill/core/common/form_field_data.h"
namespace autofill {
@@ -79,19 +78,6 @@ bool FormData::operator!=(const FormData& form) const {
return !operator==(form);
}
-std::ostream& operator<<(std::ostream& os, const FormData& form) {
- os << UTF16ToUTF8(form.name) << " "
- << UTF16ToUTF8(form.method) << " "
- << form.origin << " "
- << form.action << " "
- << form.user_submitted << " "
- << "Fields:";
- for (size_t i = 0; i < form.fields.size(); ++i) {
- os << form.fields[i] << ",";
- }
- return os;
-}
-
void SerializeFormData(const FormData& form_data, Pickle* pickle) {
pickle->WriteInt(kPickleVersion);
pickle->WriteString16(form_data.name);
diff --git a/components/autofill/core/common/form_data.h b/components/autofill/core/common/form_data.h
index b41619c..1d6dffa 100644
--- a/components/autofill/core/common/form_data.h
+++ b/components/autofill/core/common/form_data.h
@@ -19,7 +19,7 @@ struct FormData {
FormData(const FormData& data);
~FormData();
- // Used in testing.
+ // Used by FormStructureTest.
bool operator==(const FormData& form) const;
bool operator!=(const FormData& form) const;
@@ -37,9 +37,6 @@ struct FormData {
std::vector<FormFieldData> fields;
};
-// For testing.
-std::ostream& operator<<(std::ostream& os, const FormData& form);
-
// Serialize FormData. Used by the PasswordManager to persist FormData
// pertaining to password forms. Serialized data is appended to |pickle|
void SerializeFormData(const FormData& form_data, Pickle* pickle);
diff --git a/components/autofill/core/common/password_form.cc b/components/autofill/core/common/password_form.cc
index 7bd8fe8..1f9c762 100644
--- a/components/autofill/core/common/password_form.cc
+++ b/components/autofill/core/common/password_form.cc
@@ -2,10 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include <iostream>
-
-#include "base/strings/string16.h"
-#include "base/strings/utf_string_conversions.h"
#include "components/autofill/core/common/password_form.h"
namespace autofill {
@@ -27,53 +23,4 @@ bool PasswordForm::IsPublicSuffixMatch() const {
return !original_signon_realm.empty();
}
-bool PasswordForm::operator==(const PasswordForm& form) const {
- return signon_realm == form.signon_realm &&
- origin == form.origin &&
- action == form.action &&
- submit_element == form.submit_element &&
- username_element == form.username_element &&
- username_value == form.username_value &&
- other_possible_usernames == form.other_possible_usernames &&
- password_element == form.password_element &&
- password_value == form.password_value &&
- password_autocomplete_set == form.password_autocomplete_set &&
- old_password_element == form.old_password_element &&
- old_password_value == form.old_password_value &&
- ssl_valid == form.ssl_valid &&
- preferred == form.preferred &&
- date_created == form.date_created &&
- blacklisted_by_user == form.blacklisted_by_user &&
- type == form.type &&
- times_used == form.times_used &&
- form_data == form.form_data;
-}
-
-bool PasswordForm::operator!=(const PasswordForm& form) const {
- return !operator==(form);
-}
-
-std::ostream& operator<<(std::ostream& os, const PasswordForm& form) {
- return os << "scheme: " << form.scheme
- << " signon_realm: " << form.signon_realm
- << " origin: " << form.origin
- << " action: " << form.action
- << " submit_element: " << UTF16ToUTF8(form.submit_element)
- << " username_elem: " << UTF16ToUTF8(form.username_element)
- << " username_value: " << UTF16ToUTF8(form.username_value)
- << " password_elem: " << UTF16ToUTF8(form.password_element)
- << " password_value: " << UTF16ToUTF8(form.password_value)
- << " old_password_element: "
- << UTF16ToUTF8(form.old_password_element)
- << " old_password_value: " << UTF16ToUTF8(form.old_password_value)
- << " autocomplete_set:" << form.password_autocomplete_set
- << " blacklisted: " << form.blacklisted_by_user
- << " preferred: " << form.preferred
- << " ssl_valid: " << form.ssl_valid
- << " date_created: " << form.date_created.ToDoubleT()
- << " type: " << form.type
- << " times_used: " << form.times_used
- << " form_data: " << form.form_data;
-}
-
} // namespace autofill
diff --git a/components/autofill/core/common/password_form.h b/components/autofill/core/common/password_form.h
index 8485225..9ecb214 100644
--- a/components/autofill/core/common/password_form.h
+++ b/components/autofill/core/common/password_form.h
@@ -10,7 +10,6 @@
#include <vector>
#include "base/time/time.h"
-#include "components/autofill/core/common/form_data.h"
#include "url/gurl.h"
namespace autofill {
@@ -181,20 +180,9 @@ struct PasswordForm {
// When parsing an HTML form, this is not used.
int times_used;
- // Autofill representation of this form. Used to communicate with the
- // Autofill servers if necessary. Currently this is only used to help
- // determine forms where we can trigger password generation.
- //
- // When parsing an HTML form, this is normally set.
- FormData form_data;
-
// Returns true if this match was found using public suffix matching.
bool IsPublicSuffixMatch() const;
- // Equality operators for testing.
- bool operator==(const PasswordForm& form) const;
- bool operator!=(const PasswordForm& form) const;
-
PasswordForm();
~PasswordForm();
};
@@ -202,10 +190,6 @@ struct PasswordForm {
// Map username to PasswordForm* for convenience. See password_form_manager.h.
typedef std::map<string16, PasswordForm*> PasswordFormMap;
-// For testing.
-std::ostream& operator<<(std::ostream& os,
- const autofill::PasswordForm& form);
-
} // namespace autofill
#endif // COMPONENTS_AUTOFILL_CORE_COMMON_PASSWORD_FORM_H__