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

Unified Diff: components/autofill/content/renderer/form_cache.h

Issue 803673002: Autofill: one FormCache per WebFrame. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 6 years 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
Index: components/autofill/content/renderer/form_cache.h
diff --git a/components/autofill/content/renderer/form_cache.h b/components/autofill/content/renderer/form_cache.h
index be6b5dd9c98a1cbeb20c3d9576f5e58c586ca14a..d0c29cdaf8114a245a829d7b05dfa165be1e6c7c 100644
--- a/components/autofill/content/renderer/form_cache.h
+++ b/components/autofill/content/renderer/form_cache.h
@@ -10,6 +10,7 @@
#include <vector>
#include "base/strings/string16.h"
+#include "components/autofill/core/common/form_data.h"
namespace blink {
class WebDocument;
@@ -23,21 +24,20 @@ class WebSelectElement;
namespace autofill {
-struct FormData;
struct FormDataPredictions;
-// Manages the forms in a RenderView.
+// Manages the forms in a single RenderFrame.
class FormCache {
public:
- FormCache();
+ explicit FormCache(const blink::WebFrame& frame);
~FormCache();
- // Scans the DOM in |frame| extracting and storing forms that have not been
+ // Scans the DOM in |frame_| extracting and storing forms that have not been
// seen before. Returns the extracted forms.
- std::vector<FormData> ExtractNewForms(const blink::WebFrame& frame);
+ std::vector<FormData> ExtractNewForms();
- // Resets the forms for the specified |frame|.
- void ResetFrame(const blink::WebFrame& frame);
+ // Resets the forms.
+ void Reset();
// Clears the values of all input elements in the form that contains
// |element|. Returns false if the form is not found.
@@ -58,13 +58,15 @@ class FormCache {
const std::vector<blink::WebFormControlElement>& control_elements,
bool log_deprecation_messages);
- // The cached web frames and their corresponding synthetic FormData.
+ // The frame this FormCache is associated with.
+ const blink::WebFrame& frame_;
+
+ // The cached forms. Used to prevent re-extraction of forms.
+ std::set<FormData> parsed_forms_;
+
// The synthetic FormData is for all the fieldsets in the document without a
// form owner.
- std::map<blink::WebDocument, FormData> documents_to_synthetic_form_map_;
-
- // The cached forms per frame. Used to prevent re-extraction of forms.
- std::map<const blink::WebFrame*, std::set<FormData> > parsed_forms_;
+ FormData synthetic_form_;
// The cached initial values for <select> elements.
std::map<const blink::WebSelectElement, base::string16>
« no previous file with comments | « components/autofill/content/renderer/autofill_agent.cc ('k') | components/autofill/content/renderer/form_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698